Add Pane agent context discovery#258
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d33297de40
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
parsakhaz
left a comment
There was a problem hiding this comment.
PR Review
Issue context: #257 - Add lazy-loadable Pane agent context and managed AGENTS.md section
Quality Gates
- Typecheck: PASS
- Lint: PASS (0 errors, 165 warnings - all pre-existing)
Must-Fix (0)
None.
Should-Fix (0)
None.
Suggestions (2)
-
Extra scope:
autoStartOnBootsetting andstartPinneddefault - The PR adds anautoStartOnBoottoggle to Settings.tsx and configManager.ts, plus astartPinned: falsedefault ingetSessionCreationPreferences(). Neither is related to issue #257 (agent context). Both are clean and harmless, but splitting them into their own commit or PR would keep the diff focused on one concern. -
Empty AGENTS.md left behind when disabling (
agentContextManager.ts:84) - When the managed block is the only content inAGENTS.md, disabling the setting writes an empty string rather than deleting the file. This is safe and the test explicitly covers it, but an emptyAGENTS.mdfile in a repo could confuse users. Consider deleting the file whennext.trim().length === 0and Pane was the one that created it. Only a suggestion since it's a minor UX edge case and the current behavior is explicitly tested.
Completeness
The implementation covers all acceptance criteria from issue #257 and the follow-up decision comments:
runpane agent-contextprints a brief, token-efficient view (contract-driven) - donerunpane agent-context --command <name>prints detailed definitions - done--jsonsupport for machine-readable output - done- Managed
AGENTS.mdblock with delimited markers, idempotent upsert, content-preserving insert/replace/remove - done - Settings toggle (default-on) with disable-removes-from-all-projects behavior - done
- Lifecycle wiring: project create, project activate, config toggle change - done
- Node and Python implementations mirror each other from the shared contract - done
- Tests: agentContextManager unit tests (create, update, replace, remove, symlink safety), config IPC handler test (disable removes from all projects), runpane IPC handler tests (repos list/add/create, dry-run, idempotent add) - done
- Schema validation, fixture tests, and
--checkmode in the generator - done
Summary
This is a well-crafted PR. The architecture is clean: a single contract.json drives all generated surfaces (Node, Python, shared types, docs, fixtures), the agentContextManager has careful symlink protection via O_NOFOLLOW, idempotent block management with content comparison to avoid unnecessary writes, and all IPC integration points use best-effort error handling so a failed AGENTS.md write never blocks project creation or activation. Test coverage is solid across the manager, the config handler, and the runpane IPC handlers. Ready to merge.
Summary
runpane agent-contextfor brief agent-facing Pane command discovery and lazy detailed command definitions via--command <name>.AGENTS.mdsupport with a Settings toggle, best-effort project lifecycle wiring, and removal of Pane-owned blocks when disabled.Closes #257
Validation
node scripts/generate-runpane-contract.js --checkpnpm run test:runpane-contractpnpm --filter main exec vitest run src/services/agentContextManager.test.ts src/ipc/runpane.test.tsPYTHONDONTWRITEBYTECODE=1 python3 -B -m compileall -q packages/runpane-py/src/runpanepnpm typecheckpnpm lint(passes with existing warnings)node packages/runpane/dist/cli.js agent-contextnode packages/runpane/dist/cli.js agent-context --command "panes create" --jsonPYTHONPATH=packages/runpane-py/src python3 -m runpane agent-contextPYTHONPATH=packages/runpane-py/src python3 -m runpane agent-context --command "panes create" --jsonNotes