feat(ambient): pipeline flow, SessionStart classification, minimal preamble#174
feat(ambient): pipeline flow, SessionStart classification, minimal preamble#174
Conversation
…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>
Code Review — High Confidence Findings (≥80%)Blocking Issues (Task→Agent Migration) — Confidence: 95%7 orchestration skills need
All skill bodies migrated to 🚨 Security Concern: Pipeline Removes User Confirmation GatesConfidence: 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 Issues1. Incomplete Two-Hook Architecture Documentation (85% confidence)
2. hasAmbientHook Status Check Incomplete (82% confidence)
3. Non-null Assertions After expect() (85% confidence)
4. Mutation Anti-pattern (82% confidence)
5. Router Skills Regression (92% confidence)
Documentation Drift1. CLAUDE.md Line Count (82% confidence)
2. Ambient README Descriptions (83-85% confidence)
3. Classification Bias Shift (90% confidence)
Infrastructure SecurityFile Content Injection Without Bounds (82% confidence)
Summary
Recommendation: Request changes Claude Code review automation |
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>
Summary
pipeline:orchnow runs implement → review → resolve end-to-end with status reporting between stages (no moreAskUserQuestioninterruptions)session-start-classificationhook reads installed routerSKILL.md, strips frontmatter, injects classification rules once per session viaadditionalContext(deterministic, zero model overhead)"Classify user intent and depth."— deduplicates classification format (single source of truth in router SKILL.md)filterHookEntriesaccepts event name parameter;addAmbientHook/removeAmbientHookmanage bothUserPromptSubmit(preamble) andSessionStart(classification) hooks independently with idempotency and upgrade path for existing usersFiles changed (11)
shared/skills/pipeline:orch/SKILL.mdshared/skills/router/SKILL.mdshared/skills/router/references/skill-catalog.mdscripts/hooks/session-start-classificationscripts/hooks/preamblesrc/cli/commands/ambient.tsCLAUDE.mdtests/ambient.test.tstests/integration/helpers.tstests/integration/ambient-activation.test.tshasSkillInvocations(router not via Skill tool)tests/skill-references.test.tsTest plan
npm test— 608/608 passingnpm run build— 39 skills, 11 agents, 17 pluginsnpm run test:integration— classification accuracy with SessionStart injectionnode dist/cli.js init→ verify settings.json has both hooks