Skip to content

feat(channel-discipline): M6 dual-channel gate for #worker-dispatch-via-subagent (Stage B) - #765

Merged
artyhoo merged 4 commits into
stagingfrom
feature/meta-orch-channel-discipline-stage-b-6d7236
Jun 27, 2026
Merged

feat(channel-discipline): M6 dual-channel gate for #worker-dispatch-via-subagent (Stage B)#765
artyhoo merged 4 commits into
stagingfrom
feature/meta-orch-channel-discipline-stage-b-6d7236

Conversation

@artyhoo

@artyhoo artyhoo commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Stage B (I-phase) — M6 dual-channel gate for #worker-dispatch-via-subagent

Promotes #worker-dispatch-via-subagent (.claude/skills/pipeline/SKILL.md:335) from Class C (prose-only) → Class A (executable), implementing the M6 hybrid the merged Stage A research-patch (PR #762) recommended. Maintainer decisions settled 2026-06-27: M6 + promote-on-N=1. Autonomous aif-handoff build (task 6d7236db, $25.82), harvested host-side (container egress proxy-blocked).

What ships (single source of truth, dual-implementation-discipline.md §7):

  • packages/core/principles/29-worker-dispatch-channel.ts — the ONE matcher (clauses a–d) + exported fixtures
  • packages/core/principles/29-worker-dispatch-channel.bin.ts — CLI shim (exit 1)
  • .claude/hooks/check-worker-dispatch-channel.sh — edit-time PostToolUse gate; delegates to the bin via tsx (clone of check-doc-authority.sh delegation — NOT a 2nd regex)
  • packages/core/principles/29-worker-dispatch-channel.test.ts — CI backstop + paired-negative (fixture FIRES; clean / read-only / escaped SILENT; anti-tautology + each-clause-load-bearing) — 8/8 green
  • SKILL.md §5 — Class A note (honest ceiling: kickoff-text gate, not the runtime "who invokes" surface) + escape-token doc
  • SSOT feat(n8-c3): principle 13 requires §1.7 substance (bare §1.7 no longer passes) #178 — verdict HYBRID (REFERENCE the discipline + BUILD the gate slice)

Honest handling surfaced by the build (not glossed):

  • Parked fork (commit body): the Stage A clause-(a) sketch included isolation: worktree standalone → 8 false positives (worktree isolation is the exec env of legit Mode A/B sessions, not an Agent-tool signal). Chose to key on the Agent-tool dispatch channel itself (the §2 deliverable's own wording); documented the alternative + rationale.
  • 2 genuine latent instances found by the FP sweep in CLOSED historical umbrellas (pre-/co-dating the rule) — escaped with honest pointing reasons, not silently masked.

Maintainer action required (agent-uncommittable): wire the hook into ~/.claude/settings.json PostToolUse — snippet in the hook header. Until wired, the CI principle test (M2) is the active backstop.

§1.7 Forward-check applied

Checked this PR against the existing disciplines it interacts with before shipping:

  • dual-implementation-discipline.md §7 — single source of truth honored: one matcher module, two callers (hook delegates to the bin, not a divergent regex). Evidence: packages/core/principles/29-worker-dispatch-channel.ts:48 (matcher) + .claude/hooks/check-worker-dispatch-channel.sh (tsx delegation).
  • dual-implementation-discipline.md §6@cc-only-rationale on the edit-time hook; CI test is the portable backstop. Evidence: .claude/hooks/check-worker-dispatch-channel.sh:1.
  • no-paid-llm-in-ci.md §1 — matcher is deterministic TS/bash, runs offline, zero API-billed calls. Evidence: packages/core/principles/29-worker-dispatch-channel.test.ts:1.
  • rule-enforcement-channel-selection.md §1 — detectable incident class → gate (not injection); edit-time hook = earliest channel, CI test = harness-agnostic backstop. Evidence: .claude/skills/pipeline/SKILL.md:335.

§1.7 Backward-check applied

Swept the existing artefacts under the new matcher's scope and reconciled how this PR supersedes prior state:

  • .claude/skills/pipeline/SKILL.md:335 — the Class-C prose anti-pattern is now backed by the executable artifact; prose semantics unchanged, only the Class annotation upgraded. Supersedes prose-only enforcement.
  • Live-tree sweep of .claude/orchestrator-prompts/*/kickoff.md — every tracked kickoff is clean or explicitly escaped; 2 genuine latent instances surfaced (meta-orchestrator-mode-triage-and-planner/kickoff.md:223, mutation-discipline-umbrella-meta-launch/kickoff.md:96), escaped with honest reasons.
  • docs/meta-factory/prior-art-evaluations.md — new SSOT row feat(n8-c3): principle 13 requires §1.7 substance (bare §1.7 no longer passes) #178 records the REFERENCE+BUILD split; no prior row superseded.

Prior-art: prior-art-evaluations.md#178 (HYBRID — REFERENCE steipete/agent-scripts convergent discipline + BUILD the deterministic kickoff-text gate slice; no upstream ships a repo-side dispatch-channel gate after 5 search layers).

artyhoo and others added 2 commits June 27, 2026 14:12
…ia-subagent (Stage B, #762)

Promotes `#worker-dispatch-via-subagent` (.claude/skills/pipeline/SKILL.md:335)
from Class C (prose-only) to Class A (executable artifact), implementing the M6
hybrid the merged Stage A research-patch recommended: one shared matcher called
by an edit-time PostToolUse hook + a CI principle test (settled decisions, §0 of
the kickoff — not re-litigated).

What ships (single source of truth, dual-implementation-discipline.md §7):
- packages/core/principles/29-worker-dispatch-channel.ts — the ONE matcher
  (clauses a-d), exported fixtures. @dual-pair: channel-discipline-worker-dispatch
- packages/core/principles/29-worker-dispatch-channel.bin.ts — CLI shim (exit 1)
- .claude/hooks/check-worker-dispatch-channel.sh — edit-time gate; delegates to
  the bin via tsx (clone of check-doc-authority.sh delegation, NOT a 2nd regex)
- packages/core/principles/29-worker-dispatch-channel.test.ts — CI backstop +
  paired-negative (fixture FIRES; clean/read-only/escaped SILENT) — 8/8 green
- SKILL.md §5 — Class A note + escape-token doc (semantics unchanged)
- SSOT #177 (verdict HYBRID = REFERENCE the discipline + BUILD the gate slice)

### Parked fork (per §3 — tune + document, not a silent guess)

Stage A §4 clause (a) sketch was
  /Agent[ -]tool|via .*Agent|isolation:\s*["']?worktree/
The `isolation: worktree` alternative was the SOLE cause of 8 false positives on
LEGITIMATE kickoffs — worktree isolation is the execution env of Mode A inline
sessions AND Mode B workers, not an Agent-tool signal (e.g.
narrow-b-benchmark/kickoff.md:177 "Worker creates branch ... isolation: worktree").
- Option A (applied): drop the standalone worktree alternative; clause (a) keys
  on the actual discriminator — the Agent-tool dispatch channel
  (packages/core/principles/29-worker-dispatch-channel.ts:48). Fixture still
  fires via "Agent tool". Removes 8 FPs.
- Option B: keep the literal sketch + add escape tokens to all 16 hits.
Chose A: the §2 deliverable's own prose for (a) is "names the Agent-tool
write-dispatch channel", which worktree isolation does not satisfy; A removes the
FP at its root rather than papering 8 legit lines. Documented in the module.

### Genuine latent instances surfaced (per §4 — surface, don't silently escape)

The FP sweep found 2 kickoffs that genuinely INSTRUCT Agent-tool write-dispatch
(not teaching) — both in CLOSED historical umbrellas, pre-/co-dating the rule
(documented 2026-05-26):
- meta-orchestrator-mode-triage-and-planner/kickoff.md:223 ("# THEN dispatch
  Mode A Worker via Agent tool ...", authored 2026-05-25, day before the rule)
- mutation-discipline-umbrella-meta-launch/kickoff.md:96 ("paste verbatim into
  Agent tool or inline session" — loose wording)
Escaped with honest reasons pointing here (not "allowed"); the other 6 hits are
teaching/incident-post-mortem/this-umbrella-planning-the-gate.

### Maintainer wiring (agent-uncommittable — add to ~/.claude/settings.json)

Append to .hooks.PostToolUse alongside the existing Edit|Write|MultiEdit entries:
  { "matcher": "Edit|Write|MultiEdit",
    "hooks": [ { "type": "command",
      "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/check-worker-dispatch-channel.sh" } ] }
Until wired, the CI principle test is the active backstop (no enforcement gap).

### Forward-check

This change was checked against and complies with the active disciplines:
- dual-implementation-discipline.md §7 (single source): one matcher module
  (packages/core/principles/29-worker-dispatch-channel.ts:73 lineIsViolation) is
  called by BOTH channels — the hook delegates to it via the bin
  (.claude/hooks/check-worker-dispatch-channel.sh:58), never a 2nd copy
  (`#two-prompts-drift` avoided); §6 markers applied — the hook carries both
  @dual-pair and @cc-only-rationale (check-worker-dispatch-channel.sh:8,11).
- no-paid-llm-in-ci.md §1 (applied): matcher is deterministic regex/TS; the CI
  test runs offline, zero API-billed calls (29-worker-dispatch-channel.ts:62).
- rule-enforcement-channel-selection.md §1 (applied): the violation class is
  mechanically detectable → a gate (not injection); earliest reachable channel
  is edit-time (the hook), CI is the portable backstop.
- doc-authority-hierarchy.md §2 (applied): code files (.ts) need no header; the
  SSOT edit preserves the table contract (prior-art-evaluations.md:250).
- ai-laziness-traps.md §2: T2/T15 (applied) — the paired-negative test PROVES
  the matcher discriminates (29-worker-dispatch-channel.test.ts:50 FIRES,
  :58 SILENT), not merely asserted; T16 (applied) — verified the
  check-doc-authority delegation pattern (single matcher) transfers, vs the
  check-kickoff-traps 2-regex pattern which would violate single-source.

### Backward-check

Backward sweep applied over the new matcher's scope: all 187 tracked
.claude/orchestrator-prompts/*/kickoff.md scanned (git ls-files) → 0 unescaped
violations, 8 escape-token lines added (evidence: principle test live-sweep green,
29-worker-dispatch-channel.test.ts:99). This supersedes the Class-C prose at
SKILL.md:335 — the prose stays source-of-truth for semantics; the new artifacts
add the enforcement layer beneath it. Honest ceiling recorded (SKILL.md:335 +
29-worker-dispatch-channel.ts:30): this is a kickoff-TEXT gate; the runtime
"who invokes" surface stays Class C (building for it now = build-ahead-of-need).

Prior-art: prior-art-evaluations.md#177 (HYBRID — REFERENCE the convergent dispatch-channel discipline validated by steipete/agent-scripts + aif-handoff per-worker commit isolation; BUILD the narrow deterministic kickoff-text gate no upstream ships, confirmed absent after 5 search layers in Stage A §2).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ss shipped-prettier gate

Prettier 3.8.3 normalizes *text* → _text_ for inline emphasis. The §5
Class-A note added in fcdaa3c used asterisk-style (`kickoff-*text*`,
`merely *performs*`) which broke the shipped-prettier CI gate.
Changed both spans to underscore-style on SKILL.md:335.

No semantic change — same two phrases, Prettier-preferred markup only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@artyhoo
artyhoo enabled auto-merge (squash) June 27, 2026 14:47
@artyhoo
artyhoo merged commit 4d524c3 into staging Jun 27, 2026
29 checks passed
artyhoo added a commit that referenced this pull request Jun 27, 2026
…validation (#767)

* docs(research): Stage C dogfood — M6 channel-discipline gate end-to-end validation (#765)

Validates the Stage B mechanism: fires on the ground-truth fixture (exit 1),
silent on clean kickoffs, CI principle test gates every PR. Two honest findings
(F1 ~250ms tsx cold-start over the 200ms aspirational target; F2 fail-open when
node_modules/.bin/tsx absent) — both shared with check-doc-authority.sh, both
backstopped by the fail-closed CI test. Closes the umbrella's recursive-self-
application loop.

Prior-art: skipped — validation-only patch, no new capability (dogfoods the
mechanism shipped in #765; documents two pre-existing-pattern findings).

* chore(umbrella): close meta-orch-channel-discipline (done.md, final PR #767)
artyhoo added a commit that referenced this pull request Jun 27, 2026
….sh into PostToolUse (#769)

Activates the M1 (edit-time) channel for #worker-dispatch-via-subagent, joining
check-doc-authority.sh / check-kickoff-traps.sh. Dev-only .claude/settings.json
(hash != the install-generated consumer settings.json → byte-identical 8/8 pass,
no cascade, no consumer impact). The hook itself shipped in #765; this pairs the
wiring with the file on staging so every staging worktree gets a working M1.

Prior-art: skipped — config wiring only, no new capability (1-line PostToolUse entry).
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