Skip to content

feat(agent): install the six-tool-era standing manual and native client kit - #3061

Merged
Sinity merged 2 commits into
masterfrom
feature/mcp/agent-manual-install-kit
Jul 18, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/mcp/agent-manual-install-kit

Conversation

@Sinity

@Sinity Sinity commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

Adds polylogue.agent_integration: a typed spec, generated manual/deep-reference/manifest/recipes assets, a native installer for Claude Code/Codex/Gemini/Hermes, a role-scoped runtime manifest, a polylogue agent CLI, and a Home Manager module.

Problem

The consumer-owned skill/SessionStart text agents currently see is stale, reports the wrong tool surface, and has no generated, verified, drift-checked path from the actual MCP declarations to what an agent is taught.

Ref polylogue-3gd.2, polylogue-3gd.3.

Solution

The manual/reference are generated from the existing 104-tool declaration registry (t46.8.1, landed in #3004) and stage the target six-tool contract (query/read/get/explain/context/status + write/judge/run/operate) without claiming the cutover has landed — installation and instruction injection fail closed until exact role-scoped tool names and a live-verified schema marker both exist. Retains the beads-06 native installer architecture (managed MCP entries, idempotent upgrade, drift detection, lossless uninstall) rather than forking it.

External provenance: recovered GPT Pro result package mcp-01-agent-manual-r01.zip, SHA-256 verified against snapshot commit 536a53efac0cbe4a2473ad379e4db49ef3fce74d. The patch applied cleanly except the two generated topology files, which were regenerated locally (devtools render topology-projection && devtools render topology-status) rather than patched. Fixed post-apply: missing -f/--format short-flag aliases on all 6 new agent subcommands, a redundant cast flagged by mypy, and 5 undocumented CLI surfaces caught by devtools verify docs-coverage (added a CLI-commands section to the generated standing manual generator).

Not claimed

This is the installer/manual foundation, not the six-tool cutover itself: no compatibility tool is removed, FastMCP signatures are not yet live-verified, and instruction injection stays staged until t46.8.2/t46.8.3 land the real read/context/judgment migration.

Verification

  • devtools test tests/unit/agent_integration/ tests/unit/mcp/test_server_surfaces.py tests/unit/cli/ — 2731 passed, 1 skipped. The 11 remaining failures are pre-existing on unpatched master (confirmed by rerunning them there): read_timeout TypeError in test_diagnostics.py/test_json_output.py, schema-version snapshot drift (37→39) in test_plain_cli_snapshots.py, and a source_debt is locked sqlite contention in test_insights.py — none related to this change.
  • devtools verify --quick — 16/16 steps passed (format, lint, mypy, render-all, topology, layering, closure-matrix, docs-coverage, manifests, ci-workflows, doc-commands, test-infra-currency, test-clock-hygiene, pytest-timeout-overrides, degrade-loudly).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 219f55db-acc1-459b-aa7c-411e4a14ba0c

📥 Commits

Reviewing files that changed from the base of the PR and between 705ee9b and 7c10c1d.

📒 Files selected for processing (37)
  • devtools/command_catalog.py
  • devtools/docs_surface.py
  • devtools/generated_surfaces.py
  • devtools/render_agent_manual.py
  • devtools/verify_agent_integration.py
  • docs/README.md
  • docs/agent-integration-reference.md
  • docs/agent-manual.md
  • docs/cli-reference.md
  • docs/devtools.md
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
  • flake.nix
  • nix/agent-integration-module.nix
  • polylogue/agent_integration/__init__.py
  • polylogue/agent_integration/assets.py
  • polylogue/agent_integration/data/__init__.py
  • polylogue/agent_integration/data/deep-reference.md
  • polylogue/agent_integration/data/integration-manifest.json
  • polylogue/agent_integration/data/integration-spec.json
  • polylogue/agent_integration/data/recipes.json
  • polylogue/agent_integration/data/standing-manual.md
  • polylogue/agent_integration/data/tool-contracts.json
  • polylogue/agent_integration/installer.py
  • polylogue/agent_integration/manifest.py
  • polylogue/agent_integration/spec.py
  • polylogue/cli/click_command_registration.py
  • polylogue/cli/commands/agent.py
  • polylogue/mcp/server.py
  • polylogue/mcp/server_resources.py
  • tests/infra/mcp.py
  • tests/unit/agent_integration/test_assets_and_cli.py
  • tests/unit/agent_integration/test_installer.py
  • tests/unit/agent_integration/test_manual_contract.py
  • tests/unit/cli/__snapshots__/test_help_snapshots.ambr
  • tests/unit/cli/__snapshots__/test_terminal_snapshots.ambr
  • tests/unit/mcp/test_server_surfaces.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/mcp/agent-manual-install-kit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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: ebcad1575e

ℹ️ 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 polylogue/mcp/server_resources.py Resolved
Comment on lines +1000 to +1003
if not self.state_path.exists():
with contextlib.suppress(OSError):
self.lock_path.unlink()
fcntl.flock(stream.fileno(), fcntl.LOCK_UN)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the lock file linked until after unlocking

When no state file exists, such as after uninstall or a failed first install, the lock path is unlinked while its inode is still locked. If one process is already waiting on that old inode and another starts after the unlink, the latter creates and locks a new inode; once the current holder unlocks, both waiting processes can enter the installer concurrently and race while rewriting native configuration and ownership state. Do not remove the lock file while contenders may still hold or wait on its inode.

Useful? React with 👍 / 👎.

Sinity and others added 2 commits July 18, 2026 04:34
…nt kit

Add polylogue.agent_integration: typed spec, packaged generated manual/
deep-reference/manifest/recipes assets, native installer for Claude Code,
Codex, Gemini, and Hermes, a role-scoped runtime manifest, a `polylogue
agent` CLI (manual/manifest/install/status/doctor/uninstall/session-start),
and a Home Manager module.

Problem: the consumer-owned skill/SessionStart text agents currently see is
stale, reports the wrong tool surface, and has no generated, verified,
drift-checked path from the actual MCP declarations to what an agent is
taught. Ref polylogue-3gd.2, polylogue-3gd.3.

Solution: the manual/reference are generated from the existing 104-tool
declaration registry (t46.8.1) and stage the target six-tool contract
(query/read/get/explain/context/status + write/judge/run/operate) without
falsely claiming the cutover has landed — installation and instruction
injection fail closed until exact role-scoped tool names and a
`live-verified` schema marker both exist. Retains the beads-06 native
installer architecture (managed MCP entries, idempotent upgrade, drift
detection, lossless uninstall) rather than forking it.

External provenance: recovered GPT Pro result package
mcp-01-agent-manual-r01.zip (SHA-256 verified against snapshot commit
536a53e); patch applied cleanly except the
two generated topology files, which were regenerated locally rather than
patched. Fixed post-apply: missing `-f`/`--format` short-flag aliases on
all 6 new `agent` subcommands, a redundant cast flagged by mypy, and 5
undocumented CLI surfaces caught by `devtools verify docs-coverage` (added
a CLI-commands section to the generated standing manual).

- `devtools test tests/unit/agent_integration/ tests/unit/mcp/test_server_surfaces.py tests/unit/cli/` — 2731 passed, 1 skipped; the 11 remaining failures are pre-existing on unpatched master (confirmed by rerunning them there: `read_timeout` TypeError in test_diagnostics.py/test_json_output.py, schema-version snapshot drift in test_plain_cli_snapshots.py, and a `source_debt is locked` sqlite contention in test_insights.py), unrelated to this change.
- `devtools verify --quick` — 16/16 steps passed (format, lint, mypy, render-all, topology, layering, closure-matrix, docs-coverage, manifests, ci-workflows, doc-commands, test-infra-currency, test-clock-hygiene, pytest-timeout-overrides, degrade-loudly).

This is the installer/manual foundation, not the six-tool cutover itself:
no compatibility tool is removed, FastMCP signatures are not yet
`live-verified`, and instruction injection stays staged until t46.8.2/
t46.8.3 land the real read/context/judgment migration.

Co-Authored-By: Claude <[email protected]>
Master moved 11 commits ahead (including the CI sqlite fix, mcp declaration
retirements, and query-transaction epoch work) since this branch was opened.
Rebased, regenerated docs/plans/topology-target.yaml and topology-status.md,
and updated the CLI help/terminal snapshots that changed shape from the
new `agent` command combined with master's own tool-surface changes.

Verification: devtools test tests/unit/agent_integration/ tests/unit/mcp/
tests/unit/cli/ -- 3365 passed, 15 failed (all pre-existing on unpatched
master: test_diagnostics.py x8, test_tool_declarations.py x4, plus
test_insights_debt_json/test_json_status_snapshot/test_json_output.py, all
confirmed failing identically on master HEAD). devtools verify --quick --
16/16 green.

Co-Authored-By: Claude <[email protected]>
@Sinity
Sinity force-pushed the feature/mcp/agent-manual-install-kit branch from ebcad15 to 7c10c1d Compare July 18, 2026 02:43
@Sinity
Sinity merged commit ef83732 into master Jul 18, 2026
2 of 3 checks passed
@Sinity
Sinity deleted the feature/mcp/agent-manual-install-kit branch July 18, 2026 02:43
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 56.F091 / P1: Fix and current-source recheck assigned to polylogue-43ltz; not claimed fixed. Asset currency is still computed solely from top-level state at polylogue/agent_integration/installer.py:1480. Per-client digests are only returned at polylogue/agent_integration/installer.py:1520; the client loop checks native drift/interruption, not whether that client's recorded assets equal the current package.

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 69.F035 / P2: fixed-already at the checked revision: polylogue/mcp/server_resources.py:52 exposes a role-free manifest URI and line 57 calls build_live_manifest with hooks.capabilities. The client can no longer substitute an admin role into the resource path to obtain a manifest claiming unregistered runtime tools.

Only the rows listed above are dispositioned. Held findings remain open.

Sinity added a commit that referenced this pull request Oct 2, 2026
## Summary

Check current package assets independently for every installed agent
client. A selective reinstall leaves unreconciled clients visibly stale
in status, doctor and plain/JSON CLI output.

## Problem

The installer already stores each client's content version and package
digest, but status compared only the top-level record. After installing
assets A, upgrading to B and reinstalling one client, that aggregate
record became current while the remaining clients still retained A. This
implements bounded 56.F091 through `polylogue-45jrw`, preserving [the
original
finding](#3061 (comment))
and discovered-from custody in open `polylogue-43ltz`.

## Solution

Compare every installed client's recorded digest and content version
with the current package once per status observation. Aggregate
readiness derives from those client comparisons. Preserve `native_ok` as
independent native operation integrity, expose client `asset_current`,
name stale clients in diagnostics and render their rows as attention.
Doctor consumes the same status verdict. Top-level recorded metadata
remains observable and supplies no installation currency authority.

Empty/uninstalled status preserves its informational behavior; doctor
still reports no installed clients. Selective removal derives currency
from only remaining installations. The existing reference renderer and
both packaged/docs mirrors describe current behavior. No schema,
registry or native mutation path is introduced.

## Verification

Exact final clean head: `5c2b0feae86ba6bc8744451b3e64141332ff0909`, tree
`39958b36c6d19b05330877be9822656d26d0aafc`.

```sh
agentctl job start polylogue pytest_focused --workspace <checkout> -- tests/unit/agent_integration/test_installer.py tests/unit/agent_integration/test_assets_and_cli.py tests/unit/agent_integration/test_manual_contract.py tests/unit/devtools/test_agent_integration_module.py -p no:randomly
agentctl job start polylogue verify_quick --workspace <checkout>
```

Complete owning selection job 6270: `64 passed`, exit 0, receipt
`20261002T054400Z-focused-test-2990298-11235a85`. Quick job 6271: all 12
gates passed, exit 0, receipt `20261002T054405Z-quick-2990300-52364ab3`.
Both receipts start and end clean on the exact final head; no rerun or
earlier-head reuse. Earlier quick 6268 failed solely on two test
constant export references; the canonical version correction was
verified in the complete final selection.

Eight upgrade variants reinstall each of the four clients independently
after either actual packaged resource byte changes or a declared
content-version change. Production status/doctor and both command
formats identify the three remaining stale clients, preserve their
original native records and keep the updated client current. Additional
controls cover stale aggregate/current clients, empty state and
selective uninstall. Existing native drift, interrupted
install/uninstall, idempotency, rollback, asset parity and command
contracts are included.

## Self-review

Hosted Code Review is disabled by the operator. The author reread the
whole seven-path diff and both required checklists; the final pass was
clean after the test version correction. Root reviewed the main and
correction deltas with no finding.

Author final whole-diff pass on 5c2b0fe
against c09a858. Reread target AGENTS,
nested devtools rules, docs/review/codex-review-guide.md and generic
worker checklist. Two passes, final pass clean after the
canonical-version test correction. Root reviewed the full seven-path
main delta without a finding.

Project checklist:

1. ✓ Siblings and owners. Existing install writes per-client package
provenance; status owns its comparison, doctor consumes the same verdict
and CLI emits the same client currency. Census of
AgentIntegrationManager, asset_current and native_ok includes the actual
devtools native verification owner and both CLI commands. No second
classifier is introduced.
2. ✓ The fix itself. Both digest and content version participate in the
per-client comparison. A selective reinstall updates only selected
records; aggregate readiness combines every recorded installed client.
The top-level recorded fields remain observations, with controls proving
they cannot override client evidence.
3. ✓ Memory and limits. The comparison adds two scalar equalities per
existing client and no new collection, cache, cap or timeout. Existing
client payload retention is unchanged; no corpus data is acquired.
4. ✓ Cost per unit. Current package digest is computed once before the
existing client loop, not once per client. No native operation or
package asset is re-read by the new predicate.
5. ✓ Interruption. Existing prepared install/removal journal and
transaction owners are untouched. Interrupted client native_ok remains
false independently of currency; existing killed-install/uninstall
controls are in the complete installer module.
6. ✓ Ordering and races. Status compares one loaded signed state to one
current package digest. It performs no reconciliation write. Native
install locking, journaling and rollback remain intact. The stale-top
control compares state bytes before/after observation.
7. ✓ Failure classification. Existing state-integrity refusal and native
missing/drifted/invalid observations are preserved. Stale package
evidence explicitly blocks readiness with a named client diagnostic; no
exception suppression or weaker fallback added.
8. ✓ Silent outcomes. Every stale client gets asset_current false, a
diagnostic and CLI attention. Overall status/doctor and both command
exits report failure when any installed client remains stale. The
freshly reinstalled client remains current/native_ok true.
9. ✓ Cleanup on failure. No production resource acquisition added.
Synthetic installations use the existing temporary test home; no live
client configuration is touched. Existing rollback/uninstall controls
cover cleanup consumers.
10. ✓ Identity and keys. The existing aggregate asset hash and declared
content version are reused exactly, without an inferred model, new hash
or registry. Per-client native operation identity and state integrity
remain unchanged.
11. ✓ Lossless transforms. Selective install controls compare all
untouched client records byte-for-value with their original records.
Package metadata updates do not rewrite stale native files through
observation. Renderer and both packaged/docs mirrors changed together.
12. ✓ Degenerate inputs. Empty/uninstalled status preserves existing
informational readiness and doctor refusal. Selective removal of current
versus stale clients proves aggregation follows only remaining
installations. Both stale digest and stale version are exercised in both
aggregate directions.
13. ✓ Consumers. The only human renderer now includes asset_current
false in attention. JSON carries the authoritative client field, doctor
consumes status, generated docs come from the existing renderer.
Existing aggregate-only predicate is removed, with no alias or
compatibility path.
14. ✓ Tests and stubs. Four real synthetic native client installs run
against copied packaged resources. Actual resource bytes change for
digest upgrades; version controls patch the actual installer version
owner. All four clients are independently reinstalled. Restoring
aggregate-only currency hides three stale clients; dropping either field
fails its variant; omitting CLI attention fails the rendered row
contract.
15. ✓ Trust boundaries. Public files contain only code, generated
current behavior docs and neutral fixture builders. Package snapshots,
signed synthetic state and receipts remain in temporary locations. No
operator assets, secrets, captures or live installations enter the diff.

Generic worker checklist:

1. ✓ Criteria. The currency and consumer laws are exercised through
actual install/status/doctor and plain/JSON CLI. Delivery remains
pending exact-head quick/hosted checks and protected merge; no full
parent acceptance is claimed.
2. ✓ Defect classes. rg census covered all package digest/version
writers, status/doctor, native_ok/asset_current readers, CLI renderer
and generated reference owner. Selective install and both selective
uninstall cases share the same status law.
3. ✓ Replacement. Aggregate metadata readiness authority is retired in
the same change, preserving observations. All genuine consumers use
per-client currency; no second registry, fallback or schema introduced.
4. ✓ Failure visibility. Stale client evidence blocks overall readiness
and command exit, while native integrity remains separately observable.
Existing integrity and interrupted-operation refusals remain.
5. ✓ Discriminating controls. Aggregate-only check fails
current-top/stale-client cases; top-level authority fails
stale-top/current-client cases. Version-only or digest-only comparisons
fail one upgrade variant. A renderer ignoring currency falsely labels
stale clients ok. Empty/selective-removal controls expose incorrect
aggregate membership.
6. ✓ Public evidence. Original 56.F091/PR3061 custody is retained in
child polylogue-45jrw. Full diff uses synthetic homes/package revisions;
historical threads and live client installs remain untouched.


## Residuals

Normal push job 6276 passed all 12 pre-push quick gates on the exact
head, receipt `20261002T054634Z-quick-2995425-7c53177d`. Protected
delivery awaits required hosted checks, fresh exact-head thread readback
and merge. This is the bounded F091 implementation; parent
`polylogue-43ltz` and its other residuals remain open. Historical review
threads retain their original custody. All installations are neutral
test homes. No live client install, host activation, corpus/whale run,
provider/default change or private archive action occurred.
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