Repository navigation
feat(harness): establish native Prime daemon foundation #3
Description
Outcome
Establish the safe native-daemon foundation for Comet's Prime Agent harness. The Comet host must be able to locate an installed prime-agent package, load only its public ESM API through a Comet-owned Node shim, start a scoped private daemon, validate the daemon hello and supported capabilities, and shut it down within bounded deadlines.
Parent umbrella: #1
Prime fork tracker: pylon-code/prime-agent#1
Pylon provider umbrella: pylon-code/pylon#114
Ownership
- Repository:
rynfar/comet - Branch:
feat/prime-daemon-foundation - Worktree:
~/repos/comet-prime-daemon-foundation - Initial file area:
crates/harness/src/prime/**,crates/harness/src/lib.rs, focusedcrates/harness/tests/**, and only required manifest/lock changes - Owner:
rynfar
No Prime or Pylon checkout is owned by this issue. Their active worktrees must remain untouched.
Public contract
- Resolve the configured Prime executable to its containing
prime-agentpackage. - Import only the package's public
exports["."]entry. - Validate matching package/public
VERSION,DAEMON_PROTOCOL_NAME == "prime-agent.daemon", and daemon protocol >= 7. - Start
prime-agent --mode daemon --daemon-socket <private> --offline --session-dir <private>. - Validate that hello reports the requested socket and the baseline capabilities needed by later Comet session work.
- Strip inherited
PRIME_AGENT_INTERNAL_*andRLM_DEPTH; preserve public configuration such asRLM_MAX_DEPTH. - Keep sockets, package paths, session roots, raw hello payloads, and diagnostics host-private.
Optional capabilities, including correlated_prompt_lifecycle_v1, are recorded from negotiation. Method presence, schema number, package version 0.8.1, and branch names are not support signals.
Compatibility
Stock Prime Agent 0.8.1 must pass the baseline foundation even though it lacks the Pylon correlated-lifecycle capability. This issue sends no prompts and creates no Comet sessions, so it can merge before the active Prime recovery work.
Later session/recovery slices depend on:
- fix(coding-agent): keep snapshot catch-up failures isolated pylon-code/prime-agent#11
- Prime upstream sync candidate ready pylon-code/prime-agent#8
A fork-only capability must degrade to an explicit unsupported state. It must never prevent safe baseline probing or daemon shutdown.
Privacy and sync boundary
This slice exposes no new RPC, synchronized document field, or UI. The Rust/Node boundary may emit only a bounded, normalized handshake result and typed local errors. It must not emit credentials, environment values, native session paths, prompts, or raw daemon messages.
Tests
Use deterministic local fixtures. Do not require a real model, credentials, network access, or the active Prime worktree.
Cover:
- valid installed-package resolution through a CLI symlink;
- wrong/missing package and unsafe public export rejection;
- version/protocol/hello mismatch rejection;
- baseline and optional capability parsing;
- private socket/session-directory construction and permissions on Unix;
- sanitized daemon environment;
- startup timeout, early exit, stderr redaction, graceful shutdown, and forced cleanup;
- unknown future capabilities degrading safely.
All subprocess probes and tests must have explicit deadlines.
Non-goals
HarnessId::PrimeAgentregistration or UI- session create/attach/resume
- prompts, streaming, steering, interruption, or subagents
- model/resource discovery
- ACP fallback
- Windows native-daemon support
- changes to Prime or Pylon contracts
Merge order
- Merge this Comet-only foundation after its fake-protocol tests pass.
- Finish/audit the linked Prime fork recovery and upstream-sync work.
- Open a separate, jointly reviewed Comet session-lifecycle issue before consuming correlated prompt lifecycle or snapshot recovery.
Acceptance
- A focused test proves Comet can safely negotiate and stop a fake stock-compatible daemon.
- The module exposes a narrow reusable foundation for the later native
PrimeHarness. - The issue contains test receipts and the exact final file list.
- No host-private Prime state crosses the Comet sync boundary.
Activity
rynfar commentedon Aug 29, 2026
Claimed for implementation.
~/repos/comet-prime-daemon-foundationfeat/prime-daemon-foundationorigin/main@b5209928cf1eb69d97634b5f6f34a512a9c21c6ecrates/harness/src/prime/**, thecrates/harness/src/lib.rsmodule/export seam, focused harness fixtures/tests, and only required manifest/lock changesNo other Comet, Pylon, or Prime Agent worktree will be modified. Implementation will begin with deterministic fake package/daemon fixtures and bounded process ownership.
rynfar commentedon Aug 30, 2026
Foundation implementation is complete and pushed in PR #4.
Commits
ed843b3—feat(harness): add native Prime daemon foundation9e26a90—test(harness): harden Prime daemon lifecycleExact final file list
Cargo.lockcrates/harness/Cargo.tomlcrates/harness/src/lib.rscrates/harness/src/prime/contract.rscrates/harness/src/prime/error.rscrates/harness/src/prime/mod.rscrates/harness/src/prime/package.rscrates/harness/src/prime/paths.rscrates/harness/src/prime/process.rscrates/harness/src/prime/shim.mjscrates/harness/tests/prime_daemon.rscrates/harness/tests/support/mod.rscrates/harness/tests/support/prime_fixture.rsTest receipts
1300cc08c354b807d1ad5288ca23ec859f40361b1cd8a0f71d09d867523dfcbbdist/index.jsSHA-256:0555400963ce5c9fa3059c3ed571748715d3ddda3830085eb8f12da00708d49bc5dffcd16a401551986023134fbc05457775e1eeed618a5a6ae0d0cee1772d5frustfmt --check, Node syntax, andgit diff --check: passed.origin/main@b520992independently reproduces the excludedshell_env::unix::tests::falls_back_when_interactive_attempt_hangspanic atshell_env.rs:330. Existing ACP unused-assignment warnings are unrelated and unchanged.Compatibility and privacy
>= 7.PRIME_AGENT_INTERNAL_*,RLM_DEPTH, and Node/dynamic-loader injection.Review and next boundary
Independent architecture and adversarial security rereviews both report no remaining merge blockers for issue #3.
This PR starts no Prime sessions. The next issue must define the asynchronous SDK session host, attach-side capability negotiation, event/response demultiplexing, authoritative detached-worker reconciliation, and recovery. Long-lived session work is blocked on bounded SDK JSONL ingress in pylon-code/prime-agent#13 and remains coordinated with pylon-code/prime-agent#8, pylon-code/prime-agent#11, and pylon-code/pylon#114.