ultra-builder-pro-cli 0.6.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.ultra-template/changes/active/.gitkeep +1 -0
  2. package/.ultra-template/changes/archive/.gitkeep +1 -0
  3. package/CHANGELOG.md +90 -11
  4. package/README.md +39 -19
  5. package/adapters/_shared/handbook.cjs +8 -7
  6. package/adapters/_shared/provenance.cjs +286 -0
  7. package/adapters/_shared/runtime-assets.cjs +2 -0
  8. package/adapters/_shared/tests/handbook.test.cjs +4 -1
  9. package/adapters/_shared/tests/provenance.test.cjs +133 -0
  10. package/adapters/_shared/tests/runtime-assets.test.cjs +2 -0
  11. package/adapters/claude.js +33 -0
  12. package/adapters/codex.js +87 -0
  13. package/adapters/opencode.js +147 -20
  14. package/adapters/tests/codex.test.cjs +42 -3
  15. package/adapters/tests/opencode.test.cjs +16 -9
  16. package/agents/debugger.md +12 -0
  17. package/bin/install.js +63 -27
  18. package/bin/orchestrator.js +1 -26
  19. package/commands/ultra-change.md +48 -0
  20. package/commands/ultra-deliver.md +14 -7
  21. package/commands/ultra-dev.md +6 -3
  22. package/commands/ultra-doctor.md +36 -0
  23. package/commands/ultra-init.md +4 -3
  24. package/commands/ultra-status.md +7 -5
  25. package/commands/ultra-test.md +2 -1
  26. package/docs/AGENT-CONTEXT.md +31 -23
  27. package/docs/ARCHITECTURE.md +80 -17
  28. package/docs/PLAN.zh-CN.md +37 -29
  29. package/docs/ROADMAP.md +14 -14
  30. package/docs/RUNTIME-COMPAT-MATRIX.md +19 -12
  31. package/hooks/README.md +14 -9
  32. package/hooks/active_task_context.py +22 -15
  33. package/hooks/health_check.py +136 -38
  34. package/hooks/workflow_checkpoint.py +15 -1
  35. package/hooks/workflow_context.py +120 -30
  36. package/hooks/workflow_resume.py +96 -7
  37. package/mcp-server/lib/change-workflow.cjs +625 -0
  38. package/mcp-server/lib/change-workflow.test.cjs +346 -0
  39. package/mcp-server/lib/doctor.cjs +112 -0
  40. package/mcp-server/lib/doctor.test.cjs +86 -0
  41. package/mcp-server/lib/init-project.cjs +32 -6
  42. package/mcp-server/lib/runtime-state.cjs +222 -0
  43. package/mcp-server/lib/runtime-state.test.cjs +92 -0
  44. package/mcp-server/lib/state-db.cjs +31 -8
  45. package/mcp-server/lib/state-ops.cjs +17 -3
  46. package/mcp-server/server.cjs +102 -10
  47. package/mcp-server/tests/db-ops.test.cjs +5 -1
  48. package/mcp-server/tests/init-project.test.cjs +45 -0
  49. package/mcp-server/tests/server-contract.test.cjs +123 -1
  50. package/mcp-server/tests/state-db.test.cjs +44 -7
  51. package/mcp-server/tests/state-ops.test.cjs +19 -0
  52. package/orchestrator/daemon.cjs +39 -0
  53. package/orchestrator/tests/daemon.test.cjs +50 -0
  54. package/package.json +3 -3
  55. package/settings.json +1 -2
  56. package/skills/ultra-change/SKILL.md +149 -0
  57. package/skills/ultra-deliver/SKILL.md +83 -15
  58. package/skills/ultra-dev/SKILL.md +32 -12
  59. package/skills/ultra-doctor/SKILL.md +97 -0
  60. package/skills/ultra-init/SKILL.md +8 -5
  61. package/skills/ultra-review/SKILL.md +16 -0
  62. package/skills/ultra-status/SKILL.md +30 -7
  63. package/skills/ultra-test/SKILL.md +14 -2
  64. package/spec/cli-protocol.md +12 -1
  65. package/spec/mcp-tools.yaml +337 -1
  66. package/spec/schemas/mcp-tools.schema.json +1 -1
  67. package/spec/schemas/state-db.sql +117 -0
  68. package/ultra-tools/cli.cjs +3 -0
  69. package/ultra-tools/commands/system.cjs +57 -0
  70. package/ultra-tools/system-command.test.cjs +53 -0
  71. package/adapters/_shared/rtk-detect.cjs +0 -86
  72. package/adapters/_shared/tests/rtk-detect.test.cjs +0 -116
  73. package/docs/LEGACY-HERMES.md +0 -1099
  74. package/orchestrator/code-graph-watcher.cjs +0 -121
  75. package/orchestrator/tests/code-graph-watcher.test.cjs +0 -183
@@ -1,1099 +0,0 @@
1
- # Ultra Builder Pro — Legacy Hermes Documentation
2
-
3
- > **Archived**: This is the pre-v0.3 "Hermes 6.6.0" documentation. It describes
4
- > the Claude-Code-only version of the agent engineering system before the
5
- > CLI distribution / multi-runtime / MCP / SQLite redesign (Phase 0-8B).
6
- >
7
- > For the current CLI-focused documentation, see [`README.md`](../README.md)
8
- > and [`docs/ROADMAP.md`](./ROADMAP.md). For the authoritative project plan,
9
- > see [`docs/PLAN.zh-CN.md`](./PLAN.zh-CN.md).
10
- >
11
- > This file is kept for context on the pre-CLI design; commands / skills /
12
- > agents / hooks referenced here still live under `commands/` `skills/`
13
- > `agents/` `hooks/` but are now installed via the multi-runtime adapters
14
- > rather than copied directly into `.claude/`.
15
-
16
- ---
17
-
18
- # Ultra Builder Pro 6.6.0 (legacy)
19
-
20
- <div align="center">
21
-
22
- **Production-Grade AI-Powered Development System for Claude Code**
23
-
24
- ---
25
-
26
- [![Version](https://img.shields.io/badge/version-6.6.0-blue)](README.md#version-history)
27
- [![Status](https://img.shields.io/badge/status-production--ready-green)](README.md)
28
- [![Commands](https://img.shields.io/badge/commands-9-purple)](commands/)
29
- [![Skills](https://img.shields.io/badge/skills-17-orange)](skills/)
30
- [![Agents](https://img.shields.io/badge/agents-11-red)](agents/)
31
- [![Hooks](https://img.shields.io/badge/hooks-15-yellow)](hooks/)
32
- [![Tests](https://img.shields.io/badge/tests-84-brightgreen)](hooks/tests/)
33
-
34
- </div>
35
-
36
- ---
37
-
38
- ## Quick Start
39
-
40
- ```bash
41
- # Clone the repository
42
- git clone https://github.com/rocky2431/ultra-builder-pro.git
43
- cd ultra-builder-pro
44
-
45
- # Copy to Claude Code config directory
46
- cp -r ./* ~/.claude/
47
-
48
- # Start Claude Code
49
- claude
50
- ```
51
-
52
- ---
53
-
54
- ## Core Philosophy
55
-
56
- ### Priority Stack (CLAUDE.md)
57
-
58
- | Priority | Rule |
59
- |----------|------|
60
- | 1 | **Role + Safety**: Deployable code, KISS/YAGNI, think in English, respond in Chinese |
61
- | 2 | **Context Blocks**: Honor XML blocks exactly as written |
62
- | 3 | **Evidence-First**: External facts require verification (Context7/Exa MCP) |
63
- | 4 | **Honesty & Challenge**: Challenge user assumptions, name logical gaps |
64
- | 5 | **Architecture**: Critical state must be persistable/recoverable/observable |
65
- | 6 | **Code Quality**: No TODO/FIXME/placeholder, modular, avoid deep nesting |
66
- | 7 | **Testing**: No mocking core logic, external deps allow test doubles |
67
- | 8 | **Action Bias**: Default to progress, high-risk must brake and ask |
68
-
69
- ### Production Absolutism
70
-
71
- > "There is no test code. There is no demo. There is no MVP.
72
- > Every line is production code. Every test is production verification."
73
-
74
- ```
75
- Code Quality = Real Implementation x Real Tests x Real Dependencies
76
- If ANY component is fake/mocked/simulated -> Quality = 0
77
- ```
78
-
79
- ---
80
-
81
- ## Workflow
82
-
83
- ```
84
- /ultra-init -> /ultra-research -> /ultra-plan -> /ultra-dev -> /ultra-test -> /ultra-deliver
85
- | | | | | |
86
- Project 17-Step Task TDD Cycle Quality Release
87
- Setup Step-File Arch Breakdown RED>GREEN Audit & Deploy
88
- (JIT load) |
89
- Steps 00-05: Product Discovery /ultra-review
90
- Steps 10-11: User & Scenario (Quality Gate)
91
- Steps 20-22: Feature Definition
92
- Steps 30-32: Architecture
93
- Steps 40-41: Quality & Deploy
94
- Step 99: Synthesis → Distillate
95
- ```
96
-
97
- ---
98
-
99
- ## Commands (9)
100
-
101
- | Command | Purpose | Key Features |
102
- |---------|---------|--------------|
103
- | `/ultra-init` | Initialize project | Auto-detect type/stack, copy templates, git setup |
104
- | `/ultra-research` | Interactive discovery | 17 step-files (JIT loaded, ~200 lines each), mandatory web search + structured output templates, research distillate for /ultra-plan |
105
- | `/ultra-plan` | Task planning | Scope Mode (EXPAND/SELECTIVE/HOLD/REDUCE), dependency analysis, complexity assessment |
106
- | `/ultra-dev` | TDD development | RED>GREEN>REFACTOR, Ultra Review gate, auto git flow |
107
- | `/ultra-test` | Quality audit | Anti-Pattern, Coverage gaps, E2E, Performance, Security |
108
- | `/ultra-deliver` | Release preparation | CHANGELOG, build, version bump, tag, push |
109
- | `/ultra-status` | Progress monitoring | Real-time stats, risk analysis, recommendations |
110
- | `/ultra-think` | Deep analysis | Structured reasoning, multi-dimension comparison |
111
- | `/learn` | Pattern extraction | Extract reusable patterns from session, save to skills/learned/ |
112
-
113
- ---
114
-
115
- ## Skills (17 + Learned Patterns)
116
-
117
- | Skill | Purpose | User-Invocable |
118
- |-------|---------|----------------|
119
- | `ultra-review` | Parallel code review with 6 agents + coordinator | Yes |
120
- | `ultra-verify` | Independent cross-model verification | Yes |
121
- | `codex-collab` | OpenAI Codex CLI as independent sub-agent for review, analysis | Yes |
122
- | `recall` | Cross-session memory search, save summaries, tags | Yes |
123
- | `agent-browser` | Browser automation CLI for AI agents | Yes |
124
- | `find-skills` | Discover and install agent skills | Yes |
125
- | `use-railway` | Railway infrastructure operations (deploy, provision, manage) | Yes |
126
- | `vercel-react-best-practices` | React/Next.js performance optimization guidelines | Yes |
127
- | `vercel-react-native-skills` | React Native/Expo best practices for mobile apps | Yes |
128
- | `vercel-composition-patterns` | React composition patterns that scale | Yes |
129
- | `web-design-guidelines` | Web Interface Guidelines compliance review | Yes |
130
- | `ai-collab-base` | Shared collaboration protocol, modes, prompt templates | No (consumed by collab skills) |
131
- | `code-review-expert` | Structured review checklists (SOLID, security, perf, integration) | No (agent-only) |
132
- | `testing-rules` | TDD discipline, mock detection rules | No (agent-only) |
133
- | `security-rules` | Input validation, injection prevention rules | No (agent-only) |
134
- | `integration-rules` | Vertical slice, walking skeleton, contract-first, orphan detection | No (agent-only) |
135
- | `learned/` | Extracted patterns from `/learn` | Yes |
136
-
137
- ---
138
-
139
- ## Agents (11)
140
-
141
- All agents have **project-scoped persistent memory** (`memory: project`) that accumulates patterns per project, preventing cross-project pollution.
142
-
143
- ### Interactive Agents (5)
144
-
145
- | Agent | Purpose | Trigger | Model | Memory |
146
- |-------|---------|---------|-------|--------|
147
- | `smart-contract-specialist` | Solidity, gas optimization, secure patterns | .sol files | opus | project |
148
- | `smart-contract-auditor` | Contract security audit, vulnerability detection | .sol files | opus | project |
149
- | `code-reviewer` | Code review with Fix-First mode (report or auto-fix) | After code changes, pre-commit | opus | project |
150
- | `tdd-runner` | Test execution, failure analysis, coverage | "run tests", test suite | opus | project |
151
- | `debugger` | Root cause analysis, minimal fix implementation | Errors, test failures | opus | project |
152
-
153
- ### Review Pipeline Agents (7) - Ultra Review System
154
-
155
- Used exclusively by `/ultra-review`. Each agent writes JSON findings to `.ultra/reviews/<session>/` (project-level).
156
-
157
- | Agent | Purpose | Output |
158
- |-------|---------|--------|
159
- | `review-code` | Scope drift detection + CLAUDE.md compliance, code quality, architecture, integration | `review-code.json` |
160
- | `review-tests` | Test quality, mock violations, coverage gaps | `review-tests.json` |
161
- | `review-errors` | Silent failures, empty catches, swallowed errors | `review-errors.json` |
162
- | `review-design` | Type design, encapsulation, complexity analysis | `review-design.json` |
163
- | `review-comments` | Stale, misleading, or low-value comments | `review-comments.json` |
164
- | `review-coordinator` | Aggregate, deduplicate, generate SUMMARY | `SUMMARY.md` + `SUMMARY.json` |
165
-
166
- **Verdict Logic**: P0 > 0 = REQUEST_CHANGES | P1 > 3 = REQUEST_CHANGES | P1 > 0 = COMMENT | else APPROVE
167
-
168
- ---
169
-
170
- ## Ultra Review System
171
-
172
- ### Overview
173
-
174
- `/ultra-review` orchestrates parallel code review using 6 specialized agents + 1 coordinator. All findings are written to JSON files to prevent context window pollution.
175
-
176
- ### Usage Modes
177
-
178
- ```
179
- /ultra-review # Full review (smart skip based on diff content)
180
- /ultra-review all # Force ALL 6 agents, no auto-skip (pre-merge gate)
181
- /ultra-review quick # Quick review (review-code only)
182
- /ultra-review security # Security focus (review-code + review-errors)
183
- /ultra-review tests # Test quality focus (review-tests only)
184
- /ultra-review recheck # Re-check P0/P1 files from last session
185
- /ultra-review delta # Review only changes since last review
186
- ```
187
-
188
- ### Scope Options
189
-
190
- ```
191
- /ultra-review --pr 123 # Review PR #123 diff
192
- /ultra-review --range main..HEAD # Review specific commit range
193
- /ultra-review security --pr 42 # Security review scoped to PR #42
194
- ```
195
-
196
- ### Session Management
197
-
198
- - Sessions tracked in `.ultra/reviews/index.json` (project-level) with branch-scoped iteration chains
199
- - Naming: `<YYYYMMDD-HHmmss>-<branch>-iter<N>>`
200
- - Auto-cleanup: 7 days for APPROVE/COMMENT, 30 days for REQUEST_CHANGES, max 5 per branch
201
-
202
- ### Integration with ultra-dev
203
-
204
- Step 4.5 of `/ultra-dev` runs `/ultra-review all` (forced full coverage) as a mandatory quality gate before commit. The `pre_stop_check.py` hook blocks session stop if source files are changed but not reviewed (circuit breaker allows stop after 2 blocks).
205
-
206
- ---
207
-
208
- ## Cross-Session Memory
209
-
210
- ### Overview
211
-
212
- AI-powered cross-session memory with hybrid search. Auto-captures session events, generates structured AI summaries via Haiku, and supports semantic + keyword retrieval. Designed as a safe alternative to claude-mem — no bulk context injection.
213
-
214
- ### Architecture
215
-
216
- ```
217
- UserPromptSubmit ──> user_prompt_capture.py ──> initial_request (sessions table)
218
- PostToolUse ──> observation_capture.py ──> observations table (max 20/session)
219
-
220
- Stop hook (auto) /recall skill (forked context)
221
- | |
222
- v v
223
- session_journal.py ──> SQLite FTS5 <── memory_db.py CLI
224
- | (memory.db) |
225
- | Schema v2: v
226
- | - sessions (+ content_session_id, initial_request)
227
- | - session_summaries (structured JSON)
228
- | - observations (file changes, test failures)
229
- | - summaries_fts (FTS5 over summaries)
230
- |
231
- |-- daemon (10s) ──> Haiku ──> structured JSON summary ──> SQLite + Chroma
232
- | {request, completed, learned, next_steps}
233
- v
234
- sessions.jsonl (backup) .ultra/memory/chroma/ (vector embeddings)
235
-
236
- PreCompact ──> compact-snapshot.md ──> SessionStart(compact) ──> post_compact_inject.py
237
- (save) (disk persistence) (auto-trigger) (~800 tokens recovery)
238
- ```
239
-
240
- ### How It Works
241
-
242
- 1. **Initial request capture** (UserPromptSubmit hook): Captures first user prompt per session
243
- 2. **Observation capture** (PostToolUse hook): Records file changes (Edit/Write) and test failures (Bash) — max 20 per session, deduped by content hash
244
- 3. **Auto-capture** (Stop hook): Every response records branch, cwd, modified files
245
- 4. **AI Summary** (async daemon): Double-fork daemon waits 10s after session stop, extracts transcript (head+tail sampling: 4K+11K chars), generates structured JSON summary via Haiku (three-tier fallback: claude CLI → Anthropic SDK → git commits)
246
- 5. **Vector Embedding**: After AI summary, auto-upserts to Chroma (local ONNX, no API key)
247
- 6. **Merge window**: Multiple stops within 30 minutes merge into one session record
248
- 7. **Real session identity**: `content_session_id` from hook protocol for accurate session tracking
249
- 8. **SessionStart injection**: Injects ONE line (~50 tokens) about the last session + up to 3 branch-relevant structured summaries — no context explosion
250
- 9. **Post-compact recovery**: `SessionStart(compact)` triggers `post_compact_inject.py` — injects ~800 tokens of git state, active tasks, workflow progress, and session memory for continuity after auto-compact
251
- 10. **Hybrid search**: `/recall` runs in forked context, combines FTS5 keyword + Chroma semantic via RRF
252
-
253
- ### Usage
254
-
255
- ```
256
- /recall # Recent 5 sessions
257
- /recall auth bug # Hybrid search (FTS5 + semantic RRF)
258
- /recall --semantic "login flow" # Pure semantic vector search
259
- /recall --keyword session_journal # Pure FTS5 keyword search
260
- /recall --recent 10 # Recent 10 sessions
261
- /recall --date 2026-02-16 # Sessions on specific date
262
- /recall --save "Fixed auth bug" # Save summary for latest session
263
- /recall --tags "auth,bugfix" # Add tags to latest session
264
- /recall --stats # Database statistics
265
- /recall --cleanup 90 # Delete sessions older than 90 days
266
- ```
267
-
268
- ### Storage
269
-
270
- - **Database**: `.ultra/memory/memory.db` (project-level, SQLite FTS5)
271
- - **Vectors**: `.ultra/memory/chroma/` (project-level, Chroma + ONNX embeddings)
272
- - **Backup**: `.ultra/memory/sessions.jsonl` (append-only JSONL)
273
- - **Retention**: 90 days default
274
- - **Dependencies**: chromadb (ONNX embeddings), anthropic SDK (optional, for AI summary fallback)
275
-
276
- ---
277
-
278
- ## TDD Workflow
279
-
280
- Mandatory for all new code:
281
-
282
- ```
283
- 1. RED -> Write failing test first (define expected behavior)
284
- 2. GREEN -> Write minimal code to pass test
285
- 3. REFACTOR -> Improve code (keep tests passing)
286
- 4. COVERAGE -> Verify 80%+ coverage
287
- 5. COMMIT -> Atomic commit (test + implementation together)
288
- ```
289
-
290
- ### What NOT to Mock (Core Logic)
291
-
292
- - Domain/service/state machine logic
293
- - Funds/permission related paths
294
- - Repository interface contracts
295
-
296
- ### What CAN be Mocked (External)
297
-
298
- - Third-party APIs (OpenAI, Supabase, etc.)
299
- - External services
300
- - Must explain rationale for each mock
301
-
302
- ---
303
-
304
- ## Hooks System (15 Hooks)
305
-
306
- Automated enforcement via Python hooks in `hooks/`. **Hooks are deterministic — unlike CLAUDE.md rules which are advisory, hooks guarantee the action happens.**
307
-
308
- **Protocol compliance**: 100% — all hooks follow official Claude Code hook protocol (stdin JSON, stdout JSON, exit codes 0/2).
309
-
310
- ### PreToolUse Hooks (Guard before execution)
311
-
312
- | Hook | Trigger | Detection | Timeout |
313
- |------|---------|-----------|---------|
314
- | `block_dangerous_commands.py` | Bash | rm -rf, fork bombs, chmod 777, force push main | 5s |
315
- | `mid_workflow_recall.py` | Write/Edit | Inject past test failures + edit history + learned lessons from memory.db for the file being edited (rate-limited) | 3s |
316
-
317
- ### PostToolUse Hooks (Quality gate after execution)
318
-
319
- | Hook | Trigger | Detection | Timeout |
320
- |------|---------|-----------|---------|
321
- | `post_edit_guard.py` | Edit/Write | Code quality (TODO/FIXME), mocks, security, TDD pairing, **blast radius** (show dependents), **silent catch detection** (block except:pass), **test reminder** | 5s |
322
- | `observation_capture.py` | Edit/Write/Bash | Capture file changes, test failures, and significant commands (git/build/deploy) as session observations | 3s |
323
-
324
- ### User Input Hooks
325
-
326
- | Hook | Trigger | Function | Timeout |
327
- |------|---------|----------|---------|
328
- | `user_prompt_capture.py` | UserPromptSubmit | Capture initial user request per session for structured summaries | 3s |
329
-
330
- ### Session & Lifecycle Hooks
331
-
332
- | Hook | Trigger | Function | Timeout |
333
- |------|---------|----------|---------|
334
- | `health_check.py` | SessionStart | **System Health**: verify agents exist, hooks syntax, DB health, settings refs, CLAUDE.md | 5s |
335
- | `session_context.py` | SessionStart | Load git branch, commits, modified files + last session one-liner + branch memory from DB | 10s |
336
- | `session_journal.py` | Stop | Auto-capture session + spawn AI summary daemon (Haiku, non-blocking) → SQLite + Chroma | 5s |
337
- | `pre_stop_check.py` | Stop | Source file change detection + workflow state check + **completion compliance checklist** (Taskmaster-inspired excuse detection) | 5s |
338
- | `subagent_tracker.py` | SubagentStart/Stop | Log agent lifecycle to `.ultra/debug/subagent-log.jsonl` (project-level) | 5s |
339
- | `pre_compact_context.py` | PreCompact | Preserve task state and git context to `.ultra/compact-snapshot.md` + branch memory | 10s |
340
- | `post_compact_inject.py` | SessionStart(compact) | Post-compact context recovery: parse snapshot, inject git state/tasks/workflow/memory | 10s |
341
-
342
- ### Notification & Cleanup Hooks
343
-
344
- | Hook | Trigger | Function | Timeout |
345
- |------|---------|----------|---------|
346
- | macOS notification | Notification(permission_prompt\|idle_prompt) | Desktop alert with sound when Claude needs user input | 5s |
347
- | Counter cleanup | SessionEnd | Remove stale stop-count temp files (>60min old) | 5s |
348
-
349
- ### Shared Utilities & Tools
350
-
351
- | File | Purpose |
352
- |------|---------|
353
- | `hook_utils.py` | Shared functions: `get_snapshot_path()`, `get_workflow_state()`, `parse_hook_input()` |
354
- | `memory_db.py` | SQLite FTS5 + Chroma vector engine + CLI tool — foundation for all memory hooks |
355
- | `system_doctor.py` | Deep audit: cross-references, DB quality, Chroma consistency, silent catch scan. Run: `python3 hooks/system_doctor.py` |
356
- | `tests/` | **84 pytest tests** covering block_dangerous, observation_capture, memory_db, pre_stop_check, mid_workflow_recall |
357
-
358
- ### Change Discipline (Hook-Enforced)
359
-
360
- | Discipline | Enforcement | How |
361
- |------------|-------------|-----|
362
- | **Blast Radius** | `post_edit_guard.py` stderr | When editing shared module, shows all files that import it |
363
- | **Fail Loud** | `post_edit_guard.py` block | Detects `except:pass` patterns, blocks commit |
364
- | **Verify After Change** | `post_edit_guard.py` stderr | Shows corresponding test file path when it exists |
365
- | **System Health** | `health_check.py` SessionStart | Catches missing agents, broken hooks, DB issues at session start |
366
-
367
- ---
368
-
369
- ## Quality Standards
370
-
371
- ### Pre-Delivery Quality Gates
372
-
373
- | Gate | Requirement |
374
- |------|-------------|
375
- | Anti-Pattern | No tautology, empty tests, core logic mocks |
376
- | Coverage Gaps | No HIGH priority untested functions |
377
- | E2E | All critical flows pass |
378
- | Performance | Core Web Vitals pass (frontend) |
379
- | Security | No critical/high vulnerabilities |
380
- | Ultra Review | MANDATORY `/ultra-review` with APPROVE or COMMENT verdict |
381
-
382
- ### Code Limits
383
-
384
- | Metric | Limit |
385
- |--------|-------|
386
- | Function lines | <= 50 |
387
- | File lines | 200-400 typical, 800 max |
388
- | Nesting depth | <= 4 |
389
- | Cyclomatic complexity | <= 10 |
390
-
391
- ---
392
-
393
- ## Project Structure
394
-
395
- ```
396
- ~/.claude/
397
- |-- CLAUDE.md # Main configuration (Priority Stack)
398
- |-- README.md # This file
399
- |-- settings.json # Claude Code settings + hooks config
400
- |
401
- |-- hooks/ # Automated enforcement (13 hooks, all with timeout)
402
- | |-- block_dangerous_commands.py # PreToolUse: dangerous bash commands (5s)
403
- | |-- post_edit_guard.py # PostToolUse: quality + mock + security unified (5s)
404
- | |-- observation_capture.py # PostToolUse: session observations (Edit/Write/Bash) (5s)
405
- | |-- user_prompt_capture.py # UserPromptSubmit: initial request capture (5s)
406
- | |-- session_context.py # SessionStart: load dev context + last session (10s)
407
- | |-- session_journal.py # Stop: auto-capture + AI summary daemon → SQLite + Chroma (5s)
408
- | |-- pre_stop_check.py # Stop: source change detection → suggest code-reviewer (5s)
409
- | |-- subagent_tracker.py # SubagentStart/Stop: lifecycle logging (5s)
410
- | |-- pre_compact_context.py # PreCompact: preserve context + freshness marker (10s)
411
- | |-- post_compact_inject.py # SessionStart(compact): post-compact context recovery (10s)
412
- | |-- hook_utils.py # Shared: snapshot path, workflow state, input parsing
413
- | |-- memory_db.py # Shared: SQLite FTS5 + Chroma vector engine + CLI tool
414
- |
415
- |-- commands/ # /ultra-* commands (9)
416
- | |-- ultra-init.md
417
- | |-- ultra-research.md
418
- | |-- ultra-plan.md
419
- | |-- ultra-dev.md
420
- | |-- ultra-test.md
421
- | |-- ultra-deliver.md
422
- | |-- ultra-status.md
423
- | |-- ultra-think.md
424
- | |-- learn.md
425
- |
426
- |-- skills/ # Domain skills (19 + learned)
427
- | |-- ultra-research/ # Step-file research architecture (v6.8.0)
428
- | | |-- SKILL.md # Orchestrator with step routing
429
- | | |-- steps/ # 17 step files (step-00 to step-99)
430
- | | |-- templates/ # Output templates (reserved)
431
- | |-- ultra-review/ # Parallel review orchestration
432
- | | |-- scripts/ # review_wait.py, review_verdict_update.py
433
- | |-- ultra-verify/ # Independent cross-model verification
434
- | | |-- references/ # cross-verify-modes, confidence-system, orchestration-flow
435
- | | |-- evals/ # skill-creator eval tests
436
- | |-- ai-collab-base/ # Shared collab protocol (non-user-invocable)
437
- | | |-- references/ # collab-protocol, collaboration-modes, prompt-templates
438
- | | |-- sync.sh # Sync canonical files to consumer skills
439
- | | |-- evals/ # skill-creator eval tests
440
- | |-- codex-collab/ # OpenAI Codex CLI as independent sub-agent
441
- | | |-- references/ # codex-cli-reference, codex-prompts, shared files
442
- | | |-- evals/ # skill-creator eval tests
443
- | |-- recall/ # Cross-session memory search
444
- | |-- code-review-expert/ # Structured review checklists (agent-only)
445
- | |-- integration-rules/ # System integration rules (agent-only)
446
- | |-- testing-rules/ # TDD rules (agent-only)
447
- | |-- security-rules/ # Security rules (agent-only)
448
- | |-- agent-browser/ # Browser automation CLI
449
- | |-- find-skills/ # Skill discovery and installation
450
- | |-- use-railway/ # Railway infrastructure operations
451
- | |-- vercel-react-best-practices/ # React/Next.js optimization
452
- | |-- vercel-react-native-skills/ # React Native/Expo best practices
453
- | |-- vercel-composition-patterns/ # React composition patterns
454
- | |-- web-design-guidelines/ # Web Interface Guidelines
455
- | |-- learned/ # Extracted patterns
456
- |
457
- |-- agents/ # Custom agents (12)
458
- | |-- smart-contract-specialist.md # Interactive
459
- | |-- smart-contract-auditor.md # Interactive
460
- | |-- code-reviewer.md # Interactive
461
- | |-- tdd-runner.md # Interactive
462
- | |-- debugger.md # Interactive
463
- | |-- review-code.md # Pipeline (ultra-review)
464
- | |-- review-tests.md # Pipeline (ultra-review)
465
- | |-- review-errors.md # Pipeline (ultra-review)
466
- | |-- review-design.md # Pipeline (ultra-review, merged types+simplify)
467
- | |-- review-comments.md # Pipeline (ultra-review)
468
- | |-- review-coordinator.md # Pipeline (ultra-review)
469
- |
470
- |-- .ultra/ # Project-level output (in each project, gitignored)
471
- | |-- memory/ # Cross-session memory (auto-managed)
472
- | | |-- memory.db # SQLite FTS5 session database
473
- | | |-- chroma/ # Chroma vector embeddings (ONNX)
474
- | | |-- sessions.jsonl # Append-only backup
475
- | |-- reviews/ # Ultra Review output (auto-managed)
476
- | | |-- index.json # Session index (branch-scoped)
477
- | | |-- <session-id>/ # Per-session findings
478
- | | |-- review-*.json
479
- | | |-- SUMMARY.json
480
- | | |-- SUMMARY.md
481
- | |-- collab/ # AI collaboration sessions (auto-managed)
482
- | | |-- <session-id>/ # Per-session output
483
- | | |-- claude-analysis.md
484
- | | |-- codex-output.md
485
- | | |-- synthesis.md
486
- | | |-- metadata.json
487
- | | |-- error.log
488
- | |-- compact-snapshot.md # Context recovery after compaction
489
- | |-- debug/ # Agent lifecycle logs
490
- | |-- subagent-log.jsonl
491
- |
492
- |-- .ultra-template/ # Project initialization templates
493
- |-- specs/ # discovery.md, product.md, architecture.md
494
- |-- tasks/
495
- |-- docs/
496
- ```
497
-
498
- ---
499
-
500
- ## Operational Config
501
-
502
- > These are operational settings, not principles. CLAUDE.md contains the principles.
503
-
504
- ### Git Workflow
505
-
506
- - Follow project branch naming conventions
507
- - Conventional Commits format
508
- - Include Co-author for AI commits:
509
- ```
510
- Co-Authored-By: Claude <noreply@anthropic.com>
511
- ```
512
-
513
- ### Project Structure
514
-
515
- ```
516
- New Ultra projects use:
517
- .ultra/
518
- |-- tasks/ # Task tracking
519
- |-- specs/ # Specifications (discovery.md, product.md, architecture.md)
520
- |-- docs/ # Project documentation
521
- |-- memory/ # Cross-session memory DB + Chroma + JSONL (auto-generated)
522
- |-- reviews/ # Ultra Review output (auto-generated)
523
- |-- compact-snapshot.md # Context recovery (auto-generated)
524
- |-- debug/ # Agent lifecycle logs (auto-generated)
525
- ```
526
-
527
- ### Learned Patterns
528
-
529
- Patterns extracted via `/learn` are stored in `skills/learned/`:
530
-
531
- | Confidence | File Suffix | Description |
532
- |------------|-------------|-------------|
533
- | Speculation | `_unverified` | Freshly extracted, needs verification |
534
- | Inference | No suffix | Human review passed |
535
- | Fact | No suffix + marked | Multiple successful uses |
536
-
537
- Priority: Fact > Inference > Speculation
538
-
539
- ### Workflow Tools
540
-
541
- Multi-step tasks use the Task system:
542
- - `TaskCreate`: Create new task
543
- - `TaskList`: View all tasks
544
- - `TaskGet`: Get task details
545
- - `TaskUpdate`: Update task status
546
-
547
- ---
548
-
549
- ## Version History
550
-
551
- ### v6.8.0 (2026-03-31) - Research Step-File Architecture
552
-
553
- **Core change**: Replaced monolithic `ultra-research.md` (491 lines) with **step-file architecture** inspired by [BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD) (42.9k stars).
554
-
555
- **What changed**:
556
- - `skills/ultra-research/SKILL.md` — orchestrator with step routing and project type detection
557
- - `skills/ultra-research/steps/step-{00-99}.md` — 17 self-contained step files (3122 lines total, ~200 lines/step)
558
- - Each step has: MANDATORY RULES, SEARCH STRATEGY (pre-written queries), OUTPUT TEMPLATE (field-level structure), SUCCESS METRICS, FAILURE MODES
559
- - `step-99-synthesis.md` — generates `research-distillate.md` (token-efficient summary for /ultra-plan)
560
- - `commands/ultra-research.md` — slimmed to 60-line router pointing to SKILL.md
561
-
562
- **Why**: Previous single-file approach had ~16 lines of instruction per step. LLM attention was diluted across 5 Rounds. Now each step gets focused, dense instructions → **~11x instruction density increase**.
563
-
564
- **Key improvements**: Mandatory web search with pre-written queries per step | Structured output templates with field-level specs | Write-immediately discipline (no context loss) | [C] Continue user gates | Research distillate for /ultra-plan consumption | Field-level spec validation in /ultra-plan
565
-
566
- **Updated files** (8): `commands/ultra-research.md`, `commands/ultra-init.md`, `commands/ultra-plan.md`, `.ultra-template/specs/discovery.md`, `.ultra-template/specs/product.md`, `.ultra-template/specs/architecture.md`, `settings.json`, `README.md`
567
-
568
- **New files** (18): `skills/ultra-research/SKILL.md` + 17 step files in `skills/ultra-research/steps/`
569
-
570
- ### v6.5.0 (2026-03-20) - Product Velocity Fusion
571
-
572
- **Fast product iteration + engineering discipline**, inspired by [garrytan/gstack](https://github.com/garrytan/gstack) context engineering patterns:
573
-
574
- **Product Thinking Layer**:
575
- - `/ultra-research` Round 0.0: **Problem Validation with 6 Forcing Questions** — Demand Reality, Status Quo, Desperate Specificity, Narrowest Wedge, Observation & Surprise, Future-Fit. Smart routing by product stage (pre-product/has users/paying/engineering)
576
- - `/ultra-plan` Step 0: **Scope Mode Selection** — EXPAND (think bigger), SELECTIVE (cherry-pick expansions), HOLD (make bulletproof), REDUCE (cut to minimum). Commitment rule: no silent drift
577
-
578
- **Review Acceleration**:
579
- - `review-code` agent Step 0: **Scope Drift Detection** — compares stated intent (tasks/branch/commits) vs actual diff, detects scope creep (P1) and missing requirements (P0)
580
- - `code-reviewer` agent: **Fix-First dual mode** — `report` (findings only) and `fix` (AUTO-FIX mechanical issues, ASK judgment calls). Now has Write/Edit tools
581
- - Unified schema: new `scope-drift` and `spec-compliance` categories
582
-
583
- **CLAUDE.md Enhancements**:
584
- - `<ask_user_format>`: standardized AskUserQuestion format (re-ground context, simplify, recommend, options, dual-scale effort)
585
- - **Completeness Principle**: KISS decides WHAT to build; Completeness decides HOW THOROUGH. No half-finished features
586
- - `<red_flags>` + `<verification>`: new Completeness row and "Scope correct" verification
587
- - `<work_style>`: proactive stage detection (suggest skills based on user's current phase)
588
-
589
- **Stop Hook Simplification**:
590
- - `pre_stop_check.py`: 474 → 154 lines. Three-layer → two-layer check
591
- - Removed: review artifact scanning, security file detection, incomplete work patterns, /ultra-review routing
592
- - Kept: circuit breaker + source file change detection → unified code-reviewer suggestion
593
- - Design: complex audits are user's responsibility via `/ultra-review`
594
-
595
- **Enhanced Files** (8): `CLAUDE.md`, `agents/review-code.md`, `agents/code-reviewer.md`, `commands/ultra-research.md`, `commands/ultra-plan.md`, `hooks/pre_stop_check.py`, `skills/ultra-review/references/unified-schema.md`, `README.md`
596
-
597
- ### v6.3.0 (2026-03-09) - Memory System v2
598
-
599
- **Structured summaries, real session identity, security hardening**, verified by repeated independent review:
600
-
601
- **Schema v2 Migration**:
602
- - New `session_summaries` table: structured JSON fields (`request`, `completed`, `learned`, `next_steps`)
603
- - New `observations` table: file changes (Edit/Write) + test failures (Bash), max 20/session, deduped by content hash
604
- - New `summaries_fts` FTS5 index over structured summaries for fast text search
605
- - `sessions` table: added `content_session_id`, `initial_request` columns
606
-
607
- **Real Session Identity**:
608
- - `content_session_id` from hook protocol replaces merge-window-based ID (fixed stop_count=4306 bug)
609
- - `stop_hook_active=true` re-triggers skip DB write entirely
610
-
611
- **AI Summary Upgrade**:
612
- - Model: Haiku (cost-effective, structured output) with `max_tokens=1000`
613
- - Output: structured JSON `{request, completed, learned, next_steps}` — pipe-separated bullets per field
614
- - Stored in `session_summaries` table (structured) + `sessions.summary` (legacy compat)
615
-
616
- **New Hooks (2)**:
617
- - `user_prompt_capture.py` (UserPromptSubmit): captures initial user request per session
618
- - `observation_capture.py` (PostToolUse): captures file changes and test failures as session observations
619
-
620
- **Proactive Recall Upgrade**:
621
- - SessionStart: last session one-liner + up to 3 branch-relevant structured summaries
622
- - PreCompact: `LEFT JOIN session_summaries` for structured summary preference
623
-
624
- **Security Hardening**:
625
- - Path validation, SQL allowlist, daemon error logging, dead code removal
626
-
627
- **Enhanced Files** (8):
628
- - `hooks/session_journal.py`, `hooks/memory_db.py`, `hooks/session_context.py`, `hooks/pre_compact_context.py`
629
- - `hooks/user_prompt_capture.py` (New), `hooks/observation_capture.py` (New)
630
- - `CLAUDE.md`, `README.md`
631
-
632
- ### v6.1.0 (2026-03-08) - Product Discovery Round 0
633
-
634
- **Product Discovery & Strategy phase** — fills the gap between vague ideas and technical specification. Inspired by [phuryn/pm-skills](https://github.com/phuryn/pm-skills) frameworks:
635
-
636
- - New Round 0 in `/ultra-research` with 5 sub-steps:
637
- - **Opportunity Discovery**: OST framework (Teresa Torres), Opportunity Score prioritization (Dan Olsen)
638
- - **Market Assessment**: TAM/SAM/SOM dual estimation (top-down + bottom-up), WebSearch for real data
639
- - **Competitive Landscape**: Comparison matrix + Porter's Five Forces brief
640
- - **Product Strategy**: Condensed Strategy Canvas (Vision/Segments/Value Prop/Trade-offs/Defensibility)
641
- - **Assumptions & Validation Plan**: Risk categorization (Value/Usability/Feasibility/Viability/GTM) + experiment design (Pretotyping, Alberto Savoia)
642
- - New `discovery.md` spec template in `.ultra-template/specs/`
643
- - Updated `/ultra-init` and `/ultra-plan` to reference `discovery.md`
644
- - Round 0 is **optional** — auto-skipped for Feature Only mode or when market research already exists
645
- - New project type options: "Full Project" (R0-4), "Product Only" (R0-2)
646
-
647
- ### v6.0.0 (2026-03-07) - Consolidation Release
648
-
649
- **System consolidation, cleanup, and Multi-AI collaboration**:
650
-
651
- - New `codex-collab` skill: OpenAI Codex CLI as sub-agent with built-in `codex review` integration
652
- - Removed codex skill and all references (CLAUDE.md, README.md, skills/codex/)
653
- - Stop hook hardening: removed main branch bypass, fixed git status path truncation
654
- - Comprehensive hook audit: 20 fixes, model unification, 2 new hooks (Notification, SessionEnd)
655
- - Ultra-think rewrite: adversarial reasoning framework
656
- - All 12 agents unified to opus model
657
- - Session summary model upgraded to opus
658
- - Post-compact context injection via SessionStart(compact) hook
659
- - Permission cleanup: removed obsolete tools, added missing tools
660
-
661
- ### v5.9.2 (2026-03-05) - Hook Audit & Model Unification
662
-
663
- **Comprehensive hook audit against official docs + community best practices + model unification**:
664
-
665
- **Model Unification**:
666
- - All 12 agents unified to `opus` model (fixed `code-reviewer`/`debugger` inherit, `tdd-runner` haiku)
667
- - AI summary daemon upgraded from Sonnet to Opus (session_journal.py)
668
-
669
- **Hook Audit (20 fixes across 3 tiers)**:
670
- - **Protocol compliance**: 100% — all hooks follow official Claude Code hook protocol
671
- - **Security**: fail-closed patterns, DAEMON_ENV_WHITELIST, env sanitization
672
- - **Performance**: all GIT_TIMEOUT values < hook timeout (session_context.py 10→3s safety fix)
673
- - **Shared utilities**: `hook_utils.py` eliminates ~130 lines of duplication across hooks
674
-
675
- **New Hooks (2)**:
676
- - `Notification`: macOS desktop alert with sound when Claude needs user input (permission_prompt/idle_prompt)
677
- - `SessionEnd`: Automatic cleanup of stale stop-count temp files (>60min old)
678
-
679
- **Protocol Fixes**:
680
- - `pre_stop_check.py`: Added `stop_hook_active` fast path (Layer 0a) per official docs — prevents infinite Stop hook loops
681
- - `session_journal.py`: Fixed stale docstring (Sonnet → Opus), added `stop_hook_active` re-trigger guard
682
-
683
- **Enhanced Files** (10):
684
- - All 10 hook `.py` files audited and updated
685
- - `settings.json`: +Notification hook, +SessionEnd hook
686
- - `README.md`: Updated hook count, model references, hooks system section
687
-
688
- ### v5.9.1 (2026-03-04) - Hook Hardening + Post-Compact Recovery
689
-
690
- **Stop Hook Hardening + Post-Compact Context Recovery + Permission Cleanup**:
691
-
692
- **Post-Compact Context Recovery (New)**:
693
- - `post_compact_inject.py`: New `SessionStart(compact)` hook — injects ~800 tokens of recovery context after auto-compact
694
- - Parses `compact-snapshot.md` to extract git state, active tasks, workflow progress, session memory
695
- - Freshness check: marker file (written by PreCompact) → mtime fallback → stale hint
696
- - `pre_compact_context.py`: Added marker file write (`/tmp/.claude_compact_ts`) for post-compact freshness detection
697
-
698
- **Stop Hook Hardening**:
699
- - `pre_stop_check.py`: Three-layer → four-layer check, added `last_assistant_message` parsing for incomplete work detection (TODO/FIXME/WIP patterns)
700
- - Added `stop_hook_active` loop guard (prevents Stop hook re-trigger from its own block message)
701
- - Added security-sensitive file detection (auth/payment/token/credential/session path matching)
702
- - Restored code-reviewer suggestion in block messages (lost in prior refactor)
703
- - `session_journal.py`: Added `stop_hook_active` check, skips AI summary daemon spawn on re-trigger
704
-
705
- **Permission Cleanup**:
706
- - Removed `AskUserQuestion` from allow list (fixed UI not displaying — allow caused auto-skip)
707
- - Added 8 missing tools: Agent, TaskOutput, TaskStop, TeamCreate, TeamDelete, SendMessage, EnterWorktree
708
- - Removed 4 obsolete entries: Task, SlashCommand, BashOutput, KillShell
709
-
710
- **Enhanced Files** (5):
711
- - `hooks/post_compact_inject.py` (New), `hooks/pre_compact_context.py`, `hooks/pre_stop_check.py`, `hooks/session_journal.py`, `settings.json`
712
-
713
- ### v5.9.0 (2026-03-02) - Process Discipline Fusion
714
-
715
- **Superpowers Process Discipline Fusion** — absorbed key process principles from the Superpowers project, closing 3 process gaps:
716
-
717
- **Design Approval Gate (P0)**:
718
- - `ultra-dev.md`: Added Step 0.5 — displays task breakdown overview on first run, requires user confirmation before implementation
719
- - Prevents "Wrong Approach" (#1 remaining friction): user must review plan before writing code
720
- - Auto-skipped on resume (already approved)
721
-
722
- **Spec Compliance Check (P1)**:
723
- - `ultra-dev.md`: Added Quality Gate #7 — verifies each acceptance criterion is implemented and tested
724
- - `review-code.md`: Added Step 7 — infers task ID from branch name, reads task context, validates spec compliance
725
- - Added `spec-compliance` category (P0: missing, P1: partially implemented, P2: edge cases uncovered)
726
-
727
- **3-Fix Circuit Breaker (P1)**:
728
- - `ultra-review SKILL.md`: Added per-file fix counter in Fix Flow
729
- - Same file fails 3 consecutive fixes → circuit break, request user decision (skip/manual/abort)
730
- - 3+ files circuit-broken globally → suggest architecture discussion, tag `ARCHITECTURAL_CONCERN`
731
-
732
- **Systematic Debugging Methodology (P2)**:
733
- - `debugger.md`: 5-step simple flow → 4-phase structured methodology
734
- - Phase 1 (Root Cause Investigation) enforced, IRON LAW: no fix proposals before investigation complete
735
- - 3-Fix Rule: 3 consecutive fix failures → stop, report architectural issue
736
- - Red Flags table: detect common shortcut thinking and force return to Phase 1
737
-
738
- **Enhanced Files** (4 core + 2 meta):
739
- - `commands/ultra-dev.md`, `agents/review-code.md`, `skills/ultra-review/SKILL.md`, `agents/debugger.md`
740
- - `CLAUDE.md`, `README.md`, `settings.json`
741
-
742
- ### v5.8.1 (2026-02-28) - System-Level Optimization
743
-
744
- **Context Protection + Pipeline Reliability + Workflow Resilience** — targeting 65% → 80%+ completion rate based on 285-session usage analysis:
745
-
746
- **Context Window Protection**:
747
- - `ultra-dev.md`: Review iteration cap (MAX_REVIEW_ITERATIONS = 2), unresolved findings → UNRESOLVED.md
748
- - `ultra-review SKILL.md`: CRITICAL PROHIBITION — never call TaskOutput for review agents; findings cap 15/agent
749
- - `post_edit_guard.py`: Hook output compression (~70%), WARN/HIGH patterns deferred to review-code agent
750
- - Agent maxTurns reduction: review-errors/types/simplify 20→15, review-comments 20→12
751
-
752
- **Pipeline Reliability**:
753
- - `ultra-dev.md`: Pre-review `/compact` checkpoint (Step 4.4); workflow state checkpoint at steps 3.3/4/4.5/6
754
- - `review_wait.py`: Structured JSON output with partial success (≥1 agent = success)
755
- - `ultra-review SKILL.md`: Incremental per-file fix-test flow; Step 0 context reset before fix phase
756
-
757
- **Workflow Resilience**:
758
- - `ultra-dev.md`: Step 0 resume check reads `.ultra/workflow-state.json`, skips completed steps
759
- - `pre_compact_context.py`: Active Workflow section + RESUME line in compact hint
760
-
761
- **CLAUDE.md Optimization**: ~365 → ~280 lines (~25% reduction, zero information loss)
762
-
763
- **Enhanced Files** (9):
764
- - `commands/ultra-dev.md`, `skills/ultra-review/SKILL.md`, `hooks/post_edit_guard.py`
765
- - `skills/ultra-review/scripts/review_wait.py`, `hooks/pre_compact_context.py`
766
- - `agents/review-errors.md`, `agents/review-design.md`, `agents/review-comments.md`
767
-
768
- ### v5.8.0 (2026-02-20) - AI Summarization + Vector Search
769
-
770
- **AI-Powered Memory Upgrade** — transcript-based summaries, semantic vector search, hybrid retrieval, and forked recall context:
771
-
772
- **Enhanced Files**:
773
- - `hooks/session_journal.py`: +AI summarization via double-fork daemon (non-blocking, 10s delay)
774
- - Transcript parsing: extracts user/assistant text from JSONL, dedupes streaming chunks
775
- - Three-tier fallback: `claude -p --model opus` → Anthropic SDK → git commit messages
776
- - Daemon clears `CLAUDE*` env vars to avoid inheriting parent session config
777
- - Auto-upserts Chroma embedding after AI summary generation
778
- - CLI: `--ai-summarize <session_id> <transcript_path>` for manual re-summarize
779
- - `hooks/memory_db.py`: +Chroma vector search engine (PersistentClient + local ONNX ONNXMiniLM_L6_V2)
780
- - `upsert_embedding()`: doc = summary + branch + top 5 files (~256 tokens)
781
- - `semantic_search()`: pure vector search via Chroma
782
- - `hybrid_search()`: RRF (k=60) fusion of FTS5 keyword + Chroma semantic
783
- - `reindex_chroma()`: backfill existing sessions into Chroma
784
- - CLI commands: `semantic`, `hybrid`, `reindex-chroma`
785
- - `skills/recall/SKILL.md`: +`context: fork` (search results don't pollute main conversation)
786
- - Default search: hybrid (FTS5 + semantic RRF)
787
- - New modes: `--semantic` (pure vector), `--keyword` (pure FTS5)
788
- - Progressive retrieval strategy: search → expand query → synthesize
789
-
790
- **Dependencies**: chromadb 1.5.0 (local ONNX embeddings, no API key required)
791
-
792
- **Design Principle**: Same as v5.7.0 — auto-capture, on-demand retrieval, no bulk injection. AI summarization runs async after session stop, never blocking the hot path.
793
-
794
- ### v5.7.0 (2026-02-16) - Cross-Session Memory
795
-
796
- **Cross-Session Memory System** — lightweight auto-capture + on-demand retrieval, designed as safe alternative to claude-mem:
797
-
798
- **New Files**:
799
- - `hooks/memory_db.py`: SQLite FTS5 storage engine + CLI tool (dual-use library)
800
- - `hooks/session_journal.py`: Stop hook auto-captures branch/files/commits per session
801
- - `skills/recall/SKILL.md`: `/recall` skill for on-demand memory search, summaries, tags
802
-
803
- **Enhanced Files**:
804
- - `hooks/session_context.py`: +last session one-liner injection at SessionStart (~50 tokens)
805
- - `CLAUDE.md`: +`<session_memory>` block with proactive recall trigger rules
806
- - `settings.json`: +session_journal.py in Stop hooks
807
-
808
- **Design Principles**:
809
- - Auto-capture at Stop, on-demand retrieval via `/recall` — no bulk SessionStart injection
810
- - Zero external dependencies (Python stdlib + SQLite FTS5)
811
- - 30-minute merge window: multiple stops within same session merge into one record
812
- - Auto-summary from git commit messages (no AI needed), manual override via `/recall --save`
813
- - 90-day retention policy with `/recall --cleanup`
814
-
815
- **Learned from claude-mem failure**: claude-mem injected ~25k tokens at SessionStart causing context explosion. Our approach: inject 1 line (~50 tokens), search on-demand.
816
-
817
- **Ultra Review Improvements**:
818
- - Background execution: all review agents run with `run_in_background: true` (~535 tokens vs ~7000+)
819
- - File-based waiting: `review_wait.py` polls for completion instead of TaskOutput reads
820
- - Verdict update: `review_verdict_update.py` auto-updates SUMMARY.json + index.json after P0 fixes
821
- - Pre-stop fix: skip code-change fallback on main/master (merged code already reviewed), remove instructional language from block messages to prevent AI re-trigger
822
- - Scripts moved from `hooks/` to `skills/ultra-review/scripts/` (proper ownership)
823
-
824
- ### v5.6.1 (2026-02-14) - Project Isolation
825
-
826
- **Project-Level Artifact Isolation** — all per-project output moved from global `~/.claude/` to project-level `.ultra/`:
827
-
828
- | Artifact | Old (global) | New (project-level) |
829
- |----------|-------------|---------------------|
830
- | Review output | `~/.claude/reviews/` | `.ultra/reviews/` |
831
- | Review index | `~/.claude/reviews/index.json` | `.ultra/reviews/index.json` |
832
- | Compact snapshot | `~/.claude/compact-snapshot.md` | `.ultra/compact-snapshot.md` |
833
- | Subagent logs | `~/.claude/debug/subagent-log.jsonl` | `.ultra/debug/subagent-log.jsonl` |
834
- | Agent memory | `~/.claude/agent-memory/` (global) | `projects/<hash>/agent-memory/` (project) |
835
-
836
- **Why**: Global storage caused cross-project pollution — pre_stop_check false positives from other projects' reviews, compact-snapshot restoring wrong project context, agent memory carrying irrelevant architecture knowledge.
837
-
838
- **Changes**:
839
- - 3 hooks updated with `git rev-parse --show-toplevel` detection + safe fallback for non-git environments
840
- - All 12 agents switched from `memory: user` to `memory: project`
841
- - `.gitignore` updated to exclude `.ultra/reviews/`, `.ultra/compact-snapshot.md`, `.ultra/debug/`
842
-
843
- **Audit Fixes**:
844
- - `pre_compact_context.py`: Added `mkdir -p` before writing snapshot (prevents silent failure when `.ultra/` doesn't exist)
845
- - `settings.json`: Co-Authored-By removed hardcoded model version (aligned with CLAUDE.md)
846
- - `settings.json`: Version comments updated to 5.6.1, removed redundant `mcp__pencil` permission
847
-
848
- ### v5.6.0 (2026-02-14) - System Integration Dimension
849
-
850
- **System Integration Dimension** — macro-level integration guarantees complementing existing micro-level component quality:
851
-
852
- **New CLAUDE.md Rules**:
853
- - `<integration>` block: Vertical Slice, Walking Skeleton, Contract-First, Integration Proof, Orphan Detection
854
- - `<testing>`: Cross-boundary contract/E2E test layer
855
- - `<forbidden_patterns>`: Horizontal-only tasks, unwired components, missing contract tests
856
- - `<red_flags>`: "I'll wire it up later", "It works in isolation", etc.
857
- - `<verification>`: "Feature complete" requires E2E test, "Component works" requires entry point trace
858
-
859
- **New Skill: `integration-rules`** (agent-only):
860
- - Vertical slice principle with good/bad examples
861
- - Walking skeleton requirements
862
- - Contract-first development workflow
863
- - Integration test requirements per boundary type
864
- - Orphan detection checklist
865
- - Injected into `review-code` and `code-reviewer` agents
866
-
867
- **New Reference: `integration-checklist.md`**:
868
- - Entry point tracing, contract validation, vertical slice assessment
869
- - Integration test coverage matrix, data flow continuity checks
870
- - Added to `code-review-expert` as Step 5.5
871
-
872
- **Enhanced Agents**:
873
- - `review-code`: +integration-rules skill, +step 6 integration review, +4 severity rows (orphan P1, missing integration test P1, horizontal-only P2, missing contract P2)
874
- - `code-reviewer`: +integration-rules skill, +integration checks in Additional Checks
875
- - `review-tests`: +boundary-crossing detection, +2 severity rows
876
-
877
- **Enhanced Workflows**:
878
- - `ultra-plan`: Walking skeleton as Task #1 (P0), contract definition tasks, integration checkpoints every 3-4 tasks, vertical slice validation
879
- - `ultra-dev`: Integration test dimension in RED phase, integration quality gates, pre-commit orphan/integration checklist
880
-
881
- **Schema**: `integration` category added to unified-schema-v1 Category Enum
882
-
883
- **Zero additional cost**: Integration checks folded into existing review-code agent via skill injection — no new review agent needed.
884
-
885
- ### v5.5.1 (2026-02-14) - Codex v6.0 + Review Enhancements
886
-
887
- - Codex v6.0 integration
888
- - `/ultra-review all` mode (force all 6 agents, no auto-skip)
889
- - `pre_stop_check.py` marker-based escape hatch (block once, allow on second attempt)
890
-
891
- ### v5.5.0 (2026-02-14) - Ultra Review System
892
-
893
- **Ultra Review System** — native parallel code review pipeline:
894
-
895
- **New Review Pipeline (7 agents)**:
896
- - `review-code`: CLAUDE.md compliance, code quality, architecture
897
- - `review-tests`: Test quality, mock violations, coverage gaps
898
- - `review-errors`: Silent failures, empty catches, swallowed errors
899
- - `review-design`: Type design, encapsulation, complexity analysis (merged types+simplify)
900
- - `review-comments`: Stale, misleading, or low-value comments
901
- - `review-coordinator`: Aggregate findings, deduplicate, generate SUMMARY
902
-
903
- **New Skill: `/ultra-review`**:
904
- - Modes: full, all, quick, security, tests, recheck, delta, custom
905
- - Scope options: `--pr NUMBER`, `--range RANGE`
906
- - Session tracking with branch-scoped index.json and iteration chains
907
- - Lifecycle management: auto-cleanup by age (7d/30d) and per-branch cap (5)
908
- - Verdict logic: P0 > 0 or P1 > 3 = REQUEST_CHANGES, P1 > 0 = COMMENT, else APPROVE
909
- - Fix flow: auto-fix P0/P1, re-test, recheck cycle
910
-
911
- **New Skill: `code-review-expert`** (agent-only):
912
- - Structured review checklists: SOLID, security, performance, boundary conditions
913
- - Injected into code-reviewer agent via frontmatter
914
-
915
- **Enhanced: `pre_stop_check.py`**:
916
- - Three-layer check: review artifacts (index.json branch-scoped) + incomplete session grace period + code change marker fallback
917
- - Recency guard: only considers sessions < 2 hours old
918
- - Incomplete session < 15min: warn only (agents may still be running)
919
- - Incomplete session >= 15min: marker-based block (block once, allow on second attempt)
920
- - P0/P1 block: marker-based escape hatch (block once, allow on second attempt)
921
- - REQUEST_CHANGES without P0: also blocks with marker escape
922
-
923
- **Enhanced: `/ultra-dev` Step 4.5**:
924
- - `/ultra-review all` invocation (forced full coverage)
925
- - 3-phase flow: Run review > Act on verdict > Verification gate
926
-
927
- **CLAUDE.md Updates**:
928
- - `agent_system`: Listed all 12 agents (5 interactive + 7 pipeline)
929
- - Added ultra-review and code-review-expert to skills
930
- - Added review pipeline to auto-trigger table
931
-
932
- ### v5.4.1 (2026-02-08) - Hooks Hardening
933
-
934
- **Hooks Refactoring**:
935
- - Merged 3 PostToolUse hooks (`code_quality.py`, `mock_detector.py`, `security_scan.py`) into unified `post_edit_guard.py`
936
- - Removed `branch_protection.py`, simplified `pre_stop_check.py`
937
- - 9 hooks -> 6 hooks (less overhead per tool call)
938
-
939
- **Reliability Fix**:
940
- - Added `timeout` to all hooks (5s default, 10s for SessionStart/PreCompact)
941
- - Prevents UI freeze when hook scripts stall
942
- - Fixed non-dict JSON input handling in `subagent_tracker.py`
943
-
944
- ### v5.4.0 (2026-02-07) - Agent & Memory Edition
945
-
946
- **New Agents (3)**:
947
- - `code-reviewer`: Code review specialist with security-rules skill injection
948
- - `tdd-runner`: Test execution specialist (Haiku model, project memory) with testing-rules injection
949
- - `debugger`: Root cause analysis specialist with Edit capability
950
-
951
- **Agent Memory**: All agents now have persistent memory (`memory: project` since v5.6.1)
952
- - Accumulates patterns, common issues, and architectural decisions per project
953
- - Each agent loads its MEMORY.md at startup
954
-
955
- **New Skills (2, agent-only)**:
956
- - `testing-rules`: TDD discipline, forbidden mock patterns, coverage requirements
957
- - `security-rules`: Input validation, injection prevention, security review checklist
958
-
959
- **New Hooks (3)**:
960
- - `subagent_tracker.py`: SubagentStart/Stop lifecycle logging to JSONL
961
- - `pre_compact_context.py`: PreCompact context preservation (tasks + git state)
962
-
963
- **Agent Teams**: Enabled experimental `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`
964
-
965
- **CLAUDE.md Updates**:
966
- - `agent_system`: Added task-type auto-triggers, updated agent/skill/hook counts
967
- - `work_style`: Added Parallel Delegation, Pre-delegation, Context Isolation protocols
968
-
969
- ### v5.3.0 (2026-02-01) - Lean Architecture Edition
970
-
971
- **Philosophy**: Apply Anthropic's "Start simple, add complexity only when simpler solutions fall short."
972
-
973
- **Removed (redundant - Claude handles natively)**:
974
- - Agents: build-error-resolver, doc-updater, e2e-runner, frontend-developer, refactor-cleaner
975
- - Skills: promptup, skill-creator
976
- - Hooks: user_prompt_agent.py (routing), agent_reminder.py (routing)
977
-
978
- **Improved**:
979
- - All hooks: standardized error handling (catch -> stderr log -> safe pass-through)
980
- - pre_stop_check: added git timeout, marker cleanup, error logging
981
- - Reduced per-request token overhead (no more routing hook noise)
982
-
983
- **Architecture**: CLAUDE.md + Commands + Quality Hooks (three-layer, no bloat)
984
-
985
- ### v5.2.2 (2026-01-29) - Codex Purification Edition
986
-
987
- **CLAUDE.md Refactoring**:
988
- - Removed operational config (moved to README)
989
- - Removed specific library names
990
- - Removed specific agent/skill names
991
- - Result: 322 -> 272 lines (-15%)
992
- - CLAUDE.md is now pure principles only
993
-
994
- ### v5.2.1 (2026-01-29) - Hooks Optimization Edition
995
-
996
- **New Hooks (3 new)**:
997
- - `block_dangerous_commands.py`: PreToolUse - Block rm -rf, fork bombs, chmod 777, force push main
998
- - `session_context.py`: SessionStart - Load git context at session start
999
-
1000
- **Enhanced Detection (aligned with CLAUDE.md 100%)**:
1001
- - `mock_detector.py`: Add it.skip/test.skip detection, allow UI handler mocks
1002
- - `code_quality.py`: Add hardcoded URL/port, static state, local file detection
1003
- - `security_scan.py`: Add catch(e){return null}, catch(e){console.log(e)}, generic Error detection
1004
-
1005
- **Improved Prompts**:
1006
- - Layer-specific solutions (Functional Core vs Imperative Shell)
1007
- - CLAUDE.md line references for each rule
1008
- - Smart false positive reduction (skip config files, comments)
1009
-
1010
- **Hook Output Fixes**:
1011
- - Fix field names: `tool` -> `tool_name`, `tool_result` -> `tool_response`
1012
- - Fix Stop hook format (no additionalContext support)
1013
- - Add `decision: block` for CRITICAL issues
1014
-
1015
- ### v5.2.0 (2026-01-28) - Hooks Enforcement Edition
1016
-
1017
- **New Hooks System (6 Python hooks)**:
1018
- - `mock_detector.py`: BLOCK jest.fn(), InMemoryRepository patterns
1019
- - `code_quality.py`: BLOCK TODO/FIXME/NotImplementedError
1020
- - `security_scan.py`: BLOCK hardcoded secrets, SQL injection, empty catch
1021
- - `agent_reminder.py`: Suggest agents based on file type/path
1022
- - `user_prompt_agent.py`: Suggest agents based on user intent
1023
- - `pre_stop_check.py`: Remind to review before session end
1024
-
1025
- **Enforcement Features**:
1026
- - Auto-BLOCK on CLAUDE.md rule violations
1027
- - Auto-trigger agents based on context
1028
- - Smart contract files -> BOTH specialist + auditor (MANDATORY)
1029
- - Auth/payment paths -> code-reviewer (MANDATORY)
1030
-
1031
- **Architecture Changes**:
1032
- - Hooks enforce rules (not just suggest)
1033
- - settings.json hook configuration
1034
- - CLAUDE.md agent_system block updated
1035
-
1036
- ### v5.0.0 (2026-01-26) - Agent System Edition
1037
-
1038
- **New Agent System (10 custom agents)**:
1039
- - `architect`: System architecture expert
1040
- - `planner`: Implementation planning expert
1041
- - `tdd-guide`: TDD workflow expert
1042
- - `build-error-resolver`: Build error fix specialist
1043
- - `e2e-runner`: E2E testing expert
1044
- - `frontend-developer`: React/Web3 UI development
1045
- - `refactor-cleaner`: Dead code cleanup
1046
- - `doc-updater`: Documentation maintenance
1047
- - `smart-contract-specialist`: Solidity development
1048
- - `smart-contract-auditor`: Contract security audit
1049
-
1050
- **New Features**:
1051
- - `/learn` command for pattern extraction
1052
- - `skills/learned/` directory for extracted patterns
1053
- - Confidence levels: Speculation -> Inference -> Fact
1054
-
1055
- ### v4.5.1 (2026-01-07) - PromptUp Edition
1056
-
1057
- **PromptUp Skill** (renamed from `senior-prompt-engineer`):
1058
- - Replaced hardcoded templates with 6 evidence-based principles
1059
- - Added boundary detection (when NOT to use prompt engineering)
1060
- - Mapped to Claude Code capabilities (Context7/Exa MCP, CLAUDE.md, skills)
1061
-
1062
- ### v4.5.0 (2026-01-07) - Agent Architecture Edition
1063
-
1064
- **Skills Refactoring**:
1065
- - Removed `backend`, `frontend`, `smart-contract` domain skills
1066
- - Added `promptup` skill for prompt engineering
1067
-
1068
- **New Agent System (4 agents)**:
1069
- - `backend-architect`, `frontend-developer`
1070
- - `smart-contract-specialist`, `smart-contract-auditor`
1071
-
1072
- ### v4.4.0 (2026-01-01) - Streamlined Edition
1073
-
1074
- **Core Changes**:
1075
- - Unified Priority Stack in CLAUDE.md
1076
- - Codex skill integration
1077
- - Anti-Pattern Detection in `/ultra-test`
1078
-
1079
- ---
1080
-
1081
- ## MCP Services
1082
-
1083
- Ultra Builder Pro integrates with these MCP services:
1084
-
1085
- | Service | Purpose |
1086
- |---------|---------|
1087
- | Context7 | Official documentation lookup |
1088
- | Exa | Code examples and community practices |
1089
- | Chrome | E2E testing and web automation |
1090
-
1091
- ---
1092
-
1093
- ## License
1094
-
1095
- MIT
1096
-
1097
- ---
1098
-
1099
- *Ultra Builder Pro: No mock. No demo. No MVP. Production-grade only.*