Files
planning-with-files/.opencode/packages/opencode-planning-with-files/README.md
T
OthmanAdi a9d9cccb04 feat(opencode): native OpenCode plugin with per-turn injection, write reminders, compaction flush, session-idle gate and pwf tools
New npm package opencode-planning-with-files under
.opencode/packages/opencode-planning-with-files/ (TypeScript, Vitest):

- chat.message appends the framed active plan (plan head, normalized
  progress tail, findings pointer) to every user message, or a
  once-per-turn ambiguity notice when a direct child project carries its
  own live plan
- tool.execute.after appends the progress reminder to write, edit,
  patch, multiedit and apply_patch output
- experimental.session.compacting keeps the plan pointer and attestation
  hash in the compaction context
- event session.idle runs the completion gate in gated mode and
  re-prompts the session with the gate reason through the SDK (Tier 2);
  child sessions are never re-prompted, the shared .stop_blocks and
  .gate_last_ledger counters and PWF_GATE_CAP bound it
- tools pwf_init (root or .planning/<date>-<slug>/, mode autonomous or
  gated with the v3 markers and attestation), pwf_status, pwf_check

The resolver, ambiguity rule, gate decision table, init markers,
attestation check and frame format mirror resolve-plan-dir.sh,
inject-plan.sh, check-complete.sh --gate, init-session.sh and the Hermes
plugin. Each session resolves its plan from its own OpenCode directory.
PWF_PLAN_ROOT fails closed, PLANNING_DISABLED silences every hook.

Also: .opencode/commands/pwf.md and pwf-status.md in OpenCode's command
format, a dogfood entry .opencode/plugins/planning-with-files.ts that
loads the plugin from source when this repository is opened in OpenCode,
.opencode/package.json tracked with the @opencode-ai/plugin dependency,
and a vitest (OpenCode plugin) CI job.

Verified live in OpenCode 1.18.21: plugin loaded, pwf_init/pwf_status/
pwf_check listed, /pwf and /pwf-status listed, a real session message
received the framed plan as a synthetic part.
2026-09-02 08:44:53 +02:00

2.6 KiB

opencode-planning-with-files

Native OpenCode plugin for planning-with-files: persistent file-based planning for AI coding agents. The plan lives on disk in task_plan.md, findings.md and progress.md; this plugin keeps it in the model's context on every turn and can hold the session open until the plan reports complete.

Install

Add the plugin to opencode.json (project) or ~/.config/opencode/opencode.json (global):

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-planning-with-files"]
}

OpenCode installs the package on the next start. Install the skill text as well so the agent knows the workflow:

npx skills add OthmanAdi/planning-with-files --skill planning-with-files -g

That command lands in ~/.agents/skills/planning-with-files/, one of the paths OpenCode reads natively.

What the plugin does

Hook Behavior
chat.message Appends the active plan to every user message: the framed head of task_plan.md, the normalized tail of progress.md, a pointer to findings.md. Resolves PLAN_ID, then .planning/.active_plan, then the newest .planning/<slug>/task_plan.md, then the legacy root file
tool.execute.after Appends a progress reminder to the output of write, edit, patch and multiedit while a plan exists
experimental.session.compacting Keeps the plan pointer and its attestation hash in the compaction summary
event (session.idle) Completion gate in gated mode: while an in_progress phase remains, the plugin re-prompts the session with the gate reason. Block cap PWF_GATE_CAP (default 20) and ledger stall detection release the session; child sessions are never re-prompted
tools pwf_init (root or .planning/<date>-<slug>/, mode: autonomous or gated with attestation), pwf_status, pwf_check

Autonomous and gated plans inject only when .attestation (slug) or .plan-attestation (root) matches the SHA-256 of task_plan.md. PLANNING_DISABLED=1 silences every hook; PWF_PLAN_ROOT=<absolute path> pins the project root and fails closed when it does not resolve. A live plan in a direct child project makes a cwd guess ambiguous and nothing is injected, with a one-line notice.

Commands

Copy pwf.md and pwf-status.md from the repository's .opencode/commands/ into ~/.config/opencode/commands/ (or your project's .opencode/commands/) to get /pwf [--gated] [plan name] and /pwf-status.

Full guide: docs/opencode.md.

License

MIT