Skip to content

feat(p5): NL → /agents bg intent-gate workflow#141

Merged
lantiscooperdev merged 1 commit into
mainfrom
feat/p5-nl-bg-intent
Jul 4, 2026
Merged

feat(p5): NL → /agents bg intent-gate workflow#141
lantiscooperdev merged 1 commit into
mainfrom
feat/p5-nl-bg-intent

Conversation

@lantisprime

Copy link
Copy Markdown
Owner

Summary

Adds a background workflow kind to the intent-gate so users can launch background agents via natural language (e.g., "scout this repo in background" triggers /agents bg scout <task>).

Changes

  • intent-gate.ts: background workflow kind + bg-launch GateDecision variants. classifyGateIntent returns bg-launch with agent + task + profile, defaulting agent to "scout".
  • bg-args.ts: --profile <name> parsing mirroring the --backend first-token pattern.
  • bg-preflight.ts: profileOverride accepted; project trust stashed into manifest so the worker can reconstruct the library.
  • bg-state.ts: BgRunManifest.options.profile field added.
  • bg-worker.ts: profile library reconstruction (user ~/.pi/agent/profiles + trusted-project .pi/profiles + built-ins) — same sources as session_start. projectTrusted + projectRegistry threaded to runChildAgent so project-source profiles pass the trust gate end-to-end.
  • index.ts: gate handler bg-launch branch + __bgLaunchTestHook test seam (mirrors __gateDispatch). TUI confirm shows "Launch in background ${agent}?"; disableContextFiles, session profileLibrary/deliverResult re-attach, profile resolution all preserved.
  • Tests: 3 new intent-gate tests (config, classification, confirm flow), --profile parser tests, worker library-reconstruction + project profile trust-wiring tests.
  • Example: agents/examples/intent-workflows-with-background.json sample config.

Security

  • TUI confirm before bg launch (REQ-SEC-3)
  • disableContextFiles set for bg path (REQ-SEC-5)
  • Session profileLibrary + deliverResult re-attached (REQ-7)
  • Profile passed structurally, not via string interpolation

Test results

  • 33/33 intent-gate tests
  • 9/9 bg-args tests
  • 21+ worker tests
  • All cross-extension scripts pass

Review

Reviewed by codex (gpt-5.5 high) via cmux — 4 review rounds: changes-requested (profile dropped → row library reconruction → project-profile trust gate) → approve-with-nits → approve. No blockers, no non-blocking concerns remaining.

Add a `background` workflow kind to the intent-gate so users can launch
background agents via natural language (e.g., "scout this repo in
background" triggers /agents bg scout <task>).

Files:
- intent-gate.ts: background workflow kind + bg-launch GateDecision
- bg-args.ts: --profile parsing (mirrors --backend first-token pattern)
- bg-preflight.ts: profileOverride accepted + project trust stashed
- bg-state.ts: BgRunManifest.options.profile field
- bg-worker.ts: library reconstruction (user + trusted-project +
  built-ins) + projectTrusted/projectRegistry threaded to runChildAgent
- index.ts: gate handler bg-launch branch + __bgLaunchTestHook seam
- test-intent-gate.mjs: 3 new tests (config, classification, confirm)
- test-bg-args.mjs: --profile parser tests
- test-bg-worker.mjs: production-path library reconstruction + project
  profile trust wiring tests
- examples/intent-workflows-with-background.json: sample config

Security: TUI confirm before bg launch (REQ-SEC-3), disableContextFiles
(REQ-SEC-5), session profileLibrary + deliverResult re-attach (REQ-7),
profile passed structurally not via string interpolation.

Reviewed by codex (gpt-5.5 high) via cmux — approve after 4 rounds
@lantiscooperdev
lantiscooperdev merged commit 6d61802 into main Jul 4, 2026
1 check passed
lantiscooperdev pushed a commit that referenced this pull request Jul 4, 2026
… (#142)

Post-merge sync for P5 NL → /agents bg intent-gate workflow (PR #141,
commit 6d61802). Also catches up P5b-2 zellij-terminal (PR #139) which
had skipped its workplan-sync docs commit.

- WORKPLAN.md: chain head now 20260704-122521-...-d94b (was stale at
  the P5E1 head 20260704-083722-...-64a1)
- P3_IMPLEMENTATION_SLICES.md: add P5b-2 zellij-terminal section
  (catch-up) + P5 NL→bg intent-gate section with the 4-round codex
  review trail and the multi-layer profile pathway lesson

Co-authored-by: Charlton D. Ho <dev@znp.pw>
@lantisprime
lantisprime deleted the feat/p5-nl-bg-intent branch July 5, 2026 13:11
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.

2 participants