@assistkick/create 1.0.0

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 (178) hide show
  1. package/dist/bin/create.d.ts +2 -0
  2. package/dist/bin/create.js +25 -0
  3. package/dist/bin/create.js.map +1 -0
  4. package/dist/src/scaffolder.d.ts +22 -0
  5. package/dist/src/scaffolder.js +120 -0
  6. package/dist/src/scaffolder.js.map +1 -0
  7. package/package.json +24 -0
  8. package/templates/product-system/.env.example +8 -0
  9. package/templates/product-system/CLAUDE.md +45 -0
  10. package/templates/product-system/package.json +32 -0
  11. package/templates/product-system/packages/backend/package.json +37 -0
  12. package/templates/product-system/packages/backend/src/middleware/auth_middleware.test.ts +86 -0
  13. package/templates/product-system/packages/backend/src/middleware/auth_middleware.ts +35 -0
  14. package/templates/product-system/packages/backend/src/routes/auth.ts +463 -0
  15. package/templates/product-system/packages/backend/src/routes/coherence.ts +187 -0
  16. package/templates/product-system/packages/backend/src/routes/graph.ts +67 -0
  17. package/templates/product-system/packages/backend/src/routes/kanban.ts +201 -0
  18. package/templates/product-system/packages/backend/src/routes/pipeline.ts +41 -0
  19. package/templates/product-system/packages/backend/src/routes/projects.ts +122 -0
  20. package/templates/product-system/packages/backend/src/routes/users.ts +97 -0
  21. package/templates/product-system/packages/backend/src/server.ts +159 -0
  22. package/templates/product-system/packages/backend/src/services/auth_service.test.ts +115 -0
  23. package/templates/product-system/packages/backend/src/services/auth_service.ts +82 -0
  24. package/templates/product-system/packages/backend/src/services/coherence-review.ts +339 -0
  25. package/templates/product-system/packages/backend/src/services/email_service.ts +75 -0
  26. package/templates/product-system/packages/backend/src/services/init.ts +80 -0
  27. package/templates/product-system/packages/backend/src/services/invitation_service.test.ts +235 -0
  28. package/templates/product-system/packages/backend/src/services/invitation_service.ts +193 -0
  29. package/templates/product-system/packages/backend/src/services/password_reset_service.test.ts +151 -0
  30. package/templates/product-system/packages/backend/src/services/password_reset_service.ts +135 -0
  31. package/templates/product-system/packages/backend/src/services/project_service.test.ts +215 -0
  32. package/templates/product-system/packages/backend/src/services/project_service.ts +171 -0
  33. package/templates/product-system/packages/backend/src/services/pty_session_manager.test.ts +88 -0
  34. package/templates/product-system/packages/backend/src/services/pty_session_manager.ts +279 -0
  35. package/templates/product-system/packages/backend/src/services/terminal_ws_handler.ts +133 -0
  36. package/templates/product-system/packages/backend/src/services/user_management_service.test.ts +158 -0
  37. package/templates/product-system/packages/backend/src/services/user_management_service.ts +128 -0
  38. package/templates/product-system/packages/backend/tsconfig.json +22 -0
  39. package/templates/product-system/packages/frontend/index.html +13 -0
  40. package/templates/product-system/packages/frontend/package-lock.json +2666 -0
  41. package/templates/product-system/packages/frontend/package.json +30 -0
  42. package/templates/product-system/packages/frontend/public/favicon.svg +16 -0
  43. package/templates/product-system/packages/frontend/src/App.tsx +29 -0
  44. package/templates/product-system/packages/frontend/src/api/client.ts +386 -0
  45. package/templates/product-system/packages/frontend/src/api/client_projects.test.ts +104 -0
  46. package/templates/product-system/packages/frontend/src/api/client_refresh.test.ts +145 -0
  47. package/templates/product-system/packages/frontend/src/components/CoherenceView.tsx +414 -0
  48. package/templates/product-system/packages/frontend/src/components/GraphLegend.tsx +124 -0
  49. package/templates/product-system/packages/frontend/src/components/GraphSettings.tsx +112 -0
  50. package/templates/product-system/packages/frontend/src/components/GraphView.tsx +370 -0
  51. package/templates/product-system/packages/frontend/src/components/InviteUserDialog.tsx +85 -0
  52. package/templates/product-system/packages/frontend/src/components/KanbanView.tsx +470 -0
  53. package/templates/product-system/packages/frontend/src/components/LoginPage.tsx +116 -0
  54. package/templates/product-system/packages/frontend/src/components/ProjectSelector.tsx +187 -0
  55. package/templates/product-system/packages/frontend/src/components/QaIssueSheet.tsx +192 -0
  56. package/templates/product-system/packages/frontend/src/components/SidePanel.tsx +231 -0
  57. package/templates/product-system/packages/frontend/src/components/TerminalView.tsx +200 -0
  58. package/templates/product-system/packages/frontend/src/components/Toolbar.tsx +84 -0
  59. package/templates/product-system/packages/frontend/src/components/UsersView.tsx +249 -0
  60. package/templates/product-system/packages/frontend/src/constants/graph.ts +191 -0
  61. package/templates/product-system/packages/frontend/src/hooks/useAuth.tsx +54 -0
  62. package/templates/product-system/packages/frontend/src/hooks/useGraph.ts +27 -0
  63. package/templates/product-system/packages/frontend/src/hooks/useKanban.ts +21 -0
  64. package/templates/product-system/packages/frontend/src/hooks/useProjects.ts +86 -0
  65. package/templates/product-system/packages/frontend/src/hooks/useTheme.ts +26 -0
  66. package/templates/product-system/packages/frontend/src/hooks/useToast.tsx +62 -0
  67. package/templates/product-system/packages/frontend/src/hooks/use_projects_logic.test.ts +61 -0
  68. package/templates/product-system/packages/frontend/src/main.tsx +12 -0
  69. package/templates/product-system/packages/frontend/src/pages/accept_invitation_page.tsx +167 -0
  70. package/templates/product-system/packages/frontend/src/pages/forgot_password_page.tsx +100 -0
  71. package/templates/product-system/packages/frontend/src/pages/register_page.tsx +137 -0
  72. package/templates/product-system/packages/frontend/src/pages/reset_password_page.tsx +146 -0
  73. package/templates/product-system/packages/frontend/src/routes/ProtectedRoute.tsx +12 -0
  74. package/templates/product-system/packages/frontend/src/routes/accept_invitation.tsx +14 -0
  75. package/templates/product-system/packages/frontend/src/routes/dashboard.tsx +221 -0
  76. package/templates/product-system/packages/frontend/src/routes/forgot_password.tsx +13 -0
  77. package/templates/product-system/packages/frontend/src/routes/login.tsx +14 -0
  78. package/templates/product-system/packages/frontend/src/routes/register.tsx +14 -0
  79. package/templates/product-system/packages/frontend/src/routes/reset_password.tsx +13 -0
  80. package/templates/product-system/packages/frontend/src/styles/index.css +3358 -0
  81. package/templates/product-system/packages/frontend/src/utils/auth_validation.test.ts +51 -0
  82. package/templates/product-system/packages/frontend/src/utils/auth_validation.ts +19 -0
  83. package/templates/product-system/packages/frontend/src/utils/login_validation.test.ts +61 -0
  84. package/templates/product-system/packages/frontend/src/utils/login_validation.ts +24 -0
  85. package/templates/product-system/packages/frontend/src/utils/logout.test.ts +63 -0
  86. package/templates/product-system/packages/frontend/src/utils/node_sizing.test.ts +62 -0
  87. package/templates/product-system/packages/frontend/src/utils/node_sizing.ts +24 -0
  88. package/templates/product-system/packages/frontend/src/utils/task_status.test.ts +53 -0
  89. package/templates/product-system/packages/frontend/src/utils/task_status.ts +14 -0
  90. package/templates/product-system/packages/frontend/tsconfig.json +21 -0
  91. package/templates/product-system/packages/frontend/vite.config.ts +20 -0
  92. package/templates/product-system/packages/shared/.env.example +3 -0
  93. package/templates/product-system/packages/shared/README.md +1 -0
  94. package/templates/product-system/packages/shared/db/migrate.ts +32 -0
  95. package/templates/product-system/packages/shared/db/migrations/0000_dashing_gorgon.sql +128 -0
  96. package/templates/product-system/packages/shared/db/migrations/meta/0000_snapshot.json +819 -0
  97. package/templates/product-system/packages/shared/db/migrations/meta/_journal.json +13 -0
  98. package/templates/product-system/packages/shared/db/schema.ts +137 -0
  99. package/templates/product-system/packages/shared/drizzle.config.js +14 -0
  100. package/templates/product-system/packages/shared/lib/claude-service.ts +215 -0
  101. package/templates/product-system/packages/shared/lib/coherence.ts +278 -0
  102. package/templates/product-system/packages/shared/lib/completeness.ts +30 -0
  103. package/templates/product-system/packages/shared/lib/constants.ts +327 -0
  104. package/templates/product-system/packages/shared/lib/db.ts +81 -0
  105. package/templates/product-system/packages/shared/lib/git_workflow.ts +110 -0
  106. package/templates/product-system/packages/shared/lib/graph.ts +186 -0
  107. package/templates/product-system/packages/shared/lib/kanban.ts +161 -0
  108. package/templates/product-system/packages/shared/lib/markdown.ts +205 -0
  109. package/templates/product-system/packages/shared/lib/pipeline-state-store.ts +124 -0
  110. package/templates/product-system/packages/shared/lib/pipeline.ts +489 -0
  111. package/templates/product-system/packages/shared/lib/prompt_builder.ts +170 -0
  112. package/templates/product-system/packages/shared/lib/relevance_search.ts +159 -0
  113. package/templates/product-system/packages/shared/lib/session.ts +152 -0
  114. package/templates/product-system/packages/shared/lib/validator.ts +117 -0
  115. package/templates/product-system/packages/shared/lib/work_summary_parser.ts +130 -0
  116. package/templates/product-system/packages/shared/package.json +30 -0
  117. package/templates/product-system/packages/shared/scripts/assign-project.ts +52 -0
  118. package/templates/product-system/packages/shared/tools/add_edge.ts +61 -0
  119. package/templates/product-system/packages/shared/tools/add_node.ts +101 -0
  120. package/templates/product-system/packages/shared/tools/end_session.ts +87 -0
  121. package/templates/product-system/packages/shared/tools/get_gaps.ts +87 -0
  122. package/templates/product-system/packages/shared/tools/get_kanban.ts +125 -0
  123. package/templates/product-system/packages/shared/tools/get_node.ts +78 -0
  124. package/templates/product-system/packages/shared/tools/get_status.ts +98 -0
  125. package/templates/product-system/packages/shared/tools/migrate_to_turso.ts +385 -0
  126. package/templates/product-system/packages/shared/tools/move_card.ts +143 -0
  127. package/templates/product-system/packages/shared/tools/rebuild_index.ts +77 -0
  128. package/templates/product-system/packages/shared/tools/remove_edge.ts +59 -0
  129. package/templates/product-system/packages/shared/tools/remove_node.ts +96 -0
  130. package/templates/product-system/packages/shared/tools/resolve_question.ts +75 -0
  131. package/templates/product-system/packages/shared/tools/search_nodes.ts +106 -0
  132. package/templates/product-system/packages/shared/tools/start_session.ts +144 -0
  133. package/templates/product-system/packages/shared/tools/update_node.ts +133 -0
  134. package/templates/product-system/packages/shared/tsconfig.json +24 -0
  135. package/templates/product-system/pnpm-workspace.yaml +2 -0
  136. package/templates/product-system/smoke_test.ts +219 -0
  137. package/templates/product-system/tests/coherence_review.test.ts +562 -0
  138. package/templates/product-system/tests/db_sqlite_fallback.test.ts +75 -0
  139. package/templates/product-system/tests/edge_type_color_coding.test.ts +147 -0
  140. package/templates/product-system/tests/emit-tool-use-events.test.ts +85 -0
  141. package/templates/product-system/tests/feature_kind.test.ts +139 -0
  142. package/templates/product-system/tests/gap_indicators.test.ts +199 -0
  143. package/templates/product-system/tests/graceful_init.test.ts +142 -0
  144. package/templates/product-system/tests/graph_legend.test.ts +314 -0
  145. package/templates/product-system/tests/graph_settings_sheet.test.ts +804 -0
  146. package/templates/product-system/tests/hide_defined_filter.test.ts +205 -0
  147. package/templates/product-system/tests/kanban.test.ts +529 -0
  148. package/templates/product-system/tests/neighborhood_focus.test.ts +132 -0
  149. package/templates/product-system/tests/node_search.test.ts +340 -0
  150. package/templates/product-system/tests/node_sizing.test.ts +170 -0
  151. package/templates/product-system/tests/node_type_toggle_filters.test.ts +285 -0
  152. package/templates/product-system/tests/node_type_visual_encoding.test.ts +103 -0
  153. package/templates/product-system/tests/pipeline-state-store.test.ts +268 -0
  154. package/templates/product-system/tests/pipeline-unit.test.ts +593 -0
  155. package/templates/product-system/tests/pipeline.test.ts +195 -0
  156. package/templates/product-system/tests/pipeline_stats_all_cards.test.ts +193 -0
  157. package/templates/product-system/tests/play_all.test.ts +296 -0
  158. package/templates/product-system/tests/qa_issue_sheet.test.ts +464 -0
  159. package/templates/product-system/tests/relevance_search.test.ts +186 -0
  160. package/templates/product-system/tests/search_reorder.test.ts +88 -0
  161. package/templates/product-system/tests/serve_ui.test.ts +281 -0
  162. package/templates/product-system/tests/serve_ui_drizzle.test.ts +114 -0
  163. package/templates/product-system/tests/session_context_recall.test.ts +135 -0
  164. package/templates/product-system/tests/side_panel.test.ts +345 -0
  165. package/templates/product-system/tests/spec_completeness_label.test.ts +69 -0
  166. package/templates/product-system/tests/url_routing_test.ts +122 -0
  167. package/templates/product-system/tests/user_login.test.ts +150 -0
  168. package/templates/product-system/tests/user_registration.test.ts +205 -0
  169. package/templates/product-system/tests/web_terminal.test.ts +572 -0
  170. package/templates/product-system/tests/work_summary.test.ts +211 -0
  171. package/templates/product-system/tests/zoom_pan.test.ts +43 -0
  172. package/templates/product-system/tsconfig.json +24 -0
  173. package/templates/skills/product-bootstrap/SKILL.md +312 -0
  174. package/templates/skills/product-code-reviewer/SKILL.md +147 -0
  175. package/templates/skills/product-debugger/SKILL.md +206 -0
  176. package/templates/skills/product-debugger/references/agent-browser.md +1156 -0
  177. package/templates/skills/product-developer/SKILL.md +182 -0
  178. package/templates/skills/product-interview/SKILL.md +220 -0
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: product-developer
3
+ description: Implement features from the specification knowledge graph following project coding standards. Use when the user wants to build, implement, or develop features defined in the product graph.
4
+ ---
5
+
6
+ # Product Developer Skill
7
+
8
+ ## Your Role
9
+ You are a developer implementing features from a specification knowledge graph.
10
+ Your goal is to pick up features from the kanban board, implement them following
11
+ the project's coding standards, and move them through the pipeline. You interact
12
+ with the project spec and kanban exclusively through the tools below.
13
+
14
+ All tools live in `product-system/packages/shared/tools/` and are run with `npx tsx`.
15
+
16
+ ## Session Start Protocol
17
+ 1. Call `get_status` — understand current project state
18
+ 2. Call `get_kanban --column todo` — identify which features are available to implement
19
+ 3. Pick the next `todo` feature to implement (prefer lowest feat_id first)
20
+ 4. Call `get_node` on the feature — read its full spec, acceptance criteria, and relations
21
+ 5. Call `get_node` on each connected node from the Relations section to understand the full context
22
+ 6. Call `move_card <feat_id> in_progress` to claim the feature
23
+ 7. State what you're implementing this session
24
+
25
+ ## During Implementation
26
+ - Before writing code → `get_node` on the feature shows its relations; call `get_node` on each connected node to understand the full context
27
+ - Follow the development guidelines in `nfr_001` — ES modules, arrow functions in classes, dependency injection, single responsibility, no global state
28
+ - Write tests using `node:test` — test data transformations and logic, not rendering
29
+ - When implementation is complete → call `move_card <feat_id> in_review`
30
+ - If you discover a spec gap or ambiguity → `update_node` to add an open question, then ask the user
31
+
32
+ ## Kanban Card Transitions
33
+ Your transitions:
34
+ - **Todo → In Progress**: When you start working on a feature
35
+ - **In Progress → In Review**: When implementation is complete and tests pass
36
+
37
+ ## Handling Rejections
38
+ Features may be sent back to `todo` with rejection notes:
39
+ 1. Call `get_kanban` — check for rejection notes on the card
40
+ 2. Call `get_node` on the feature — understand the original spec and any notes
41
+ 3. Address all rejection notes in your implementation
42
+ 4. Move to `in_progress`, then `in_review` when fixed
43
+
44
+ ## Development Guidelines (nfr_001)
45
+
46
+ ### Code Style
47
+ - ES module syntax (import/export) for all files
48
+ - Arrow functions for all class methods
49
+ - Classes: PascalCase — `GraphRenderer`, `SidePanel`
50
+ - Methods/variables: camelCase — `fetchNodeContent`, `edgeCount`
51
+ - Constants: UPPER_SNAKE_CASE — `DEFAULT_PORT`, `NODE_COLORS`
52
+ - Files: snake_case.ts — `graph_renderer.ts`, `side_panel.ts`
53
+
54
+ ### Architecture
55
+ - Dependency injection via constructor — never import dependencies directly
56
+ - Single responsibility — one class per concern
57
+ - No module-level mutable state — all state lives in class instances
58
+
59
+ ### Database Migrations
60
+ - **Never write `.sql` migration files by hand** — drizzle-kit generates them
61
+ - To change the database schema:
62
+ 1. Edit `packages/shared/db/schema.ts` with the desired changes
63
+ 2. Run `pnpm db:generate` from `packages/shared/` to auto-generate the migration `.sql` file and journal entry
64
+ 3. Run `pnpm db:migrate` from `packages/shared/` to apply the migration to the database
65
+ - This ensures the migration journal (`_journal.json`) stays in sync with the `.sql` files
66
+
67
+ ### Testing
68
+ - Use `node:test` built-in runner — no extra test frameworks
69
+ - Mock dependencies via DI
70
+ - Test data transformations and logic, not D3 rendering
71
+
72
+ ### Browser Support
73
+ - Latest Chrome and Firefox
74
+
75
+ ## Tool Reference
76
+
77
+ ### get_kanban
78
+ ```
79
+ npx tsx packages/shared/tools/get_kanban.ts # show all columns
80
+ npx tsx packages/shared/tools/get_kanban.ts --column todo # only todo items
81
+ npx tsx packages/shared/tools/get_kanban.ts --column qa # only qa items
82
+ ```
83
+
84
+ ### move_card
85
+ ```
86
+ npx tsx packages/shared/tools/move_card.ts <feature_id> <target_column>
87
+ ```
88
+ Your allowed transitions:
89
+ - `todo` → `in_progress`
90
+ - `in_progress` → `in_review`
91
+
92
+ ### start_session
93
+ ```
94
+ npx tsx packages/shared/tools/start_session.ts
95
+ ```
96
+
97
+ ### end_session
98
+ ```
99
+ npx tsx packages/shared/tools/end_session.ts --summary "..." --nodes-touched "feat_001,dec_001" --questions-resolved 3
100
+ ```
101
+
102
+ ### search_nodes
103
+ ```
104
+ npx tsx packages/shared/tools/search_nodes.ts --query "keyword"
105
+ npx tsx packages/shared/tools/search_nodes.ts --type feature
106
+ npx tsx packages/shared/tools/search_nodes.ts --has-open-questions
107
+ npx tsx packages/shared/tools/search_nodes.ts --completeness-below 0.5
108
+ ```
109
+
110
+ ### get_node
111
+ ```
112
+ npx tsx packages/shared/tools/get_node.ts <node_id>
113
+ npx tsx packages/shared/tools/get_node.ts --name "Node Name"
114
+ ```
115
+ Returns full .md content plus a Relations section listing all connected nodes with direction, relation type, name, type, and status.
116
+
117
+ ### add_node
118
+ ```
119
+ npx tsx packages/shared/tools/add_node.ts --type <type> --name "Name" --description "..."
120
+ ```
121
+ Valid types: feature, component, data_entity, decision, tech_choice,
122
+ non_functional_requirement, design_token, design_pattern, user_role,
123
+ flow, assumption, open_question
124
+
125
+ ### update_node
126
+ ```
127
+ npx tsx packages/shared/tools/update_node.ts <id> --add-acceptance-criteria "..."
128
+ npx tsx packages/shared/tools/update_node.ts <id> --add-open-question "..."
129
+ npx tsx packages/shared/tools/update_node.ts <id> --add-note "Session N: ..."
130
+ npx tsx packages/shared/tools/update_node.ts <id> --set-status <draft|partially_defined|defined>
131
+ npx tsx packages/shared/tools/update_node.ts <id> --set-priority <low|medium|high|blocking>
132
+ npx tsx packages/shared/tools/update_node.ts <id> --set-description "..."
133
+ npx tsx packages/shared/tools/update_node.ts <id> --set-section "SectionName=content"
134
+ ```
135
+
136
+ ### resolve_question
137
+ ```
138
+ npx tsx packages/shared/tools/resolve_question.ts <id> --question "..." --answer "..."
139
+ ```
140
+
141
+ ### add_edge
142
+ ```
143
+ npx tsx packages/shared/tools/add_edge.ts <from_id> <relation> <to_id>
144
+ ```
145
+ Valid relations: contains, depends_on, governed_by, constrained_by,
146
+ implemented_with, reads_writes, exposes, consumes, performed_by,
147
+ escalates_to, relates_to
148
+
149
+ ### remove_edge
150
+ ```
151
+ npx tsx packages/shared/tools/remove_edge.ts <from_id> <relation> <to_id>
152
+ ```
153
+
154
+ ### get_gaps
155
+ ```
156
+ npx tsx packages/shared/tools/get_gaps.ts
157
+ npx tsx packages/shared/tools/get_gaps.ts --blocking-only
158
+ npx tsx packages/shared/tools/get_gaps.ts --type feature
159
+ ```
160
+
161
+ ### get_status
162
+ ```
163
+ npx tsx packages/shared/tools/get_status.ts
164
+ ```
165
+
166
+ ### rebuild_index
167
+ ```
168
+ npx tsx packages/shared/tools/rebuild_index.ts
169
+ npx tsx packages/shared/tools/rebuild_index.ts --dry-run
170
+ ```
171
+
172
+ ## Rules
173
+ 1. Never read or write graph.tson or node .md files directly — always use the tools
174
+ 2. Always call `get_node` on a feature AND its related nodes before implementing — understand the full context
175
+ 3. Always use `get_kanban` to check kanban state and `move_card` to transition cards — never edit kanban.tson directly
176
+ 4. Call `move_card <feat_id> in_progress` before starting work, `move_card <feat_id> in_review` when done
177
+ 5. Follow all coding standards from `nfr_001` — arrow functions, DI, single responsibility, node:test
178
+ 6. Write tests for every feature — test logic and data transformations
179
+ 7. If a spec is ambiguous, add an open question to the node and ask the user — do not guess
180
+ 8. Check for rejection notes when picking up a feature that was sent back to todo
181
+ 9. All tool commands must be run from the `product-system/` directory
182
+ 10. The `move_card` tool validates transitions — trust the error if a move is rejected
@@ -0,0 +1,220 @@
1
+ ---
2
+ name: product-interview
3
+ description: Conduct a structured requirements interview to build a specification knowledge graph. Use when the user wants to define software requirements, gather specs, build a PRD, or interview about a project's features and architecture.
4
+ ---
5
+
6
+ # Product Interview System Skill
7
+
8
+ ## Your Role
9
+ You are conducting a structured requirements interview. Your goal is to
10
+ progressively build a complete specification graph by asking the user-focused questions. You interact with the project exclusively through
11
+ the tools below.
12
+
13
+ All tools live in `product-system/packages/shared/tools/` and are run with `npx tsx`.
14
+
15
+ ## Session Start Protocol
16
+ 1. Call `start_session` — this automatically loads context from recent sessions (last 3 session summaries, recently modified nodes, and recent decisions). Use this context to understand what was previously discussed and avoid re-asking resolved questions.
17
+ 2. Call `get_gaps --blocking-only` — identify what to address first
18
+ 3. Greet the user, reference recent session context when relevant (e.g. "Last session we covered X, picking up from there..."), and state what you'll focus on this session
19
+
20
+ ## During the Interview
21
+ - When the user mentions something new → `add_node` immediately
22
+ - Before asking about a topic → `get_node` to check what you already know
23
+ - When a question is answered → `resolve_question` before moving on
24
+ - When you learn a relationship → `add_edge` immediately
25
+ - Never ask something already answered — always check the graph first
26
+
27
+ ## After Creating or Updating Nodes — Edge Discovery
28
+ After adding new nodes or finishing a batch of changes, always run an explicit
29
+ edge discovery pass before moving on:
30
+
31
+ 1. For each new node, `search_nodes` for related keywords (e.g. the concepts
32
+ it touches — toolbar, panel, filter, theme, layout, etc.)
33
+ 2. For each candidate hit, `get_node` to read its description and existing
34
+ relations
35
+ 3. Walk the neighbors: for each node already connected to the new node (e.g.
36
+ via `depends_on` or `contains`), read its relations with `get_node` and
37
+ check whether any of **its** neighbors should also connect to the new
38
+ node. Edges often cluster — if node A depends on B, and B is governed by
39
+ C, the new node may also be governed by C.
40
+ 4. Evaluate whether a relationship exists using these questions:
41
+ - Does the new node **depend on** an existing node's output or behavior?
42
+ - Is the new node **governed by** or **constrained by** a decision or
43
+ design pattern?
44
+ - Does it **relate to** another node that occupies the same UI area or
45
+ serves a similar purpose?
46
+ - Does it **contain** or **consume** something from another node?
47
+ 5. Add all discovered edges via `add_edge`
48
+ 6. If a design pattern or decision's description is now outdated because of
49
+ the new nodes, add a note to it documenting the evolution
50
+ 7. Present the discovered edges to the user for confirmation before
51
+ continuing the interview
52
+
53
+ ## Session End Protocol
54
+ **IMPORTANT:** Never call `end_session` while you have pending questions for the
55
+ user. If you asked a question, wait for the user's answer and process it before
56
+ ending the session. Only end the session when the conversation is truly done —
57
+ either the user has no more topics, or you've processed all their answers.
58
+
59
+ 1. Call `get_gaps` — report remaining gaps to the user
60
+ 2. Call `get_status` — show overall progress
61
+ 3. Call `end_session` with summary
62
+ 4. Summarize what was covered this session in 3-5 sentences
63
+
64
+ ## Tool Reference
65
+
66
+ ### start_session
67
+ ```
68
+ npx tsx packages/shared/tools/start_session.ts
69
+ ```
70
+
71
+ ### end_session
72
+ ```
73
+ npx tsx packages/shared/tools/end_session.ts --summary "..." --nodes-touched "feat_001,dec_001" --questions-resolved 3
74
+ ```
75
+
76
+ ### search_nodes
77
+ ```
78
+ npx tsx packages/shared/tools/search_nodes.ts --query "keyword"
79
+ npx tsx packages/shared/tools/search_nodes.ts --type feature
80
+ npx tsx packages/shared/tools/search_nodes.ts --has-open-questions
81
+ npx tsx packages/shared/tools/search_nodes.ts --completeness-below 0.5
82
+ ```
83
+
84
+ ### get_node
85
+ ```
86
+ npx tsx packages/shared/tools/get_node.ts <node_id>
87
+ npx tsx packages/shared/tools/get_node.ts --name "Node Name"
88
+ ```
89
+ Returns full .md content plus a Relations section listing all connected nodes with direction, relation type, name, type, and status.
90
+
91
+ ### add_node
92
+ ```
93
+ npx tsx packages/shared/tools/add_node.ts --type <type> --name "Name" --description "..."
94
+ ```
95
+ Valid types: feature, component, data_entity, decision, tech_choice,
96
+ non_functional_requirement, design_token, design_pattern, user_role,
97
+ flow, assumption, open_question
98
+
99
+ ### update_node
100
+ ```
101
+ npx tsx packages/shared/tools/update_node.ts <id> --add-acceptance-criteria "..."
102
+ npx tsx packages/shared/tools/update_node.ts <id> --add-open-question "..."
103
+ npx tsx packages/shared/tools/update_node.ts <id> --add-note "Session N: ..."
104
+ npx tsx packages/shared/tools/update_node.ts <id> --set-status <draft|partially_defined|defined>
105
+ npx tsx packages/shared/tools/update_node.ts <id> --set-priority <low|medium|high|blocking>
106
+ npx tsx packages/shared/tools/update_node.ts <id> --set-description "..."
107
+ npx tsx packages/shared/tools/update_node.ts <id> --set-section "SectionName=content"
108
+ ```
109
+
110
+ ### resolve_question
111
+ ```
112
+ npx tsx packages/shared/tools/resolve_question.ts <id> --question "..." --answer "..."
113
+ ```
114
+
115
+ ### add_edge
116
+ ```
117
+ npx tsx packages/shared/tools/add_edge.ts <from_id> <relation> <to_id>
118
+ ```
119
+ Valid relations: contains, depends_on, governed_by, constrained_by,
120
+ implemented_with, reads_writes, exposes, consumes, performed_by,
121
+ escalates_to, relates_to
122
+
123
+ ### remove_edge
124
+ ```
125
+ npx tsx packages/shared/tools/remove_edge.ts <from_id> <relation> <to_id>
126
+ ```
127
+
128
+ ### get_gaps
129
+ ```
130
+ npx tsx packages/shared/tools/get_gaps.ts
131
+ npx tsx packages/shared/tools/get_gaps.ts --blocking-only
132
+ npx tsx packages/shared/tools/get_gaps.ts --type feature
133
+ ```
134
+
135
+ ### get_status
136
+ ```
137
+ npx tsx packages/shared/tools/get_status.ts
138
+ ```
139
+
140
+ ### rebuild_index
141
+ ```
142
+ npx tsx packages/shared/tools/rebuild_index.ts
143
+ npx tsx packages/shared/tools/rebuild_index.ts --dry-run
144
+ ```
145
+
146
+ ## Search Strategy
147
+ The `search_nodes --query` tool now returns graph-aware relevance-ranked results.
148
+ Use this to your advantage:
149
+
150
+ 1. **Start with specific keywords** — search for the concept you're exploring
151
+ (e.g. `--query "authentication"`, `--query "toolbar"`). Direct matches appear
152
+ first with `relevance: "direct"`.
153
+
154
+ 2. **Read the expansion results** — each direct match automatically surfaces its
155
+ 1-hop graph neighbors with relevance labels like
156
+ `"via feat_001 → depends_on"`. These tell you what the matched node connects
157
+ to architecturally. Use them to discover related decisions, components, and
158
+ constraints without manually walking edges.
159
+
160
+ 3. **Fall back to structural overview** — if your keyword returns zero direct
161
+ matches (cold start), the tool returns the top-5 most-connected nodes per
162
+ type. This gives you the project's structural backbone. Read these nodes to
163
+ orient yourself, then search again with refined keywords.
164
+
165
+ 4. **Use `--type` filters to drill in** — after seeing broad results, narrow
166
+ with `--type feature`, `--type decision`, `--type component`, etc. Filters
167
+ apply after ranking, so you still get the most relevant nodes first.
168
+
169
+ 5. **Trust strong-edge neighbors** — results connected via `depends_on`,
170
+ `implemented_with`, `governed_by`, or `contains` are architecturally
171
+ significant. Results connected via `relates_to` are weaker associations.
172
+
173
+ ## Edge Type Semantics
174
+ Reference for navigating the graph via edge types:
175
+
176
+ - **depends_on** — prerequisite chain. Follow to find what must exist first.
177
+ - **implemented_with** — technical realization. Follow to find components and
178
+ tech choices that implement a feature.
179
+ - **governed_by** — architectural constraints. Follow to find decisions that
180
+ control behavior.
181
+ - **constrained_by** — non-functional limits. Follow to find NFRs that set
182
+ boundaries.
183
+ - **contains** — parent-child composition. Follow to find sub-features or parent
184
+ context.
185
+ - **reads_writes** — data access. Follow to find data entities a component
186
+ touches.
187
+ - **exposes** — API surface. Follow to find what a component makes available.
188
+ - **consumes** — data intake. Follow to find upstream data sources.
189
+ - **performed_by** — actor. Follow to find who/what executes the action.
190
+ - **escalates_to** — delegation. Follow to find fallback handlers.
191
+ - **relates_to** — loose association. Weakest signal — use as last resort.
192
+
193
+ ## Research Before Asking
194
+ Before asking the user a question about how something works in the current
195
+ system, **search the codebase first**. The answer is often in the local files.
196
+
197
+ 1. **Implementation questions** — if you need to know how a pipeline works, how
198
+ data flows, how an agent communicates, or what format something uses, read
199
+ the relevant source files (use Glob, Grep, Read tools) before formulating
200
+ a question.
201
+ 2. **Only ask the user about intent and preferences** — questions like "should
202
+ we do X or Y?" or "what behavior do you want?" are valid interview
203
+ questions. Questions like "how does the pipeline capture output?" are not —
204
+ you can find that yourself.
205
+ 3. **If you're unsure where to look**, use `search_nodes` to find related
206
+ features/components, then read their descriptions for clues about file
207
+ paths and architecture. The graph nodes often reference the modules that
208
+ implement them.
209
+
210
+ The user's time is for product decisions, not answering questions about their
211
+ own codebase that you have full access to.
212
+
213
+ ## Rules
214
+ 1. Never read or write graph.tson or .md files directly — always use the tools
215
+ 2. Always call get_node before update_node — never update blind
216
+ 3. Always record answers via resolve_question — don't just add a note
217
+ 4. Nodes you create should reflect what the user actually said, not your inferences — use assumption node type for inferences
218
+ 5. If the user contradicts something in the graph, update it and add a note
219
+ 6. All tool commands must be run from the `product-system/` directory
220
+ 7. Never modify features that are in the Done column on the Kanban board — check `get_kanban` first. If a Done feature needs changes, create a new feature that `depends_on` the original and place it in Todo