Skip to content

fix(pi): let agent submit any markdown plan file by path#595

Open
backnotprop wants to merge 3 commits intomainfrom
fix/pi-plan-submit-filepath
Open

fix(pi): let agent submit any markdown plan file by path#595
backnotprop wants to merge 3 commits intomainfrom
fix/pi-plan-submit-filepath

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

Summary

Replaces the configured-file plan-mode model with an agent-driven one. The agent writes its plan as a markdown file anywhere inside the working directory and passes the path to plannotator_submit_plan.

  • Removed --plan-file flag, /plannotator-set-file command, interactive path prompt, and the planFilePath module state.
  • plannotator_submit_plan gains a required filePath arg, validated as .md/.mdx inside cwd, stat-checked, then read.
  • Planning write gate now allows any markdown file inside cwd (traversal/absolute-escape rejected) instead of a single path.
  • lastSubmittedPath tracks the last submission so execution phase rebuilds correctly on session resume.
  • Planning system prompt rewritten to suggest (but not require) PLAN.md or plans/<name>.md conventions.

Version history in ~/.plannotator/history/{project}/{slug}/ already keys off plan content (first # Heading + date) rather than file path, so free-form naming keeps version linking intact.

Supersedes #594 — that PR's directory-scope gate introduced sibling-write leakage and didn't fix the submit-on-directory failure mode.

Test plan

  • bun test apps/pi-extension — 35 pass (tool-scope tests rewritten for extension-based gate)
  • bun run typecheck — clean
  • bun run build:review && bun run build:hook && bun run --cwd apps/pi-extension build — succeed
  • Manual: enable plan mode, have agent write PLAN.md, submit, approve → executing
  • Manual: enable plan mode, have agent write plans/foo.md, submit → approve
  • Manual: agent tries to write src/app.ts during planning → blocked
  • Manual: agent submits a non-markdown path or traversal → rejected with clear error

Removes all configured plan-file state (module var, --plan-file flag,
/plannotator-set-file command, interactive path prompt). The agent now
writes its plan as a markdown file anywhere inside the working directory
and calls plannotator_submit_plan with the file path.

During planning, the write gate allows any .md / .mdx file inside cwd
(with traversal/absolute-escape rejection) instead of a single configured
path. plannotator_submit_plan gains a required filePath parameter, which
is validated, stat-checked, and read. Version history in ~/.plannotator
continues to key off plan content so naming is free-form without losing
version linking.

For provenance purposes, this commit was AI assisted.
isSubmitPathAllowed was a pure pass-through to isPlanWritePathAllowed
with no plausible reason to diverge. Use the write-gate helper directly
from submit_plan and drop the alias.

For provenance purposes, this commit was AI assisted.
The shipped plannotator.json planning prompt still referenced
${planFilePath} and instructed the agent to call plannotator_submit_plan
with no arguments. After the submit tool gained a required filePath
parameter, default sessions hit the stale prompt and submits failed.
Rewritten to match the new flow: agent picks its own plan filename and
passes it to plannotator_submit_plan.

For provenance purposes, this commit was AI assisted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant