id3-cli 0.9.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 (114) hide show
  1. package/README.ja-JP.md +769 -0
  2. package/README.ko-KR.md +769 -0
  3. package/README.md +769 -0
  4. package/README.tr-TR.md +769 -0
  5. package/README.zh-CN.md +769 -0
  6. package/dist/bin/cli.d.ts +2 -0
  7. package/dist/bin/cli.js +40 -0
  8. package/dist/bin/cli.js.map +1 -0
  9. package/dist/scripts/build-hooks.d.ts +1 -0
  10. package/dist/scripts/build-hooks.js +58 -0
  11. package/dist/scripts/build-hooks.js.map +1 -0
  12. package/dist/src/hooks/auto-audit.d.ts +4 -0
  13. package/dist/src/hooks/auto-audit.js +47 -0
  14. package/dist/src/hooks/auto-audit.js.map +1 -0
  15. package/dist/src/hooks/claude-pretool-entry.d.ts +1 -0
  16. package/dist/src/hooks/claude-pretool-entry.js +36 -0
  17. package/dist/src/hooks/claude-pretool-entry.js.map +1 -0
  18. package/dist/src/hooks/claude-stop-entry.d.ts +1 -0
  19. package/dist/src/hooks/claude-stop-entry.js +7 -0
  20. package/dist/src/hooks/claude-stop-entry.js.map +1 -0
  21. package/dist/src/hooks/post-commit-entry.d.ts +1 -0
  22. package/dist/src/hooks/post-commit-entry.js +7 -0
  23. package/dist/src/hooks/post-commit-entry.js.map +1 -0
  24. package/dist/src/hooks/pre-commit-entry.d.ts +1 -0
  25. package/dist/src/hooks/pre-commit-entry.js +16 -0
  26. package/dist/src/hooks/pre-commit-entry.js.map +1 -0
  27. package/dist/src/hooks/rule-check.d.ts +8 -0
  28. package/dist/src/hooks/rule-check.js +101 -0
  29. package/dist/src/hooks/rule-check.js.map +1 -0
  30. package/dist/src/hooks/schema-drift.d.ts +17 -0
  31. package/dist/src/hooks/schema-drift.js +151 -0
  32. package/dist/src/hooks/schema-drift.js.map +1 -0
  33. package/dist/src/hooks/shared.d.ts +43 -0
  34. package/dist/src/hooks/shared.js +98 -0
  35. package/dist/src/hooks/shared.js.map +1 -0
  36. package/dist/src/init.d.ts +20 -0
  37. package/dist/src/init.js +193 -0
  38. package/dist/src/init.js.map +1 -0
  39. package/dist/src/preview/mockup-generator.d.ts +56 -0
  40. package/dist/src/preview/mockup-generator.js +402 -0
  41. package/dist/src/preview/mockup-generator.js.map +1 -0
  42. package/dist/src/preview/renderer.d.ts +30 -0
  43. package/dist/src/preview/renderer.js +145 -0
  44. package/dist/src/preview/renderer.js.map +1 -0
  45. package/dist/src/preview/server.d.ts +9 -0
  46. package/dist/src/preview/server.js +55 -0
  47. package/dist/src/preview/server.js.map +1 -0
  48. package/dist/src/preview/ui-auditor.d.ts +27 -0
  49. package/dist/src/preview/ui-auditor.js +141 -0
  50. package/dist/src/preview/ui-auditor.js.map +1 -0
  51. package/dist/src/preview/ui-gate.d.ts +66 -0
  52. package/dist/src/preview/ui-gate.js +210 -0
  53. package/dist/src/preview/ui-gate.js.map +1 -0
  54. package/dist/src/utils/ascii.d.ts +7 -0
  55. package/dist/src/utils/ascii.js +41 -0
  56. package/dist/src/utils/ascii.js.map +1 -0
  57. package/dist/src/utils/fs.d.ts +6 -0
  58. package/dist/src/utils/fs.js +39 -0
  59. package/dist/src/utils/fs.js.map +1 -0
  60. package/dist/templates/hooks/iddd-auto-audit.js +121 -0
  61. package/dist/templates/hooks/iddd-schema-drift.js +279 -0
  62. package/dist/templates/hooks/post-commit +121 -0
  63. package/dist/templates/hooks/pre-commit +348 -0
  64. package/package.json +37 -0
  65. package/templates/.agents/skills/.gitkeep +0 -0
  66. package/templates/.claude/hooks/.gitkeep +0 -0
  67. package/templates/.claude/hooks/hook-config.json +34 -0
  68. package/templates/.claude/skills/.gitkeep +0 -0
  69. package/templates/.codex/.gitkeep +0 -0
  70. package/templates/.codex/hooks.json +40 -0
  71. package/templates/.iddd/commit-count +1 -0
  72. package/templates/.iddd/preview/.gitkeep +0 -0
  73. package/templates/AGENTS.md +204 -0
  74. package/templates/CLAUDE.md +215 -0
  75. package/templates/README.md +476 -0
  76. package/templates/docs/.gitkeep +0 -0
  77. package/templates/docs/business-rules.md +14 -0
  78. package/templates/docs/domain-glossary.md +8 -0
  79. package/templates/docs/info-debt.md +17 -0
  80. package/templates/docs/model-changelog.md +12 -0
  81. package/templates/hooks/.gitkeep +0 -0
  82. package/templates/hooks/iddd-auto-audit.js +121 -0
  83. package/templates/hooks/iddd-schema-drift.js +279 -0
  84. package/templates/hooks/post-commit +121 -0
  85. package/templates/hooks/pre-commit +348 -0
  86. package/templates/skills/id3-design-information/SKILL.md +170 -0
  87. package/templates/skills/id3-design-information/references/phase2-procedure.md +241 -0
  88. package/templates/skills/id3-design-ui/.gitkeep +0 -0
  89. package/templates/skills/id3-design-ui/SKILL.md +200 -0
  90. package/templates/skills/id3-design-ui/references/.gitkeep +0 -0
  91. package/templates/skills/id3-design-ui/references/step1-structure-derivation.md +177 -0
  92. package/templates/skills/id3-design-ui/references/step2-visual-contract.md +257 -0
  93. package/templates/skills/id3-design-ui/references/step3-gate-and-mockup.md +177 -0
  94. package/templates/skills/id3-design-ui/references/step4-implementation.md +244 -0
  95. package/templates/skills/id3-identify-entities/SKILL.md +239 -0
  96. package/templates/skills/id3-identify-entities/references/.gitkeep +0 -0
  97. package/templates/skills/id3-identify-entities/references/phase0-brownfield.md +377 -0
  98. package/templates/skills/id3-identify-entities/references/phase1-greenfield.md +319 -0
  99. package/templates/skills/id3-info-audit/.gitkeep +0 -0
  100. package/templates/skills/id3-info-audit/SKILL.md +191 -0
  101. package/templates/skills/id3-preview/.gitkeep +0 -0
  102. package/templates/skills/id3-preview/SKILL.md +168 -0
  103. package/templates/skills/id3-spawn-team/.gitkeep +0 -0
  104. package/templates/skills/id3-spawn-team/SKILL.md +213 -0
  105. package/templates/specs/.gitkeep +0 -0
  106. package/templates/specs/data-model.md +26 -0
  107. package/templates/specs/entity-catalog.md +22 -0
  108. package/templates/specs/ui-design-contract.md +54 -0
  109. package/templates/specs/ui-inventory.md +24 -0
  110. package/templates/specs/ui-structure.md +32 -0
  111. package/templates/src/.gitkeep +0 -0
  112. package/templates/steering/.gitkeep +0 -0
  113. package/templates/steering/data-conventions.md +42 -0
  114. package/templates/steering/product.md +38 -0
@@ -0,0 +1,215 @@
1
+ # IDDD - Information Design-Driven Development
2
+
3
+ You are working in a project that follows **IDDD (Information Design-Driven Development)**. The information model is the generative center of all development. Every artifact - requirements, API contracts, screen designs, business rules, tests - is derived from and traceable to `specs/entity-catalog.md`.
4
+
5
+ **Core principle:** Start from "what information exists?" rather than "what features should we build?"
6
+
7
+ ---
8
+
9
+ ## Core Principles
10
+
11
+ 1. **Information model is the single source of truth.** All code, APIs, UI, and tests are derived from entity-catalog.md and data-model.md. If code disagrees with the spec, the spec wins - update the code, not the spec (unless there is a deliberate model change).
12
+
13
+ 2. **Entity-first identification.** Before writing any code, entities must be identified and documented. New features start with "what entities are involved?" not "what endpoints do we need?"
14
+
15
+ 3. **Data model traceability.** Every column, constraint, and relationship in the codebase must trace back to an entry in entity-catalog.md and data-model.md. Untracked schema elements are considered drift.
16
+
17
+ 4. **Output-first design.** Design what users see (dashboards, reports, lists) before designing inputs (forms, APIs). The output image drives the information model.
18
+
19
+ 5. **Business rules are explicit.** Every validation, constraint, and derivation rule is registered in `docs/business-rules.md` with a BR-xxx identifier. Code-only rules are considered debt.
20
+
21
+ ---
22
+
23
+ ## Required Reference Files
24
+
25
+ Before starting any task, read these files to understand the current state of the information model:
26
+
27
+ | File | Purpose |
28
+ |------|---------|
29
+ | `specs/entity-catalog.md` | Entity definitions, attributes, relationships, business rule references |
30
+ | `specs/data-model.md` | Mermaid ERD, design decisions, index strategy |
31
+ | `specs/ui-structure.md` | Screen inventory and navigation structure (Phase 2.5) |
32
+ | `specs/ui-design-contract.md` | Visual design contract -- tokens, components, copywriting (Phase 2.5) |
33
+ | `specs/ui-inventory.md` | Current UI structure (brownfield projects) |
34
+ | `docs/business-rules.md` | All business rules (BR-xxx) with enforcement locations |
35
+ | `steering/data-conventions.md` | Naming, typing, PK strategy, and structural conventions |
36
+ | `steering/product.md` | Product vision, scope, and priorities |
37
+ | `docs/domain-glossary.md` | Domain terms and definitions |
38
+ | `docs/info-debt.md` | Known discrepancies and technical debt items |
39
+ | `docs/model-changelog.md` | History of model changes (Keep a Changelog format) |
40
+
41
+ ---
42
+
43
+ ## Agent Teams Rules
44
+
45
+ This project uses **Agent Teams** for parallel work. Subagents are NOT used. The rules below govern how you operate as a lead agent and how you spawn team members.
46
+
47
+ ### Lead Agent Role
48
+
49
+ As the lead agent, you do NOT write code or modify files directly. Your responsibilities are:
50
+
51
+ 1. **Task distribution:** Assign clear, scoped tasks to team members.
52
+ 2. **Progress tracking:** Monitor each team member's work.
53
+ 3. **Quality review:** Review team output against the information model.
54
+ 4. **Feedback:** Provide specific, actionable feedback referencing spec entries.
55
+ 5. **Final integration:** Verify that all work aligns with the information model.
56
+
57
+ If implementation is needed, delegate it to a team member. Never do it yourself.
58
+
59
+ ### Spawning Team Members
60
+
61
+ When spawning a team member, ALWAYS include these 7 files as context:
62
+
63
+ 1. `specs/entity-catalog.md`
64
+ 2. `specs/data-model.md`
65
+ 3. `specs/ui-structure.md`
66
+ 4. `specs/ui-design-contract.md`
67
+ 5. `docs/business-rules.md`
68
+ 6. `steering/data-conventions.md`
69
+ 7. `CLAUDE.md` (this file)
70
+
71
+ Each team member operates in an **independent context** with its own worktree. Team members communicate via peer-to-peer messaging, not through the lead agent.
72
+
73
+ ### Standard Team Roles
74
+
75
+ | Role | Responsibility |
76
+ |------|---------------|
77
+ | spec-generator | Transform information model into implementation-ready specs (requirements.md, api-contracts.md) |
78
+ | implementer | Build code from specs, one entity per commit |
79
+ | qa-reviewer | Verify implementation against information model, reject on mismatch |
80
+
81
+ ### Task Generation Rules
82
+
83
+ 1. Read `specs/entity-catalog.md` to extract the entity list.
84
+ 2. Create one task per entity (model + migration + API + validation + tests).
85
+ 3. Analyze FK dependencies from `specs/data-model.md` to build a dependency graph.
86
+ 4. Independent entities (no FK to other project entities) run in parallel.
87
+ 5. Dependent entities wait for their parent entities to complete.
88
+ 6. Within each dependency wave, assign tasks to team members in parallel.
89
+
90
+ ---
91
+
92
+ ## Hook System
93
+
94
+ This project uses an automated harness that monitors development:
95
+
96
+ ### Schema Drift Detection (PreToolUse - severity: BLOCK)
97
+
98
+ When you modify schema-related files (migrations, ORM definitions, model files), the harness checks whether `specs/entity-catalog.md` has been updated accordingly. If not, the change is **blocked**. Always update entity-catalog.md first, then modify the schema.
99
+
100
+ ### Rule Check (PostToolUse - severity: WARN)
101
+
102
+ When you add validation logic (Zod, Yup, Joi, Pydantic, etc.), the harness checks for a corresponding BR-xxx entry in `docs/business-rules.md`. If missing, you receive a warning. Register the rule before or alongside the validation code.
103
+
104
+ ### Auto-Audit (Stop - severity: INFO)
105
+
106
+ After every N commits (configured in `.claude/hooks/hook-config.json`), the harness runs an automatic audit comparing the codebase against the information model. Review findings at the start of the next session.
107
+
108
+ ### Hook Bypass
109
+
110
+ - Set `IDDD_SKIP_HOOKS=1` to skip all hooks temporarily.
111
+ - Bypasses are logged to `.iddd/skip-history.log` and reviewed during audits.
112
+ - Avoid bypassing hooks. If you must, address the underlying issue promptly.
113
+
114
+ ---
115
+
116
+ ## Entropy Management
117
+
118
+ ### Version Headers
119
+
120
+ `specs/entity-catalog.md` and `specs/data-model.md` contain YAML frontmatter with version tracking:
121
+
122
+ ```yaml
123
+ ---
124
+ version: "1.0"
125
+ last_verified: "YYYY-MM-DD"
126
+ phase: "Phase 2 Complete"
127
+ entity_count: N
128
+ rule_count: N
129
+ audit_status: "clean"
130
+ ---
131
+ ```
132
+
133
+ **Rules:**
134
+ - Update `last_verified` whenever you audit or verify the model.
135
+ - Increment `version` on each phase completion (Phase 1: 0.1, Phase 2: 1.0, subsequent: 1.1, 1.2, ...).
136
+ - If `last_verified` is more than 7 days ago, run `/id3-info-audit` before proceeding with new work. Stale models lead to drift.
137
+
138
+ ### Change Log
139
+
140
+ Record all model changes in `docs/model-changelog.md` using Keep a Changelog format. Every entity addition, modification, or removal should have an entry.
141
+
142
+ ---
143
+
144
+ ## Preview System
145
+
146
+ This project includes a visual preview system for reviewing the information model in a browser.
147
+
148
+ ### Generated Previews
149
+
150
+ - **ERD Preview:** Mermaid ERD rendered as interactive HTML in `.iddd/preview/`.
151
+ - **UI Mockup:** Wireframe layouts of proposed screens in `.iddd/preview/`.
152
+ - **Audit Dashboard:** Visual audit report with per-entity status cards in `.iddd/preview/`.
153
+
154
+ ### When to Generate Previews
155
+
156
+ - After completing Phase 0/1 (entity identification): Generate ERD preview.
157
+ - After completing Phase 2 (information design): Generate ERD + UI mockup previews.
158
+ - After completing Phase 2.5 (UI design): Generate mockup index + per-entity mockup previews.
159
+ - After running `/id3-info-audit`: Generate audit dashboard.
160
+ - Manual preview: Use `/id3-preview` to start the server with current specs.
161
+
162
+ ### Preview Files
163
+
164
+ All preview HTML files are stored in `.iddd/preview/` and persist between sessions. They can be opened directly in a browser without the preview server.
165
+
166
+ ---
167
+
168
+ ## Security Rules
169
+
170
+ 1. **Never commit secrets.** Do not add `.env`, credentials, API keys, or tokens to version control.
171
+ 2. **Never skip hooks without logging.** Hook bypasses must be recorded and resolved.
172
+ 3. **Never modify spec files during implementation.** If implementation reveals a spec gap, escalate to the lead agent or run an audit - do not silently change the spec.
173
+ 4. **Never delete entities from entity-catalog.md without a changelog entry.** Removals must be documented.
174
+
175
+ ---
176
+
177
+ ## New Feature Workflow
178
+
179
+ When adding a new feature:
180
+
181
+ 1. **Identify entities involved.** Read entity-catalog.md. If new entities are needed, run `/id3-identify-entities` first.
182
+ 2. **Check business rules.** Read business-rules.md for relevant BR-xxx rules.
183
+ 3. **Check UI structure.** Read ui-structure.md for screen inventory and ui-design-contract.md for design tokens.
184
+ 4. **Implement following the spec.** Every line of code should trace to a spec entry.
185
+ 5. **Register new rules.** If new validation logic is added, register it as BR-xxx in business-rules.md.
186
+ 6. **Update the changelog.** Record what changed in model-changelog.md.
187
+
188
+ ---
189
+
190
+ ## Technology Stack
191
+
192
+ > _Fill in the project's tech stack below._
193
+
194
+ - **Language:**
195
+ - **Framework:**
196
+ - **Database:**
197
+ - **ORM:**
198
+ - **Validation:**
199
+ - **Testing:**
200
+ - **Build:**
201
+
202
+ ## Build and Test
203
+
204
+ > _Fill in the project's build and test commands below._
205
+
206
+ ```bash
207
+ # Build
208
+ # npm run build
209
+
210
+ # Test
211
+ # npm test
212
+
213
+ # Lint
214
+ # npm run lint
215
+ ```
@@ -0,0 +1,476 @@
1
+ # IDDD -- Information Design-Driven Development
2
+
3
+ ```
4
+ ___ ____ ____ ____
5
+ |_ _|| _ \| _ \| _ \
6
+ | | | | | | | | | | | |
7
+ | | | |_| | |_| | |_| |
8
+ |___||____/|____/|____/
9
+
10
+ Information Design-Driven Development
11
+ "What information exists?" before "What features should we build?"
12
+ ```
13
+
14
+ Most software projects start by asking *"What features should we build?"* and jump
15
+ straight into implementation. IDDD inverts this: it starts from **"What information
16
+ exists in this domain?"** By building a rigorous information model first -- entity
17
+ catalog, data model, business rules, and domain glossary -- IDDD ensures that 80% of
18
+ application behavior is already defined before any technology choice is made. The
19
+ information model then becomes the generative center from which requirements, API
20
+ contracts, screen designs, and validation rules are systematically derived. This
21
+ package installs IDDD as a set of AI agent skills, harness hooks, and document
22
+ templates so that your coding agent enforces information-first discipline throughout
23
+ the entire development lifecycle.
24
+
25
+ ---
26
+
27
+ ## Supported Platforms
28
+
29
+ | Platform | Agent System | Multi-Agent Strategy |
30
+ |-------------|----------------------|----------------------------------|
31
+ | Claude Code | Claude Agent Teams | Peer messaging, independent worktrees |
32
+ | OpenAI Codex| Codex Agents SDK | Handoff pattern via MCP Server |
33
+
34
+ ---
35
+
36
+ ## Prerequisites
37
+
38
+ | Platform | Requirement |
39
+ |-------------|------------------------------------------------------|
40
+ | Claude Code | **Claude Max** membership + Agent Teams enabled |
41
+ | OpenAI Codex| **ChatGPT Plus** or higher (Pro/Business/Enterprise) |
42
+
43
+ You also need **Node.js 18+** and **npm** (or a compatible package manager) installed
44
+ on your machine.
45
+
46
+ ---
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ npx id3@latest
52
+ ```
53
+
54
+ The `init` command will:
55
+ 1. Copy all IDDD templates (specs, docs, steering, skills, hooks) into your project.
56
+ 2. Create platform-specific symlinks (`.claude/skills/` or `.agents/skills/`).
57
+ 3. Register harness hooks in your platform's configuration file.
58
+ 4. Initialize the `.iddd/` state directory (commit counter, preview output).
59
+
60
+ ---
61
+
62
+ ## Directory Structure
63
+
64
+ After installation, your project gains the following directories:
65
+
66
+ ```
67
+ your-project/
68
+
69
+ │ ===== Shared (all platforms) =====
70
+
71
+ ├── skills/ Skill originals (single source of truth)
72
+ │ ├── id3-identify-entities/ Phase 0/1: Entity identification
73
+ │ │ ├── SKILL.md
74
+ │ │ └── references/
75
+ │ │ ├── phase0-brownfield.md Reverse-extract from existing code
76
+ │ │ └── phase1-greenfield.md Structured interview for new projects
77
+ │ ├── id3-design-information/ Phase 2: Information structuring
78
+ │ │ ├── SKILL.md
79
+ │ │ └── references/
80
+ │ │ ├── phase2-procedure.md Refinement procedure
81
+ │ │ └── ui-proposal-guide.md UI derivation from info model
82
+ │ ├── id3-design-ui/ Phase 2.5: UI design and implementation
83
+ │ │ ├── SKILL.md
84
+ │ │ └── references/
85
+ │ │ ├── step1-structure-derivation.md
86
+ │ │ ├── step2-visual-contract.md
87
+ │ │ ├── step3-gate-and-mockup.md
88
+ │ │ └── step4-implementation.md
89
+ │ ├── id3-spawn-team/ Dispatch multi-agent implementation
90
+ │ ├── id3-info-audit/ Entropy audit (drift detection)
91
+ │ └── id3-preview/ Visual preview of information model
92
+
93
+ ├── specs/ Information model artifacts
94
+ │ ├── entity-catalog.md Entity inventory + summary table
95
+ │ ├── data-model.md Mermaid ERD + design decisions
96
+ │ ├── ui-inventory.md Screen inventory + mapping matrix
97
+ │ ├── ui-structure.md Screen inventory + navigation structure (Phase 2.5)
98
+ │ └── ui-design-contract.md Visual design contract -- tokens, components (Phase 2.5)
99
+
100
+ ├── docs/ Supporting documentation
101
+ │ ├── business-rules.md BR-xxx indexed business rules
102
+ │ ├── domain-glossary.md Term / English / definition / notes
103
+ │ ├── info-debt.md Inconsistency tracker
104
+ │ └── model-changelog.md Keep-a-Changelog format
105
+
106
+ ├── steering/ Project-level conventions
107
+ │ ├── product.md Product vision & scope (user-authored)
108
+ │ └── data-conventions.md PK strategy, naming, timestamps, etc.
109
+
110
+ ├── hooks/ Harness hook scripts (built JS bundles)
111
+ │ ├── iddd-schema-drift.js Schema drift detection
112
+ │ ├── iddd-rule-check.js Business rule tracking
113
+ │ ├── iddd-auto-audit.js Automatic entropy audit
114
+ │ ├── pre-commit Git hook (schema-drift + rule-check)
115
+ │ └── post-commit Git hook (auto-audit)
116
+
117
+ ├── .iddd/ IDDD internal state
118
+ │ ├── commit-count Auto-audit interval counter
119
+ │ └── preview/ Generated preview HTML
120
+
121
+ │ ===== Platform: Claude Code =====
122
+
123
+ ├── CLAUDE.md Lead agent context document
124
+ ├── .claude/
125
+ │ ├── settings.local.json Hook registration (injected by init)
126
+ │ ├── skills/ -> skills/ Symlinks to skills/ originals
127
+ │ └── hooks/
128
+ │ └── hook-config.json IDDD hook settings (enable/disable, patterns)
129
+
130
+ │ ===== Platform: OpenAI Codex =====
131
+
132
+ ├── AGENTS.md Cross-platform agent instructions (<32 KiB)
133
+ ├── .agents/
134
+ │ └── skills/ -> skills/ Symlinks to skills/ originals
135
+ └── .codex/
136
+ └── hooks.json Codex hook configuration
137
+ ```
138
+
139
+ ---
140
+
141
+ ## Workflow
142
+
143
+ ```
144
+ ┌────────────────────────────────────────────────────────────────────┐
145
+ │ IDDD WORKFLOW OVERVIEW │
146
+ └────────────────────────────────────────────────────────────────────┘
147
+
148
+ [User] <---dialog---> [Lead Agent]
149
+ |
150
+ |--- Existing code?
151
+ | |
152
+ | v
153
+ | Phase 0 (Reverse-Extract)
154
+ | | Scan ORM/schema files
155
+ | | Extract entities & relationships
156
+ | v
157
+ | Verification Interview --------+
158
+ | |
159
+ |--- No existing code? |
160
+ | | |
161
+ | v |
162
+ | Phase 1 (Structured Interview) |
163
+ | | "What information does |
164
+ | | your domain manage?" |
165
+ | v |
166
+ | Entity Catalog produced -------+
167
+ | |
168
+ | v
169
+ |--- Phase 2: Information Design <--+
170
+ | |
171
+ | | Conceptual -> Logical model
172
+ | | Derive business rules
173
+ | | Register hooks + version headers
174
+ | v
175
+ |
176
+ +--- Phase 2.5: UI Design
177
+ | |
178
+ | | Entity -> Screen derivation
179
+ | | Visual design contract
180
+ | | 7-Pillar gate + mockup preview
181
+ | | Agent Teams implementation
182
+ | v
183
+ |
184
+ +--- /id3-spawn-team
185
+ |
186
+ +------------+------------------+
187
+ | |
188
+ [Claude Code] [Codex]
189
+ Agent Teams Agents SDK
190
+ | |
191
+ +-----+-------+ |
192
+ | | | |
193
+ v v v v
194
+ [spec] [impl] [qa] [handoff]
195
+ | | |
196
+ +-- messaging-+
197
+
198
+
199
+ ┌────────────────────────────────────────────────────────────────────┐
200
+ │ HARNESS HOOKS │
201
+ ├────────────────────────────────────────────────────────────────────┤
202
+ │ │
203
+ │ PreToolUse / pre-commit: │
204
+ │ +-- Schema drift BLOCK │
205
+ │ | "Entity added to code but missing from entity-catalog.md" │
206
+ │ +-- Rule tracking WARN │
207
+ │ "Validation logic changed; check business-rules.md" │
208
+ │ │
209
+ │ Stop / post-commit: │
210
+ │ +-- Auto info-audit (every N commits) │
211
+ │ Compare specs/ against actual code for entropy drift │
212
+ │ │
213
+ └────────────────────────────────────────────────────────────────────┘
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Quick Start
219
+
220
+ ### Step 1: Initialize IDDD in your project
221
+
222
+ ```bash
223
+ cd your-project
224
+ npx id3@latest
225
+ ```
226
+
227
+ This scaffolds all IDDD directories, registers hooks, and links skills to your
228
+ platform.
229
+
230
+ ### Step 2: Identify entities
231
+
232
+ Open your AI coding agent and say:
233
+
234
+ ```
235
+ identify entities
236
+ ```
237
+
238
+ - **Brownfield** (existing code detected): The agent runs Phase 0 -- it scans your
239
+ ORM schemas, migration files, and model definitions, then extracts entities and
240
+ relationships into `specs/entity-catalog.md` and `specs/data-model.md`. You will
241
+ be asked verification questions to confirm or correct the extraction.
242
+ - **Greenfield** (no existing code): The agent runs Phase 1 -- a structured
243
+ interview asking "What information does your domain manage?" to collaboratively
244
+ build the initial entity catalog.
245
+
246
+ ### Step 3: Design information model
247
+
248
+ Once entities are identified, say:
249
+
250
+ ```
251
+ design information
252
+ ```
253
+
254
+ The agent runs Phase 2: it refines your conceptual model into a logical model,
255
+ derives business rules (`docs/business-rules.md`), and sets up version headers
256
+ and hook configurations.
257
+
258
+ ### Step 3.5: Design UI (Phase 2.5)
259
+
260
+ After Phase 2 completes, say:
261
+
262
+ ```
263
+ design ui
264
+ ```
265
+
266
+ The agent runs Phase 2.5: it derives screen structure from the entity catalog
267
+ (`specs/ui-structure.md`), establishes a visual design contract with design tokens
268
+ (`specs/ui-design-contract.md`), runs a 7-pillar quality gate with interactive
269
+ mockup previews, and spawns Agent Teams for parallel screen implementation with
270
+ post-audit. After Phase 2.5 completes, use `/id3-spawn-team` to dispatch
271
+ implementation agents.
272
+
273
+ ---
274
+
275
+ ## Customization Guide
276
+
277
+ IDDD is designed to be adapted to your project's conventions. Here is what to
278
+ customize and where:
279
+
280
+ | What to customize | File to edit |
281
+ |--------------------------------|-----------------------------------|
282
+ | Product vision & scope | `steering/product.md` |
283
+ | Naming conventions, PK strategy, timestamps, soft-delete policy, ENUM vs reference tables | `steering/data-conventions.md` |
284
+ | Business rules | `docs/business-rules.md` |
285
+ | Domain glossary | `docs/domain-glossary.md` |
286
+ | Entity definitions | `specs/entity-catalog.md` |
287
+ | Data model (ERD) | `specs/data-model.md` |
288
+ | UI screen inventory | `specs/ui-inventory.md` |
289
+ | UI structure | `specs/ui-structure.md` |
290
+ | UI design contract | `specs/ui-design-contract.md` |
291
+ | Hook behavior (enable/disable) | `.claude/hooks/hook-config.json` |
292
+ | Monitored file patterns | `.claude/hooks/hook-config.json` |
293
+ | Auto-audit interval | `.claude/hooks/hook-config.json` |
294
+ | Codex hook configuration | `.codex/hooks.json` |
295
+
296
+ **Tip:** All `specs/` and `docs/` files use YAML frontmatter with version headers.
297
+ The IDDD harness tracks these versions to detect entropy drift. Always update the
298
+ version header when you modify a spec file.
299
+
300
+ ---
301
+
302
+ ## Harness Configuration Guide
303
+
304
+ The IDDD harness enforces information-first discipline through automated hooks. All
305
+ hook settings live in `.claude/hooks/hook-config.json` (Claude Code) or
306
+ `.codex/hooks.json` (Codex).
307
+
308
+ ### Hook Overview
309
+
310
+ ```
311
+ Hook Config (.claude/hooks/hook-config.json)
312
+ +--------------------------------------------+
313
+ | enabled: true | false | Master switch
314
+ +--------------------------------------------+
315
+ | |
316
+ | pre-commit: |
317
+ | +-- schema-drift |
318
+ | | enabled: true |
319
+ | | severity: "block" | "warn" | Block or warn on drift
320
+ | | monitored_patterns: |
321
+ | | - prisma/schema.prisma |
322
+ | | - drizzle/**/*.ts |
323
+ | | - **/migrations/*.sql | Add your ORM patterns
324
+ | | - **/models.py |
325
+ | | - **/entities/*.ts |
326
+ | | - **/entities/*.java |
327
+ | | |
328
+ | +-- rule-check |
329
+ | enabled: true |
330
+ | severity: "warn" |
331
+ | validation_patterns: |
332
+ | - *.schema.ts |
333
+ | - *.validator.* | Add your validator patterns
334
+ | - **/validators/** |
335
+ | |
336
+ | post-commit: |
337
+ | +-- auto-audit |
338
+ | enabled: true |
339
+ | interval_commits: 10 | Run audit every N commits
340
+ | |
341
+ +--------------------------------------------+
342
+ ```
343
+
344
+ ### Enabling / Disabling Hooks
345
+
346
+ To disable all IDDD hooks at once, set the top-level `enabled` flag to `false`:
347
+
348
+ ```json
349
+ {
350
+ "enabled": false,
351
+ ...
352
+ }
353
+ ```
354
+
355
+ To disable a specific hook while keeping others active:
356
+
357
+ ```json
358
+ {
359
+ "enabled": true,
360
+ "hooks": {
361
+ "pre-commit": {
362
+ "schema-drift": {
363
+ "enabled": false
364
+ }
365
+ }
366
+ }
367
+ }
368
+ ```
369
+
370
+ ### Adjusting Auto-Audit Interval
371
+
372
+ The auto-audit runs every N commits. To change the interval:
373
+
374
+ ```json
375
+ {
376
+ "hooks": {
377
+ "post-commit": {
378
+ "auto-audit": {
379
+ "enabled": true,
380
+ "interval_commits": 5
381
+ }
382
+ }
383
+ }
384
+ }
385
+ ```
386
+
387
+ Set `interval_commits` to a lower number for stricter entropy control, or higher for
388
+ less frequent audits. The commit counter is stored in `.iddd/commit-count`.
389
+
390
+ ### Adding Schema Monitoring Patterns
391
+
392
+ If your project uses an ORM or schema tool not covered by the defaults, add its file
393
+ patterns to `monitored_patterns`:
394
+
395
+ ```json
396
+ {
397
+ "hooks": {
398
+ "pre-commit": {
399
+ "schema-drift": {
400
+ "monitored_patterns": [
401
+ "prisma/schema.prisma",
402
+ "drizzle/**/*.ts",
403
+ "**/migrations/*.sql",
404
+ "**/models.py",
405
+ "**/entities/*.ts",
406
+ "**/entities/*.java",
407
+ "src/database/**/*.entity.ts",
408
+ "sequelize/models/**/*.js"
409
+ ]
410
+ }
411
+ }
412
+ }
413
+ }
414
+ ```
415
+
416
+ ### Schema Drift Severity
417
+
418
+ - `"block"` -- The hook will **reject** the commit / tool use if schema drift is
419
+ detected. The agent must update `specs/entity-catalog.md` and `specs/data-model.md`
420
+ before proceeding.
421
+ - `"warn"` -- The hook emits a warning but allows the operation to continue.
422
+
423
+ ---
424
+
425
+ ## Codex Configuration
426
+
427
+ For OpenAI Codex, hooks are configured in `.codex/hooks.json`. This file is
428
+ automatically generated by `npx id3@latest`.
429
+
430
+ **Important:** If your project uses a `config.toml` for Codex agent settings, ensure
431
+ that hooks are enabled:
432
+
433
+ ```toml
434
+ # config.toml
435
+ codex_hooks = true
436
+ ```
437
+
438
+ Without this flag, Codex will not execute the IDDD hook scripts during the agent
439
+ loop. The hooks.json file defines three event bindings:
440
+
441
+ | Event | Hook Script | Purpose |
442
+ |---------------|---------------------------|------------------------------|
443
+ | PreToolUse | `hooks/iddd-schema-drift.js`| Schema drift detection |
444
+ | PostToolUse | `hooks/iddd-rule-check.js` | Business rule tracking |
445
+ | SessionStart | `hooks/iddd-auto-audit.js` | Entropy audit on session start |
446
+
447
+ To disable a specific Codex hook, remove or comment out its entry in `.codex/hooks.json`.
448
+
449
+ ---
450
+
451
+ ## Intellectual Lineage
452
+
453
+ IDDD synthesizes ideas from several intellectual traditions:
454
+
455
+ - **Peter Chen's ER Model (1976)** -- "The real world consists of entities and relationships."
456
+ - **Len Silverston's Universal Data Models** -- Reusable information patterns (Party, Product, Order, Hierarchy).
457
+ - **Eric Evans' DDD (2003)** -- Bounded Context, Ubiquitous Language, Aggregate.
458
+ - **Sophia Prater's OOUX** -- "Design objects before interactions" (ORCA: Objects, Relationships, CTAs, Attributes).
459
+ - **Jamie Lord's "Data First, Code Second" (2024)** -- "Fold knowledge into data" (Unix Rule of Representation).
460
+ - **Mitchell Hashimoto's Harness Engineering (2026)** -- Agent = Model + Harness. Context engineering + architecture constraints + entropy management.
461
+
462
+ **Core insight:** *When the logical model is complete, 80% of application behavior is
463
+ already defined -- before any technology choice is made. And that information model
464
+ itself is the best harness for AI agents.*
465
+
466
+ ---
467
+
468
+ ## License
469
+
470
+ MIT
471
+
472
+ ---
473
+
474
+ ```
475
+ "What information exists?" -- always the first question.
476
+ ```
File without changes