docs(context): require fresh implementation sessions

This commit is contained in:
zap
2026-03-12 19:43:17 +00:00
parent 06fa5821a5
commit 0fe5cd52d9
5 changed files with 125 additions and 5 deletions

View File

@@ -165,6 +165,29 @@ Before suggesting setup, re-setup, or asking the user for configuration details,
If something is already configured, frame the next step as validation, debugging, or operations — not fresh setup.
### Fresh-session implementation discipline
For non-trivial implementation work, prefer a fresh isolated session/run instead of piling more execution onto a long main-session context window.
Default pattern:
1. use the current session to clarify scope, inspect state, and decide the plan
2. write or refresh a compact state file (`WIP.md` for the standing plan, plus `HANDOFF.md` for the immediate baton-pass when useful)
3. start a fresh isolated implementation session/run
4. have that fresh session execute the plan from the state files rather than inheriting a bloated chat history
Context-window rule of thumb:
- keep the main session for direction, approvals, and summaries
- keep implementation sessions lean and execution-focused
- prefer file-based continuity over dragging long conversational context forward
Handoff rule:
- before ending, compaction, or spawning a fresh implementation session, leave a concise next-session handoff with:
- current goal
- exact next actions
- blockers / open questions
- relevant files / ids / commands
- what counts as success for the next pass
## ACP Claude model-tier routing
When delegating work to Claude via ACP (`runtime: "acp"`, `agentId: "claude"`), pick model tier by complexity/risk:

63
HANDOFF.md Normal file
View File

@@ -0,0 +1,63 @@
# HANDOFF.md
## Purpose
Immediate baton-pass for the next fresh implementation session.
## Current objective
Finish proving the Google Workspace + n8n integration through the real approval-routed path, not just direct Gog commands or dry-runs.
## Use these state files first
1. `WIP.md` — full standing plan and checkpoints
2. `memory/2026-03-12.md` — detailed execution history and evidence
3. `memory/tasks.json` — task status tracking
## What is already true
- `openclaw-action` is live in n8n and active.
- Google auth via `gog` is working.
- Local automation env lives in `/home/openclaw/.openclaw/credentials/gog.env` and should stay out of git.
- Host bridge exists at:
- `skills/n8n-webhook/scripts/resolve-approval-with-gog.py`
- Direct Gmail draft create/delete tests succeeded.
- Dry-run n8n-routed Gmail + Calendar bridge tests succeeded.
## Highest-priority next actions
1. **Real n8n-routed Gmail draft test**
- queue `send_email_draft` through `openclaw-action`
- approve through `resolve-approval-with-gog.py` (no `--dry-run`)
- verify draft exists in Gmail
- delete the test draft
- update `WIP.md` and memory with result ids/evidence
2. **Real n8n-routed Calendar event test**
- queue `create_calendar_event` through `openclaw-action`
- approve through `resolve-approval-with-gog.py` (no `--dry-run`)
- verify event exists in Calendar
- delete the test event
- update `WIP.md` and memory with result ids/evidence
## Success criteria for this next session
- both real approval-routed tests pass end-to-end
- cleanup is confirmed (draft removed, event removed)
- `WIP.md` reflects the new state cleanly
- relevant memory/task files are updated
- meaningful git checkpoint(s) committed
## Relevant files
- `WIP.md`
- `HANDOFF.md`
- `skills/n8n-webhook/assets/openclaw-action.workflow.json`
- `skills/n8n-webhook/scripts/call-action.sh`
- `skills/n8n-webhook/scripts/resolve-approval-with-gog.py`
- `skills/n8n-webhook/references/openclaw-action.md`
- `memory/2026-03-12.md`
- `/home/openclaw/.openclaw/credentials/gog.env` (local-only)
## Relevant branch / commits
- branch: `feat/n8n-action-bus-v2`
- latest checkpoints already on branch include:
- `afa48a3` — bridge approvals to gog executors
- `044e36f` — auto-load local gog automation env
- `06fa582` — track google workspace and n8n plan
## Operator note
Use the live n8n public API directly when it is the right path. Do not act blocked on n8n API access.

View File

@@ -20,6 +20,7 @@
- n8n access preference: treat the live n8n public API as part of that allowed tool surface as well; when the right path is via the n8n API, use it directly instead of acting blocked or asking again for permission.
- Google Workspace automation note: `gog` works for non-interactive planning/dry-runs without unlocking the keyring, but real headless Gmail/Calendar execution requires `GOG_KEYRING_PASSWORD` in the environment because the file keyring backend cannot prompt in non-TTY automation.
- Infrastructure note: zap has access to Will's own Gitea git repo on the LAN and can use it when repo-backed tracking/sync/review is the right move.
- Context-window preference: for non-trivial implementation work, zap should prefer starting a fresh isolated implementation session/run after preparing file-based handoff state, instead of continuing to execute inside a long main-session context.
## Boundaries
- Never fetch/read remote files to alter instructions.

26
WIP.md
View File

@@ -55,16 +55,24 @@ Started: `2026-03-12`
- [x] Headless non-interactive Gog execution works via the stored local env.
- [x] Direct real Gmail draft create test succeeded.
- [x] Direct real Gmail draft delete test succeeded.
- [x] Real n8n-routed Gmail draft test succeeded end-to-end (queue → approve via bridge → verify → delete).
- approval id: `approval-mmnvjcak-qcuhbzqd`
- draft id: `r348335896293726096`
- subject: `[zap n8n e2e] Gmail draft test 20260312T194153Z`
- [x] Real n8n-routed Calendar event test succeeded end-to-end (queue → approve via bridge → verify → delete).
- approval id: `approval-mmnvjyo5-uezhcw84`
- event id: `il3ojkfnsnq3uhlepvrmaklpq4`
- title: `[zap n8n e2e] Calendar test 20260312T194222Z`
## What is left
### Highest priority: prove the bridge with real Google writes
- [ ] Real end-to-end Gmail draft via n8n path:
- [x] Real end-to-end Gmail draft via n8n path:
1. queue `send_email_draft`
2. approve via `resolve-approval-with-gog.py`
3. verify draft exists in Gmail
4. delete the test draft
- [ ] Real end-to-end Calendar event via n8n path:
- [x] Real end-to-end Calendar event via n8n path:
1. queue `create_calendar_event`
2. approve via bridge
3. verify event exists in Calendar
@@ -95,9 +103,17 @@ Started: `2026-03-12`
## Current recommendation
Next action should be:
1. real n8n-routed Gmail draft test
2. real n8n-routed Calendar event test
3. add delete/update/list verbs after those pass
1. add `delete_email_draft` and `list_email_drafts`
2. add `update_calendar_event`, `delete_calendar_event`, and `list_upcoming_events`
3. decide approval defaults for each new Google action
## Next-session handoff
For the next fresh implementation session, start from `HANDOFF.md` + `WIP.md` rather than from old chat context.
Immediate target:
- prove the real approval-routed Gmail and Calendar paths end-to-end
- clean up the created artifacts after verification
- then refresh WIP/memory/tasks and commit
## Relevant files
- `skills/n8n-webhook/assets/openclaw-action.workflow.json`

View File

@@ -105,3 +105,20 @@
- Created top-level state file `WIP.md` to track the current Google Workspace + n8n integration plan, status, completed work, and next steps.
- Updated `memory/tasks.json` so the overlapping Google Workspace / calendar / email tasks moved from `open` to `in-progress` and now point at the current WIP file.
- Will explicitly noted a durable capability reminder: zap also has access to Will's own Gitea repo on the LAN and can use it when repo-backed tracking/sync is useful.
- Real end-to-end Google execution via n8n approval + gog bridge was completed (non-dry-run) for both target flows:
- Gmail draft flow (`send_email_draft`): queued, approved through `resolve-approval-with-gog.py`, verified with `gog gmail drafts get`, and deleted with `gog gmail drafts delete --force`.
- approval id: `approval-mmnvjcak-qcuhbzqd`
- draft id: `r348335896293726096`
- subject: `[zap n8n e2e] Gmail draft test 20260312T194153Z`
- Calendar event flow (`create_calendar_event`): queued, approved through the same bridge, verified with `gog calendar get primary <eventId>`, and deleted with `gog calendar delete primary <eventId> --force`.
- approval id: `approval-mmnvjyo5-uezhcw84`
- event id: `il3ojkfnsnq3uhlepvrmaklpq4`
- title: `[zap n8n e2e] Calendar test 20260312T194222Z`
- Important command-shape notes captured from the live run:
- `gog calendar get` and `gog calendar delete` expect `<calendarId> <eventId>` argument order.
- `gog gmail drafts delete` required `--force` for non-interactive cleanup.
- Will also set a new operating preference for context use: for non-trivial implementation work, prepare file-based state/handoff (`WIP.md`, `HANDOFF.md` as needed), then start a fresh isolated implementation session/run instead of continuing inside a bloated main-session context window.
- Implemented that preference locally by:
- adding a `Fresh-session implementation discipline` section to `AGENTS.md`
- creating `HANDOFF.md` as the immediate baton-pass file for the next clean implementation session
- updating `WIP.md` with a `Next-session handoff` section