Skip to content

Add Pane agent context discovery#258

Merged
parsakhaz merged 2 commits into
mainfrom
issue-257-agent-context
Jun 18, 2026
Merged

Add Pane agent context discovery#258
parsakhaz merged 2 commits into
mainfrom
issue-257-agent-context

Conversation

@parsakhaz

Copy link
Copy Markdown
Member

Summary

  • Adds runpane agent-context for brief agent-facing Pane command discovery and lazy detailed command definitions via --command <name>.
  • Extends the shared runpane contract/schema and regenerates Node, Python, shared, fixture, and docs artifacts.
  • Adds default-on managed AGENTS.md support 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 --check
  • pnpm run test:runpane-contract
  • pnpm --filter main exec vitest run src/services/agentContextManager.test.ts src/ipc/runpane.test.ts
  • PYTHONDONTWRITEBYTECODE=1 python3 -B -m compileall -q packages/runpane-py/src/runpane
  • pnpm typecheck
  • pnpm lint (passes with existing warnings)
  • Smoke: node packages/runpane/dist/cli.js agent-context
  • Smoke: node packages/runpane/dist/cli.js agent-context --command "panes create" --json
  • Smoke: PYTHONPATH=packages/runpane-py/src python3 -m runpane agent-context
  • Smoke: PYTHONPATH=packages/runpane-py/src python3 -m runpane agent-context --command "panes create" --json

Notes

  • Local environment prints the repo's Node engine warning because this shell is on Node v20.19.3 while the repo asks for Node >=22.14.0; validation still passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread main/src/services/agentContextManager.ts Outdated
Comment thread main/src/ipc/config.ts Outdated

@parsakhaz parsakhaz left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

  1. Extra scope: autoStartOnBoot setting and startPinned default - The PR adds an autoStartOnBoot toggle to Settings.tsx and configManager.ts, plus a startPinned: false default in getSessionCreationPreferences(). 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.

  2. Empty AGENTS.md left behind when disabling (agentContextManager.ts:84) - When the managed block is the only content in AGENTS.md, disabling the setting writes an empty string rather than deleting the file. This is safe and the test explicitly covers it, but an empty AGENTS.md file in a repo could confuse users. Consider deleting the file when next.trim().length === 0 and 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-context prints a brief, token-efficient view (contract-driven) - done
  • runpane agent-context --command <name> prints detailed definitions - done
  • --json support for machine-readable output - done
  • Managed AGENTS.md block 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 --check mode 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.

@parsakhaz parsakhaz merged commit eba25c1 into main Jun 18, 2026
16 checks passed
@parsakhaz parsakhaz deleted the issue-257-agent-context branch June 18, 2026 00:14
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.

Add lazy-loadable Pane agent context and managed AGENTS.md section

1 participant