Skip to content

feat(ambient): pipeline flow, SessionStart classification, minimal preamble#174

Merged
dean0x merged 10 commits intomainfrom
feat/ambient-pipeline-flow
Apr 7, 2026
Merged

feat(ambient): pipeline flow, SessionStart classification, minimal preamble#174
dean0x merged 10 commits intomainfrom
feat/ambient-pipeline-flow

Conversation

@dean0x
Copy link
Copy Markdown
Owner

@dean0x dean0x commented Apr 6, 2026

Summary

  • Pipeline stop gates removedpipeline:orch now runs implement → review → resolve end-to-end with status reporting between stages (no more AskUserQuestion interruptions)
  • SessionStart classification hook — New session-start-classification hook reads installed router SKILL.md, strips frontmatter, injects classification rules once per session via additionalContext (deterministic, zero model overhead)
  • Minimal preamble — Reduced from 5-line classification duplicate to one sentence: "Classify user intent and depth." — deduplicates classification format (single source of truth in router SKILL.md)
  • Hook management generalizedfilterHookEntries accepts event name parameter; addAmbientHook/removeAmbientHook manage both UserPromptSubmit (preamble) and SessionStart (classification) hooks independently with idempotency and upgrade path for existing users

Files changed (11)

File Change
shared/skills/pipeline:orch/SKILL.md Remove 2 gates, update Iron Law, remove AskUserQuestion
shared/skills/router/SKILL.md Update note: injected at session start
shared/skills/router/references/skill-catalog.md "user gates" → "status reporting between phases"
scripts/hooks/session-start-classification NEW — reads router SKILL.md, injects at SessionStart
scripts/hooks/preamble PREAMBLE → one sentence
src/cli/commands/ambient.ts Generalize filterHookEntries, manage SessionStart hook
CLAUDE.md Add Ambient Mode architecture paragraph
tests/ambient.test.ts Rewrite drift detection, add SessionStart hook tests
tests/integration/helpers.ts Load router SKILL.md from disk for DEVFLOW_PREAMBLE
tests/integration/ambient-activation.test.ts GUIDED assertions: hasSkillInvocations (router not via Skill tool)
tests/skill-references.test.ts Check router SKILL.md directly instead of static helpers.ts

Test plan

  • npm test — 608/608 passing
  • npm run build — 39 skills, 11 agents, 17 plugins
  • npm run test:integration — classification accuracy with SessionStart injection
  • Manual: node dist/cli.js init → verify settings.json has both hooks
  • Manual: test PIPELINE prompt flows without gates

Dean Sharon and others added 6 commits April 6, 2026 11:41
…eamble

- Remove AskUserQuestion gates from pipeline:orch — runs end-to-end with
  status reporting between stages, never pauses
- Add session-start-classification hook that reads router SKILL.md and
  injects classification rules once at SessionStart via additionalContext
- Reduce preamble to one-sentence classification prompt (was 5-line
  duplicate of router content)
- Generalize filterHookEntries to accept event name parameter
- addAmbientHook/removeAmbientHook now manage both UserPromptSubmit
  (preamble) and SessionStart (classification) hooks independently
- Update integration test helpers to load router SKILL.md from disk
- Update GUIDED integration test assertions (router no longer loaded
  via Skill tool)
…eamble, router skill

SessionStart hook injects classification-rules.md once per session.
Preamble hook triggers classify + load-router per message.
Router SKILL.md is a pure intent×depth skill lookup table (~50 lines).
Extracted classification rules to shared/skills/router/references/.
…coverage tests

Fix 5 misaligned integration tests:
- EXPLORE/GUIDED: expect no skills (router has —)
- RESOLVE/ORCH: require only resolve:orch (router has no software-design)
- DEBUG/GUIDED: add test-driven-development to expected
- PLAN/GUIDED: add test-driven-development, security to expected
- Rename "QUICK chat" to clarify preamble word-count filter behavior

Add 4 new integration tests:
- Multi-word CHAT/QUICK (passes preamble, classified QUICK)
- Slash command prefix skipped by preamble filter
- DEBUG/ORCHESTRATED with complex multi-module prompt
- PLAN/ORCHESTRATED with multi-service architecture prompt

Add 4 structural unit tests:
- Router covers all ORCHESTRATED intents from classification rules
- RESOLVE/PIPELINE have no GUIDED rows (always ORCHESTRATED)
- Every devflow:X ref in router tables exists in shared/skills/
- Integration test expected arrays align with router skill tables
…dability

- Remove pre-removal assertions in removeAmbientHook test (tested by addAmbientHook)
- Extract ternary to named variable in parseRouterTables
- Scope integrationPath to only test that uses it
- Remove redundant "After Classification" header phrasing
- Clarify router load rules with direct action-oriented header
- All 21 files ready for PR (Task→Agent naming, QUICK rule, test cleanup)

Co-Authored-By: Claude <noreply@anthropic.com>
@dean0x
Copy link
Copy Markdown
Owner Author

dean0x commented Apr 7, 2026

Code Review — High Confidence Findings (≥80%)

Blocking Issues (Task→Agent Migration) — Confidence: 95%

7 orchestration skills need allowed-tools frontmatter update from Task to Agent:

  • shared/skills/implement:orch/SKILL.md:5
  • shared/skills/pipeline:orch/SKILL.md:5 ⚠️ Also removes user gates
  • shared/skills/debug:orch/SKILL.md:5
  • shared/skills/explore:orch/SKILL.md:5
  • shared/skills/plan:orch/SKILL.md:5
  • shared/skills/review:orch/SKILL.md:5
  • shared/skills/resolve:orch/SKILL.md:5

All skill bodies migrated to Agent(...) syntax; frontmatter metadata must match.


🚨 Security Concern: Pipeline Removes User Confirmation Gates

Confidence: 95% | shared/skills/pipeline:orch/SKILL.md

The Iron Law changed from "USER GATES BETWEEN STAGES" to "FULL PIPELINE, NO INTERRUPTIONS". When review finds CRITICAL security vulnerabilities (SQL injection, hardcoded credentials), the pipeline now auto-resolves them via AI agents without human judgment.

This violates the stated principle "developer empowerment without replacing judgment."

Recommendation: Restore user confirmation gate specifically for CRITICAL findings. Allow auto-proceed for HIGH/MEDIUM/LOW.


Code Quality Issues

1. Incomplete Two-Hook Architecture Documentation (85% confidence)

  • src/cli/commands/ambient.ts:221 — Update success message from "UserPromptSubmit hook" to "hooks"
  • src/cli/commands/ambient.ts:160-161 — Update option descriptions to plural

2. hasAmbientHook Status Check Incomplete (82% confidence)

  • src/cli/commands/ambient.ts:138-150 — Only checks UserPromptSubmit; also verify SessionStart classification hook

3. Non-null Assertions After expect() (85% confidence)

  • tests/ambient.test.ts:571, 587 — Replace expect().toBeDefined() + ! with type narrowing guards

4. Mutation Anti-pattern (82% confidence)

  • src/cli/commands/ambient.ts:14 — Document mutation contract of filterHookEntries

5. Router Skills Regression (92% confidence)

  • shared/skills/router/SKILL.md:30-36 — ORCHESTRATED DEBUG/RESOLVE lost TDD and software-design skills; PLAN lost TDD. skill-catalog.md still lists as "Always" required.

Documentation Drift

1. CLAUDE.md Line Count (82% confidence)

  • CLAUDE.md:43 — Says classification-rules.md is "~25 lines" but it's 32. Update to "~30 lines".

2. Ambient README Descriptions (83-85% confidence)

  • plugins/devflow-ambient/README.md:257 — QUICK description says "exploration" but rules say "simple lookups" (narrower)
  • plugins/devflow-ambient/README.md:280 — GUIDED PLAN missing test-driven-development and security skills

3. Classification Bias Shift (90% confidence)

  • shared/skills/router/references/classification-rules.md:22-24 — Changed from GUIDED-conservative to ORCHESTRATED-default. Document as intentional in release notes.

Infrastructure Security

File Content Injection Without Bounds (82% confidence)

  • scripts/hooks/session-start-classification:19-23 — Add 4KB size guard before injecting content as additionalContext

Summary

Type Count Severity
Blocking 1 HIGH (Task→Agent)
Security 1 HIGH (pipeline gates)
Should-Fix 8 MEDIUM
Documentation 4 MEDIUM

Recommendation: Request changes


Claude Code review automation

Dean Sharon and others added 4 commits April 7, 2026 12:12
hasAmbientHook now returns true if EITHER the UserPromptSubmit preamble
hook OR the SessionStart classification hook is present, handling partial
states during upgrade. Option descriptions and enable success message
updated to reflect that two hooks are managed.

Co-Authored-By: Claude <noreply@anthropic.com>
… classification hook

Orchestration skills are main-session orchestrators and need unrestricted
tool access (same as devflow:router which already omits allowed-tools).
Remove the allowed-tools line from all 7 orch skill frontmatters.

Add a 4KB size guard to session-start-classification before injecting
classification rules content, preventing unexpected large file injection.
Add `if (!x) return` guards after `expect(x).toBeDefined()` and
`expect(x).not.toBeNull()` at lines 566-574 and 586-587, removing
the `!` operators that bypassed TypeScript's type narrowing.

Co-Authored-By: Claude <noreply@anthropic.com>
- CLAUDE.md: update classification-rules.md line count ~25 → ~30
- README.md: mention both hooks in description and --enable comment,
  add test-driven-development to DEBUG GUIDED skills, add
  test-driven-development + security to PLAN GUIDED skills
- skill-catalog.md: narrow DEBUG test-driven-development + software-design
  to GUIDED only (ORCHESTRATED DEBUG loads debug:orch only), remove
  test-driven-development + software-design from RESOLVE (loaded
  internally by Resolver agents, not by router), narrow PLAN
  test-driven-development to GUIDED only (ORCHESTRATED PLAN omits TDD)

Co-Authored-By: Claude <noreply@anthropic.com>
@dean0x dean0x merged commit b11467a into main Apr 7, 2026
3 of 4 checks passed
@dean0x dean0x deleted the feat/ambient-pipeline-flow branch April 7, 2026 09:43
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