Repository navigation
docs(governance): add cross-harness orchestration governance proposal - #144
KooshaPari wants to merge 3 commits into
Conversation
…per (#136) PR #128 ("refactor(setup-hints): remove unreachable startup spawn notice") removed the only call site of `StartupHints::with_spawn_notice`, leaving the helper as a dead-code associated function. The session doc `docs/sessions/2026-10-18-resume-reland/00_SESSION_OVERVIEW.md` (~line 113) records this leftover as an explicit follow-up. The CI "Quality Guardrails" check now fails with: error: associated function `with_spawn_notice` is never used --> crates/jcode-setup-hints/src/lib.rs:201:8 Delete the `with_spawn_notice` associated function entirely. No `#[allow(dead_code)]` — the call path is gone, the function should go too. Aggressive-change policy: remove, do not silence. Preserved: - `StartupHints::with_status_and_display` (used in 7+ call sites) - `SetupHintsState::startup_spawn_hint_dismissed` (state-file serde compat) - `fn startup_hints_for_launch(_state: &SetupHintsState) -> Option<StartupHints>` (callers at lib.rs:1353 + setup_hints_tests.rs depend on the signature) - `StartupHints::status_notice` field — read by `src/cli/tui_launch.rs:244` and `crates/jcode-setup-hints/src/setup_hints_tests.rs:272`, NOT dead. Validation: - cargo clippy -p jcode-setup-hints --all-targets --all-features -- -D warnings: exit 0 - cargo fmt -p jcode-setup-hints -- --check: exit 0 - cargo test -p jcode-setup-hints --lib: same pre-existing platform-specific failures as master; no new failures introduced. The one setup_hints_test failure (`first_three_launches_can_include_hotkey_notice_too`) was already broken by PR #128 and is out of scope here. Closes #136 tx-agent: jcode tx-validated: test tx-task: #136 tx-scope: jcode-setup-hints tx-intent: remove orphaned with_spawn_notice to clear CI Quality Guardrails dead-code error
…ce_too to assert retired spawn-notice behavior (#138) PR #128 ("refactor(setup-hints): remove unreachable startup spawn notice", commit 081c1cf) retired the macOS launch-hotkey spawn notice. The function `startup_hints_for_launch` now always returns `None`, with a comment explaining the prior gate (`if !hotkey_configured || dismissed`) was unreachable because the crate never wrote `startup_spawn_hint_dismissed = false` (the field defaults to `true` in `SetupHintsState::default()`). The test `first_three_launches_can_include_hotkey_notice_too` was always broken — even before PR #128, its `hotkey_configured: true` state with `..SetupHintsState::default()` produced `dismissed = true`, which would short-circuit the gate to `None`. PR #128 itself acknowledged this in its commit message ("the macOS test was already failing on master for an unrelated reason — the test relies on a spawn notice that was dead code by the time it was written"). Fix the test to assert the post-#128 behavior: `startup_hints_for_launch` returns `None` regardless of `hotkey_configured` or `startup_spawn_hint_dismissed`. Kept the `#[cfg(target_os = "macos")]` gate so the test remains macOS-only, symmetric with other launch-hotkey notice tests in this file. Updated the docstring to record the PR #128 provenance so the test's intent is obvious to future maintainers. Also cherry-picks PR #137 (dead-code removal of `StartupHints::with_spawn_notice`) onto this branch so the branch satisfies `cargo clippy ... -D warnings` — that helper was the only `dead_code` warning in the crate, and PR #128's test retirement leaves the crate with the warning active. Both commits are required for clippy to pass. Diff scope: - crates/jcode-setup-hints/src/setup_hints_tests.rs: test body + docstring (+17/-11) - crates/jcode-setup-hints/src/lib.rs (cherry-picked from PR #137): -8 lines Validation: - cargo clippy -p jcode-setup-hints --all-targets --all-features -- -D warnings: exit 0 - cargo fmt -p jcode-setup-hints -- --check: exit 0 - cargo test -p jcode-setup-hints --lib setup_hints_tests::first_three_launches_can_include_hotkey_notice_too: ok - cargo test -p jcode-setup-hints --lib: 144 passed, 5 failed; same 5 pre-existing platform-specific failures as on origin/master (linux_env x2, linux_niri x2, macos_launcher x1) — none caused by this change. Closes #138 tx-agent: jcode tx-validated: test tx-task: #136 tx-scope: jcode-setup-hints tx-intent: update PR #128 broken test to assert retired spawn-notice behavior
Proposes 4 enforcement mechanisms for the "Always Subagent — main context is management-only" operator directive (2026-10-11 21:08); records the 2026-10-19 manual cross-harness propagation of the rule to all 4 derivative AGENTS.md copies (codex, forge, kcode, helioslite); lists operator-approved next steps (none yet; each mechanism awaiting decision). tx-agent: jcode tx-validated: manual tx-task: governance-2026-10-19 tx-scope: docs/sessions/2026-10-19-orchestration-governance tx-intent: capture the cross-harness propagation decision + enforcement backlog in the repo
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
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. Comment |
|
Superseded by #145 (docs-only PR opened against the current master tip, cherry-picked from commit 6567919 onto a fresh branch off master). This PR (#144) was opened off the unmerged #140 tip, which is why it currently shows three files in its diff (the two setup-hints source files from #140 plus the docs file). The docs commit has now been moved to its own docs-only branch (docs/orchestration-governance-docs-only) so the governance docs can be merged independently of the setup-hints work. Recommend the operator close this PR (#144) — do not merge it. The setup-hints changes remain on #140; the docs change is now on #145. |
CodeAnt Nitpicks2 code suggestions1.
|
CodeAnt PR Risk: Medium Risk
Assessed commit: |
| // All three launch hotkeys should be mentioned. | ||
| assert!(message.contains("Cmd+'")); | ||
| assert!(message.contains("Cmd+Shift+'")); | ||
| assert!( |
There was a problem hiding this comment.
WARNING: The assertion is vacuous — startup_hints_for_launch ignores its input entirely
startup_hints_for_launch (crates/jcode-setup-hints/src/lib.rs:602-615) takes _state, does let _ = _state; and unconditionally returns None. assert!(startup_hints_for_launch(&state).is_none()) therefore cannot fail for any state, so the new test gives zero coverage for the behaviour its docstring claims to guard.
This is broader than the CodeAnt nitpick on line 45: flipping startup_spawn_hint_dismissed to false would not make the test meaningful either, because the function never reads that field. The root cause is the hardcoded None stub.
Two options:
- Delete
startup_hints_for_launchand its call site (lib.rs:1345) plus this test. Withwith_spawn_noticeremoved in this same PR, nothing in the crate can produce a startup spawn hint at all, and the function is kept only so callers keep compiling (lib.rs:606-608). - Or retarget the test at the live notice path (
macos_launch_hotkeys_notice/launch_hotkey_notice_lines), which is still reachable and already covered at setup_hints_tests.rs:500+.
As written, the test can never fail and will silently stop guarding anything if the function is ever rewritten.
| // stays as a regression guard against the gate being re-introduced with the | ||
| // wrong default, and to keep the macOS-only cfg symmetric with the other | ||
| // launch-hotkey notice tests in this file. | ||
| #[cfg(target_os = "macos")] |
There was a problem hiding this comment.
WARNING: The macOS-only cfg gate is now vestigial, and the test name contradicts the assertion
- The new assertion is platform-independent — the old body was macOS-specific only because it asserted macOS chord text (
Cmd+;,Cmd+Shift+). Now the#[cfg(target_os = "macos")]gate compiles this regression guard out entirely on Linux CI, i.e. it provides no coverage in the default CI environment. Drop thecfgso the guard runs everywhere. - The name
first_three_launches_can_include_hotkey_notice_toonow states the opposite of what the test asserts (can include a hotkey noticevsmust always return None). Anyone grepping for the hotkey-notice tests will be misled — rename it to describe the retired behaviour, e.g.startup_spawn_notice_is_always_retired.
| | `~/.jcode/memories/global/cockpit-progress-tree-policy.md` | EDIT — add `Context Hygiene` as 5th mandatory dimension; cite Mechanism D | ~15 lines added | YES (cockpit policy is operator-owned) | | ||
| | `~/.jcode/config.toml` | EDIT — add `JCODE_NOISY_BUDGET` default to env section | ~3 lines | NO | | ||
|
|
||
| **Total additive diff: ~270 lines across 13 files. Three files require operator approval.** |
There was a problem hiding this comment.
WARNING: The change-set totals contradict the table directly above
Two counts are wrong:
- The table (lines 186-199) has 14 rows, not 13.
- The
Operator approvalcolumn marks 6 files asYES—~/.codex/hooks.json(191),~/.codex/AGENTS.md(193),~/.forge/AGENTS.md(194),~/.kcode/AGENTS.md(195),~/.helioslite/AGENTS.md(196) andcockpit-progress-tree-policy.md(198) — notThree files.
This matters: §4 (line 66) states a rule is binding only when enforcement is automatic + operator-free, and the PR body claims a blanket operator sign-off gate. Understating the approval-gated surface from 6 files to 3 is exactly the class of drift this proposal exists to prevent. Please reconcile the sentence with the table.
| **Reading the matrix:** | ||
|
|
||
| - "Mgmt-only CRITICAL" = literal section `## CRITICAL: Always Subagent — main context is management-only (operator 2026-10-11 21:08)` present. Only the Jcode canonical has it. | ||
| - The more recent **cockpit-tree rule** (operator 2026-10-17) IS in all 5 copies. So updates from 6 days ago propagated; updates from 8 days ago did not. The drift is not noise — it is older content that the propagation discipline skipped. |
There was a problem hiding this comment.
WARNING: 6 days ago contradicts the date given in the same sentence
The cockpit-tree rule is dated operator 2026-10-17 and the document is dated 2026-10-19, so that update is 2 days old, not 6. §3 (line 53) states it correctly: 2026-10-17T22:12Z ... Within 2 days, all 5 copies updated to include the rule.
The stale figure also weakens the point being made (recent edits propagate, older ones do not): the accurate contrast is 2 days vs 8 days.
| - The more recent **cockpit-tree rule** (operator 2026-10-17) IS in all 5 copies. So updates from 6 days ago propagated; updates from 8 days ago did not. The drift is not noise — it is older content that the propagation discipline skipped. | |
| - The more recent **cockpit-tree rule** (operator 2026-10-17) IS in all 5 copies. So updates from 2 days ago propagated; updates from 8 days ago did not. The drift is not noise — it is older content that the propagation discipline skipped. |
|
|
||
| ### Rule 1 — Single canonical AGENTS.md with derived forks | ||
|
|
||
| **Statement:** `~/AGENTS.md` is the canonical authority for harness-level directives. The four derivative copies (`~/.codex/AGENTS.md`, `~/.forge/AGENTS.md`, `~/.kcode/AGENTS.md`, `~/.helioslite/AGENTS.md`) are generated from the canonical by a `~/bin/agents-md-sync.sh` script. Forks are stubs that import sections by reference (e.g. `$(cat ~/.jcode/memories/global/harness-agents.md | sed -n '1112,1166p')` at sync time). |
There was a problem hiding this comment.
WARNING: The import-by-reference mechanism does not work as described, and the line ranges are brittle
$(cat ~/.jcode/memories/global/harness-agents.md | sed -n '1112,1166p') has two problems:
- Nothing executes it. A derived
AGENTS.mdis read by a harness as plain text; a literal$(...)line inside it is never run by a shell. If the substitution is meant to happen at sync time, say so explicitly; if the fork is meant to carry a live reference, it needs a form the agent can actually resolve. - Hardcoded line ranges rot.
1112,1166is a snapshot of one file at one moment. Any insertion above line 1112 silently shifts the extracted content, andagents-md-sync.sh --check(a SHA comparison of the emitted forks) would not detect it — the fork would simply contain the wrong section.
Recommend extracting by a stable heading/marker rather than by line number, and stating explicitly in the proposal whether substitution happens at sync time.
|
|
||
| ### A. Large-output / noisy-command pre-tool hook (extension of `~/bin/jcode-tool-safety`) | ||
|
|
||
| - **Mechanism:** new helper `~/bin/jcode-noisy-classifier.py` invoked from `jcode-tool-safety`'s `bash` case. Pattern-matches known noisy patterns: `git log\b.*-[0-9]{2,}` (limit ≥20), `rg|grep.*-r` over multi-path, `find\b`, `ls -la\b` over `~/` or `/`, `cat\b` of `*.log` / `*.txt` files >50KB, `tail -f`, `gh pr list --json.*-L.*[0-9]{3,}`, `cargo (test|build|check|clippy)`, `npm test`, `pytest\b`, `rustc\b`. On match: increment `JCODE_NOISY_BUDGET`; if budget exhausted, route to `elicitate` with reason "noisy command in orchestrator lane; delegate to subagent or `bg run_in_background`." |
There was a problem hiding this comment.
WARNING: The proposed patterns fire on routine commands, and they measure command shape — not output volume, which is the gap the proposal claims to close
The pattern set includes cargo (test|build|check|clippy), npm test, pytest, rustc and find. These are among the most frequently executed commands in this repository, and cargo build / cargo check / rustc normally emit only a handful of lines. With the proposed default JCODE_NOISY_BUDGET=2 (line 209), the second cargo build of a session would be routed to elicitate for operator approval — far more disruptive than the False-positive risk: LOW claimed on line 128.
More fundamentally, a regex over the command string cannot measure output volume at all — which is exactly the limitation this proposal attributes to the existing gate (Classifies COMMAND shape, not OUTPUT shape, line 42). Either narrow the patterns to genuinely unbounded producers (large rg / git log / cargo test runs) or make the classifier inspect the produced output, and drop the build/compile verbs.
| - **What it blocks:** the parent directly firing large-output commands. | ||
| - **False-positive risk:** LOW. Pattern match is conservative; a parent can always wrap a single command in `bg run_in_background` to bypass (and that is parent-safe — it does not pollute context). | ||
| - **Cost:** ONE small Python script (~80 lines) + a 20-line patch in `jcode-tool-safety` to call it. | ||
| - **Operator approval needed:** NO. The script is gated behind `JCODE_APPROVAL_MODE=allow` for the first 24h (rollout), then default-on. |
There was a problem hiding this comment.
WARNING: The 24h allow rollout is neither opt-in nor reversible, and no rollback path is defined
- It is time-based, not opt-in: the gate flips itself on after 24h with no operator action, which contradicts the proposal's own rollback property (PR body §9: every mechanism is opt-in, reversible, and emits a heartbeat signal).
- There is no documented disable switch.
JCODE_APPROVAL_MODE=allowis described as a temporary rollout gate; nothing states how an operator turns the noisy gate back off once it defaults on. Note §8 Q3 (line 209) definesJCODE_NOISY_BUDGET=0as never run a noisy command from the parent — i.e. a hard block, the opposite of an off switch. - This document has no rollback section at all. The PR body describes a
§9 Rollback & observabilitysection, but §9 here is the raw-findings appendix.
Please specify the exact env/config values that disable each mechanism, and confirm the heartbeat-signal requirement: §5 D only covers the cockpit cell, and Rule 2's noisy-operation tally is never specified as being persisted anywhere (Rule 2 only says the next session-start hook logs it).
| |---|---|---| | ||
| | https://code.claude.com/docs/en/hooks | Anthropic PreToolUse / PostToolUse / matcher / handler model; `permissionDecision: "deny"` returns; exit code 2 blocks; matcher syntax (`Bash(git *)` etc.) | Mechanism A is a Jcode analog of PreToolUse. The matcher + `if` field combo is the right shape for "noisy command filter." | | ||
| | https://code.claude.com/docs/en/hooks#hooks-in-subagents | "Settings-file hooks run inside subagents" — verified by Boris Cherny in v2.1.233+ (issue anthropics/claude-code#69260). Subagent transcripts do not show hook activity; observability, not a coverage gap. | Confirms Mechanism A works for subagents too — the orchestrator who dispatches `swarm spawn` STILL benefits from noisy-classification at the subagent level. Quoting issue #69260 as historical note: "if 72% of sessions are subagents, hook-based safety that only runs on main is a partial safety net." | | ||
| | https://github.com/anthropics/claude-code/issues/69260 | Real-world subagent hook coverage report, status: closed (not a bug, a transcript-observability gap). | Citable precedent that "main-only pre-tool enforcement is insufficient." Bolsters Rule 2. | |
There was a problem hiding this comment.
SUGGESTION: External citations and attributions are presented as verified, but §F Not verified omits them
§6 attributes specific claims to named people and versions — verified by Boris Cherny in v2.1.233+, a quoted sentence from issue #69260, and the 72% of sessions are subagents figure — and §3 (line 59) repeats the issue number as external citable evidence. None of this can be checked from this repository, yet §F (lines 268-274) enumerates five unverified items without listing any of the eight external URLs or the quoted/attributed text.
For a document whose purpose is to be an auditable governance record, close that gap: either add these to §F, or add a verified on <date> by <method> note per row so a later reader can tell reproducible claims from recollection.
| ### A. Harness copies — `wc -l` and SHA256 (2026-10-19) | ||
|
|
||
| ``` | ||
| 4247 /Users/kooshapari/AGENTS.md |
There was a problem hiding this comment.
SUGGESTION: The appendix bakes this machine's absolute home paths into the repo, and none of the evidence is reproducible for another reader
Appendix A records /Users/kooshapari/AGENTS.md, /Users/kooshapari/.codex/AGENTS.md and the rest verbatim, and §2/§3/§F are all built on ~/bin/jcode-tool-safety, ~/bin/jcode-shell-classifier.py, ~/.codex/config.toml and ~/.jcode/memories/global/harness-agents.md — none of which exist in this repository. A reviewer, or the operator on a second machine, cannot re-run a single check: there is no command, no expected output and no checksum manifest to compare against.
Consider replacing the raw dump with a committed, runnable verification script (e.g. docs/sessions/2026-10-19-orchestration-governance/verify_drift.sh) that regenerates the §2 matrix from whatever AGENTS.md copies are present, so the table can be refreshed instead of re-typed. That also serves the proposal's own goal — the drift it describes is precisely the result of hand-maintained copies going stale.
Code Review SummaryStatus: 11 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
SUGGESTION
Must Fix
Should Fix
Consider
Recommendation: Request ChangesThe code changes are clean in isolation — the Fix these issues in Kilo Cloud Files Reviewed (3 files)
Review Gaps
Reviewed by free · Input: 77.6K · Output: 27.2K · Cached: 686.6K |
Superseded by #145 — do not mergeThis branch was based on the unmerged tip of #140, so it unintentionally carries #140's setup-hints changes alongside the governance docs. That makes it a mixed-content PR. Clean replacement: #145 (
Action requested from the operator: close this PR (#144) without merging. No content from it is lost — everything it should contain is in #145. |
|
Closing under the host-ops closure audit (2026-11-11): 23 days old with failing checks; not landable as-is. The branch |
User description
Summary
Closes #143
Adds
docs/sessions/2026-10-19-orchestration-governance/04_ORCHESTRATION_GOVERNANCE_PROPOSAL.md(+276 lines) — a proposal (NOT yet approved) to enforce the management-only root-lane directive (operator 2026-10-11 21:08) across all 5 active AI coding-agent harnesses (jcode, kcode, codex, forge, helioslite).Context: the drift that triggered this proposal
The operator's standing directive ("use subagents ALWAYS, main ctx strictly must only be management/high level ctx. update memories and agnets.md") was committed only to the canonical
~/AGENTS.md. It was never propagated to the four derivative copies (~/.codex/AGENTS.md,~/.forge/AGENTS.md,~/.kcode/AGENTS.md,~/.helioslite/AGENTS.md).The one-time manual propagation was completed 2026-10-19 and recorded in
~/.jcode/memories/global/harness-agents.md. This proposal captures the more thorough enforcement plan so future agents / panes / the operator can act on it.Nine sections of the proposal
swarm spawn/thegent/dispatchcall.~/AGENTS.mdagainst the 4 derivative copies.PASS / FAIL / NOT_RUNcell in every heartbeat / cockpit panel.Branch hygiene
This commit was previously the LOCAL tip of
fix/setup-hints-pr128-test-regression(PR #140's branch) but was never pushed. To avoid polluting PR #140, this PR opens a separate branchdocs/orchestration-governance-proposalat the docs commit only. PR #140's branch pointer was moved back to its remote tip (4b410811f) so PR #140 stays clean (2 files, setup-hints only).Status
~/bin/script or hook change has been made.Verification
git rev-parse fix/setup-hints-pr128-test-regression→4b410811f(PR fix(setup-hints): update first_three_launches_can_include_hotkey_notice_too to assert retired spawn-notice behavior (#139) #140 remote tip, unchanged)git rev-parse docs/orchestration-governance-proposal→65679193c(this PR)git status --shorton master: cleanCodeAnt-AI Description
Propose consistent governance across AI-agent harnesses
What Changed
Impact
✅ Governance gaps identified across five harnesses✅ Proposed drift checks and delegation rules documented✅ Startup launch behavior remains unchanged💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.