@stackmemoryai/stackmemory 1.0.1 → 1.2.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.
- package/dist/src/cli/claude-sm.js +65 -0
- package/dist/src/cli/commands/audit.js +134 -0
- package/dist/src/cli/commands/bench.js +252 -0
- package/dist/src/cli/commands/dashboard.js +2 -1
- package/dist/src/cli/commands/stats.js +118 -0
- package/dist/src/cli/index.js +6 -0
- package/dist/src/core/config/feature-flags.js +7 -1
- package/dist/src/core/context/enhanced-rehydration.js +24 -5
- package/dist/src/core/extensions/cerebras-adapter.js +28 -0
- package/dist/src/core/extensions/deepinfra-adapter.js +32 -0
- package/dist/src/core/extensions/provider-adapter.js +33 -240
- package/dist/src/core/models/complexity-scorer.js +154 -0
- package/dist/src/core/models/model-router.js +230 -36
- package/dist/src/core/models/provider-pricing.js +63 -0
- package/dist/src/core/models/sensitive-guard.js +112 -0
- package/dist/src/core/monitoring/feedback-loops.js +88 -0
- package/dist/src/hooks/schemas.js +12 -1
- package/dist/src/integrations/anthropic/batch-client.js +256 -0
- package/dist/src/integrations/anthropic/client.js +87 -72
- package/dist/src/integrations/claude-code/subagent-client.js +133 -12
- package/dist/src/integrations/graphiti/client.js +16 -4
- package/dist/src/integrations/mcp/handlers/index.js +25 -1
- package/dist/src/integrations/mcp/handlers/provider-handlers.js +227 -0
- package/dist/src/integrations/mcp/server.js +316 -1
- package/dist/src/integrations/mcp/tool-definitions.js +90 -1
- package/dist/src/orchestrators/multimodal/baselines.js +128 -0
- package/dist/src/orchestrators/multimodal/constants.js +9 -1
- package/dist/src/orchestrators/multimodal/harness.js +86 -6
- package/dist/src/orchestrators/multimodal/providers.js +113 -2
- package/dist/src/skills/recursive-agent-orchestrator.js +15 -10
- package/dist/src/utils/fuzzy-edit.js +162 -0
- package/dist/src/utils/hook-installer.js +155 -0
- package/package.json +6 -2
- package/scripts/gepa/.before-optimize.md +159 -0
- package/scripts/gepa/generations/gen-000/baseline.md +159 -124
- package/scripts/gepa/generations/gen-001/baseline.md +159 -0
- package/scripts/gepa/generations/gen-001/variant-a.md +166 -0
- package/scripts/gepa/generations/gen-001/variant-b.md +237 -0
- package/scripts/gepa/generations/gen-001/variant-c.md +61 -0
- package/scripts/gepa/generations/gen-001/variant-d.md +119 -0
- package/scripts/gepa/results/eval-1-baseline.json +41 -0
- package/scripts/gepa/results/eval-1-variant-a.json +41 -0
- package/scripts/gepa/results/eval-1-variant-b.json +41 -0
- package/scripts/gepa/results/eval-1-variant-c.json +41 -0
- package/scripts/gepa/results/eval-1-variant-d.json +41 -0
- package/scripts/gepa/state.json +41 -2
- package/scripts/install-claude-hooks-auto.js +176 -44
- package/templates/claude-hooks/auto-checkpoint.js +174 -0
- package/templates/claude-hooks/chime-on-stop.sh +22 -0
- package/templates/claude-hooks/session-rescue.sh +15 -0
- package/templates/claude-hooks/stop-checkpoint.js +120 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackmemoryai/stackmemory",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Project-scoped memory for AI coding tools. Durable context across sessions with MCP integration, frames, smart retrieval, Claude Code skills, and automatic hooks.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.0.0",
|
|
@@ -93,6 +93,10 @@
|
|
|
93
93
|
"format": "prettier --write src/**/*.ts scripts/**/*.ts",
|
|
94
94
|
"test": "vitest",
|
|
95
95
|
"test:ui": "vitest --ui",
|
|
96
|
+
"test:unit": "vitest run --project unit",
|
|
97
|
+
"test:integration": "vitest run --project integration",
|
|
98
|
+
"test:live": "vitest run --project live",
|
|
99
|
+
"test:all": "vitest run",
|
|
96
100
|
"test:run": "vitest run",
|
|
97
101
|
"test:pre-publish": "./scripts/test-pre-publish-quick.sh",
|
|
98
102
|
"test:pre-commit": "vitest related --run --reporter=dot --silent --bail=1",
|
|
@@ -167,7 +171,7 @@
|
|
|
167
171
|
"@types/better-sqlite3": "^7.6.8",
|
|
168
172
|
"@types/express": "^4.17.25",
|
|
169
173
|
"@types/js-yaml": "^4.0.9",
|
|
170
|
-
"@types/node": "^
|
|
174
|
+
"@types/node": "^22.0.0",
|
|
171
175
|
"@types/uuid": "^10.0.0",
|
|
172
176
|
"@types/ws": "^8.5.10",
|
|
173
177
|
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
AGENTS.md
|
|
2
|
+
|
|
3
|
+
Purpose
|
|
4
|
+
- A minimal, agent-friendly reference so code-generation agents (Codex, Claude Code, etc.) can work effectively in this repository.
|
|
5
|
+
- Explains key docs, the /designs/ folder, agent responsibilities, and quick operational notes (how to run tests, what to update, and commit expectations).
|
|
6
|
+
|
|
7
|
+
Repo doc descriptions
|
|
8
|
+
- prompt_plan.md
|
|
9
|
+
- The agent-driven plan that sequences work into small, testable prompts and steps.
|
|
10
|
+
- Contains per-step prompts, expected artifacts, tests, rollback/idempotency notes, and a TODO checklist using Markdown checkboxes.
|
|
11
|
+
- This is the canonical agent workflow driver — update it as you make progress (see Agent responsibility rules below).
|
|
12
|
+
|
|
13
|
+
- spec.md
|
|
14
|
+
- The minimal functional & technical specification that defines APIs, data models, and acceptance criteria.
|
|
15
|
+
- Includes the concise Definition of Done that must be satisfied for each plan step before marking it complete.
|
|
16
|
+
|
|
17
|
+
- idea.md
|
|
18
|
+
- Free-form brainstorming, assumptions, notes, research links, and open questions.
|
|
19
|
+
- Useful for context but not authoritative — always follow spec.md and prompt_plan.md for implementation decisions.
|
|
20
|
+
|
|
21
|
+
- idea_one_pager.md
|
|
22
|
+
- A short summary / one‑pager capturing Problem, Audience, Platform, Core Flow, and MVP Features (and optional Non‑Goals).
|
|
23
|
+
- Good for quick alignment and to confirm that work stays within scope.
|
|
24
|
+
|
|
25
|
+
What lives in /designs/
|
|
26
|
+
- UI/UX artifacts and visual assets that inform implementation:
|
|
27
|
+
- wireframes (PNG/SVG), Figma exports (.fig, .pdf), sequence diagrams, architecture diagrams (PNG/PDF/SVG), and annotated screenshots.
|
|
28
|
+
- Naming conventions: keep filenames short, include version/date and owner, e.g., dashboard_v1_2025-11-01.png or seq_query_flow_v2.pdf.
|
|
29
|
+
- Large source Figma files may live externally; include an export + a small README describing where the canonical design is stored and any viewing permissions required.
|
|
30
|
+
|
|
31
|
+
How agents should interact (summary)
|
|
32
|
+
- Treat prompt_plan.md as the authoritative workflow: follow the listed prompts in order and mark checklist items as you finish them.
|
|
33
|
+
- Always follow TDD: write tests first, make the minimal change to pass tests, then refactor while keeping tests green.
|
|
34
|
+
- After any code/test change, update the matching TODO checkbox in prompt_plan.md using the same Markdown checkbox format ('- [x]') and commit the change alongside code and tests.
|
|
35
|
+
- Make the smallest change that passes tests and improves code. Do not introduce new public APIs without updating spec.md and tests.
|
|
36
|
+
- Don't duplicate templates/files to work around errors — fix the original.
|
|
37
|
+
- Suggest a clear manual test path for every change (even when tests cover it).
|
|
38
|
+
- If you cannot open a file or content is missing, say so explicitly and stop. Do not guess.
|
|
39
|
+
|
|
40
|
+
Quick operational commands (expect these to exist; if not, ask)
|
|
41
|
+
- npm run dev — start local dev server
|
|
42
|
+
- npm test — run unit + integration test suite
|
|
43
|
+
- npm run lint — run linting
|
|
44
|
+
- npm run build — build TypeScript
|
|
45
|
+
- npm run migrate:up / migrate:down — database migrations
|
|
46
|
+
|
|
47
|
+
Commit & PR expectations
|
|
48
|
+
- Each prompt/plan step should result in a single, focused commit/PR with:
|
|
49
|
+
- Code + tests + prompt_plan.md checklist update.
|
|
50
|
+
- A short, copy-pasteable commit summary in the prompt_plan.md step completion entry.
|
|
51
|
+
- Clear CHANGELOG or Release notes entry if user-facing behavior changed (or explicitly state "No user-facing changes").
|
|
52
|
+
- Use atomic commits. Include test run results in PR description.
|
|
53
|
+
|
|
54
|
+
Include this governance / workflow block verbatim (do not modify)
|
|
55
|
+
## Repository docs
|
|
56
|
+
- 'ONE_PAGER.md' - Captures Problem, Audience, Platform, Core Flow, MVP Features; Non-Goals optional.
|
|
57
|
+
- 'DEV_SPEC.md' - Minimal functional and technical specification consistent with prior docs, including a concise **Definition of Done**.
|
|
58
|
+
- 'PROMPT_PLAN.md' - Agent-Ready Planner with per-step prompts, expected artifacts, tests, rollback notes, idempotency notes, and a TODO checklist using Markdown checkboxes. This file drives the agent workflow.
|
|
59
|
+
- 'docs/STYLE.md' - Unified design system reference. Typography, layout, color tokens, component patterns. Inspired by Hatchet (structural layout, inset panels) and Outliner (clean hierarchy, whitespace). **All dashboard UI changes must follow this guide.**
|
|
60
|
+
- 'AGENTS.md' - This file.
|
|
61
|
+
|
|
62
|
+
### Agent responsibility
|
|
63
|
+
- After completing any coding, refactor, or test step, **immediately update the corresponding TODO checklist item in 'prompt_plan.md'**.
|
|
64
|
+
- Use the same Markdown checkbox format ('- [x]') to mark completion.
|
|
65
|
+
- When creating new tasks or subtasks, add them directly under the appropriate section anchor in 'prompt_plan.md'.
|
|
66
|
+
- Always commit changes to 'prompt_plan.md' alongside the code and tests that fulfill them.
|
|
67
|
+
- Do not consider work "done" until the matching checklist item is checked and all related tests are green.
|
|
68
|
+
- When a stage (plan step) is complete with green tests, update the README "Release notes" section with any user-facing impact (or explicitly state "No user-facing changes" if applicable).
|
|
69
|
+
- Even when automated coverage exists, always suggest a feasible manual test path so the human can exercise the feature end-to-end.
|
|
70
|
+
- After a plan step is finished, document its completion state with a short checklist. Include: step name & number, test results, 'prompt_plan.md' status, manual checks performed (mark as complete only after the human confirms they ran to their satisfaction), release notes status, and an inline commit summary string the human can copy & paste.
|
|
71
|
+
|
|
72
|
+
#### Guardrails for agents
|
|
73
|
+
- Make the smallest change that passes tests and improves the code.
|
|
74
|
+
- Do not introduce new public APIs without updating 'spec.md' and relevant tests.
|
|
75
|
+
- Do not duplicate templates or files to work around issues. Fix the original.
|
|
76
|
+
- If a file cannot be opened or content is missing, say so explicitly and stop. Do not guess.
|
|
77
|
+
- Respect privacy and logging policy: do not log secrets, prompts, completions, or PII.
|
|
78
|
+
|
|
79
|
+
#### Deferred-work notation
|
|
80
|
+
- When a task is intentionally paused, keep its checkbox unchecked and prepend '(Deferred)' to the TODO label in 'prompt_plan.md', followed by a short reason.
|
|
81
|
+
- Apply the same '(Deferred)' tag to every downstream checklist item that depends on the paused work.
|
|
82
|
+
- Remove the tag only after the work resumes; this keeps the outstanding scope visible without implying completion.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
#### When the prompt plan is fully satisfied
|
|
87
|
+
- Once every Definition of Done task in 'prompt_plan.md' is either checked off or explicitly marked '(Deferred)', the plan is considered **complete**.
|
|
88
|
+
- After that point, you no longer need to update prompt-plan TODOs or reference 'prompt_plan.md', 'spec.md', 'idea_one_pager.md', or other upstream docs to justify changes.
|
|
89
|
+
- All other guardrails, testing requirements, and agent responsibilities in this file continue to apply unchanged.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Testing policy (non-negotiable)
|
|
95
|
+
- Tests **MUST** cover the functionality being implemented.
|
|
96
|
+
- **NEVER** ignore the output of the system or the tests - logs and messages often contain **CRITICAL** information.
|
|
97
|
+
- **TEST OUTPUT MUST BE PRISTINE TO PASS.**
|
|
98
|
+
- If logs are **supposed** to contain errors, capture and test it.
|
|
99
|
+
- **NO EXCEPTIONS POLICY:** Under no circumstances should you mark any test type as "not applicable". Every project, regardless of size or complexity, **MUST** have unit tests, integration tests, **AND** end-to-end tests. If you believe a test type doesn't apply, you need the human to say exactly **"I AUTHORIZE YOU TO SKIP WRITING TESTS THIS TIME"**.
|
|
100
|
+
|
|
101
|
+
### TDD (how we work)
|
|
102
|
+
- Write tests **before** implementation.
|
|
103
|
+
- Only write enough code to make the failing test pass.
|
|
104
|
+
- Refactor continuously while keeping tests green.
|
|
105
|
+
|
|
106
|
+
**TDD cycle**
|
|
107
|
+
1. Write a failing test that defines a desired function or improvement.
|
|
108
|
+
2. Run the test to confirm it fails as expected.
|
|
109
|
+
3. Write minimal code to make the test pass.
|
|
110
|
+
4. Run the test to confirm success.
|
|
111
|
+
5. Refactor while keeping tests green.
|
|
112
|
+
6. Repeat for each new feature or bugfix.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Important checks
|
|
117
|
+
- **NEVER** disable functionality to hide a failure. Fix root cause.
|
|
118
|
+
- **NEVER** create duplicate templates or files. Fix the original.
|
|
119
|
+
- **NEVER** claim something is "working" when any functionality is disabled or broken.
|
|
120
|
+
- If you can't open a file or access something requested, say so. Do not assume contents.
|
|
121
|
+
- **ALWAYS** identify and fix the root cause of template or compilation errors.
|
|
122
|
+
- If git is initialized, ensure a '.gitignore' exists and contains at least:
|
|
123
|
+
|
|
124
|
+
.env
|
|
125
|
+
.env.local
|
|
126
|
+
.env.*
|
|
127
|
+
|
|
128
|
+
Ask the human whether additional patterns should be added, and suggest any that you think are important given the project.
|
|
129
|
+
|
|
130
|
+
## When to ask for human input
|
|
131
|
+
Ask the human if any of the following is true:
|
|
132
|
+
- A test type appears "not applicable". Use the exact phrase request: **"I AUTHORIZE YOU TO SKIP WRITING TESTS THIS TIME"**.
|
|
133
|
+
- Required anchors conflict or are missing from upstream docs.
|
|
134
|
+
- You need new environment variables or secrets.
|
|
135
|
+
- An external dependency or major architectural change is required.
|
|
136
|
+
- Design files are missing, unsupported or oversized
|
|
137
|
+
|
|
138
|
+
(End of verbatim block)
|
|
139
|
+
|
|
140
|
+
Minimal examples for checklist updates (copy/pasteable)
|
|
141
|
+
- After completing a prompt step, add an entry under that step in prompt_plan.md similar to:
|
|
142
|
+
- [x] Step 5 — Implement POST /api/v1/query — tests green — manual checks: cURL example tested — README Release Notes updated — commit: "query: add /api/v1/query route, adapter integration, tests"
|
|
143
|
+
- If pausing work:
|
|
144
|
+
- - [ ] (Deferred) Step 7.3 — Implement real Pinecone adapter — blocked on PINECONE_API_KEY (reason: waiting for dev key from infra)
|
|
145
|
+
|
|
146
|
+
If anything is missing
|
|
147
|
+
- If you cannot open prompt_plan.md, spec.md, idea.md, idea_one_pager.md, or any design file, stop and report exactly which file and why (permission/absent/parse error).
|
|
148
|
+
- Ask for required secrets or permissions rather than guessing. Use the "When to ask for human input" rules above.
|
|
149
|
+
|
|
150
|
+
Contact & escalation
|
|
151
|
+
- When blocked on infra/secrets/design files, create a short note in prompt_plan.md under the current step and ping the human with:
|
|
152
|
+
- What I need: (e.g., PINECONE_API_KEY, AWS dev creds)
|
|
153
|
+
- Why I need it: (which step/blocker)
|
|
154
|
+
- Recommended minimal next action & fallback
|
|
155
|
+
|
|
156
|
+
Notes
|
|
157
|
+
- Keep AGENTS.md and the rest of the repo docs in sync. Update this file if workflow expectations change.
|
|
158
|
+
|
|
159
|
+
End.
|
|
@@ -1,124 +1,159 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
1
|
+
AGENTS.md
|
|
2
|
+
|
|
3
|
+
Purpose
|
|
4
|
+
- A minimal, agent-friendly reference so code-generation agents (Codex, Claude Code, etc.) can work effectively in this repository.
|
|
5
|
+
- Explains key docs, the /designs/ folder, agent responsibilities, and quick operational notes (how to run tests, what to update, and commit expectations).
|
|
6
|
+
|
|
7
|
+
Repo doc descriptions
|
|
8
|
+
- prompt_plan.md
|
|
9
|
+
- The agent-driven plan that sequences work into small, testable prompts and steps.
|
|
10
|
+
- Contains per-step prompts, expected artifacts, tests, rollback/idempotency notes, and a TODO checklist using Markdown checkboxes.
|
|
11
|
+
- This is the canonical agent workflow driver — update it as you make progress (see Agent responsibility rules below).
|
|
12
|
+
|
|
13
|
+
- spec.md
|
|
14
|
+
- The minimal functional & technical specification that defines APIs, data models, and acceptance criteria.
|
|
15
|
+
- Includes the concise Definition of Done that must be satisfied for each plan step before marking it complete.
|
|
16
|
+
|
|
17
|
+
- idea.md
|
|
18
|
+
- Free-form brainstorming, assumptions, notes, research links, and open questions.
|
|
19
|
+
- Useful for context but not authoritative — always follow spec.md and prompt_plan.md for implementation decisions.
|
|
20
|
+
|
|
21
|
+
- idea_one_pager.md
|
|
22
|
+
- A short summary / one‑pager capturing Problem, Audience, Platform, Core Flow, and MVP Features (and optional Non‑Goals).
|
|
23
|
+
- Good for quick alignment and to confirm that work stays within scope.
|
|
24
|
+
|
|
25
|
+
What lives in /designs/
|
|
26
|
+
- UI/UX artifacts and visual assets that inform implementation:
|
|
27
|
+
- wireframes (PNG/SVG), Figma exports (.fig, .pdf), sequence diagrams, architecture diagrams (PNG/PDF/SVG), and annotated screenshots.
|
|
28
|
+
- Naming conventions: keep filenames short, include version/date and owner, e.g., dashboard_v1_2025-11-01.png or seq_query_flow_v2.pdf.
|
|
29
|
+
- Large source Figma files may live externally; include an export + a small README describing where the canonical design is stored and any viewing permissions required.
|
|
30
|
+
|
|
31
|
+
How agents should interact (summary)
|
|
32
|
+
- Treat prompt_plan.md as the authoritative workflow: follow the listed prompts in order and mark checklist items as you finish them.
|
|
33
|
+
- Always follow TDD: write tests first, make the minimal change to pass tests, then refactor while keeping tests green.
|
|
34
|
+
- After any code/test change, update the matching TODO checkbox in prompt_plan.md using the same Markdown checkbox format ('- [x]') and commit the change alongside code and tests.
|
|
35
|
+
- Make the smallest change that passes tests and improves code. Do not introduce new public APIs without updating spec.md and tests.
|
|
36
|
+
- Don't duplicate templates/files to work around errors — fix the original.
|
|
37
|
+
- Suggest a clear manual test path for every change (even when tests cover it).
|
|
38
|
+
- If you cannot open a file or content is missing, say so explicitly and stop. Do not guess.
|
|
39
|
+
|
|
40
|
+
Quick operational commands (expect these to exist; if not, ask)
|
|
41
|
+
- npm run dev — start local dev server
|
|
42
|
+
- npm test — run unit + integration test suite
|
|
43
|
+
- npm run lint — run linting
|
|
44
|
+
- npm run build — build TypeScript
|
|
45
|
+
- npm run migrate:up / migrate:down — database migrations
|
|
46
|
+
|
|
47
|
+
Commit & PR expectations
|
|
48
|
+
- Each prompt/plan step should result in a single, focused commit/PR with:
|
|
49
|
+
- Code + tests + prompt_plan.md checklist update.
|
|
50
|
+
- A short, copy-pasteable commit summary in the prompt_plan.md step completion entry.
|
|
51
|
+
- Clear CHANGELOG or Release notes entry if user-facing behavior changed (or explicitly state "No user-facing changes").
|
|
52
|
+
- Use atomic commits. Include test run results in PR description.
|
|
53
|
+
|
|
54
|
+
Include this governance / workflow block verbatim (do not modify)
|
|
55
|
+
## Repository docs
|
|
56
|
+
- 'ONE_PAGER.md' - Captures Problem, Audience, Platform, Core Flow, MVP Features; Non-Goals optional.
|
|
57
|
+
- 'DEV_SPEC.md' - Minimal functional and technical specification consistent with prior docs, including a concise **Definition of Done**.
|
|
58
|
+
- 'PROMPT_PLAN.md' - Agent-Ready Planner with per-step prompts, expected artifacts, tests, rollback notes, idempotency notes, and a TODO checklist using Markdown checkboxes. This file drives the agent workflow.
|
|
59
|
+
- 'docs/STYLE.md' - Unified design system reference. Typography, layout, color tokens, component patterns. Inspired by Hatchet (structural layout, inset panels) and Outliner (clean hierarchy, whitespace). **All dashboard UI changes must follow this guide.**
|
|
60
|
+
- 'AGENTS.md' - This file.
|
|
61
|
+
|
|
62
|
+
### Agent responsibility
|
|
63
|
+
- After completing any coding, refactor, or test step, **immediately update the corresponding TODO checklist item in 'prompt_plan.md'**.
|
|
64
|
+
- Use the same Markdown checkbox format ('- [x]') to mark completion.
|
|
65
|
+
- When creating new tasks or subtasks, add them directly under the appropriate section anchor in 'prompt_plan.md'.
|
|
66
|
+
- Always commit changes to 'prompt_plan.md' alongside the code and tests that fulfill them.
|
|
67
|
+
- Do not consider work "done" until the matching checklist item is checked and all related tests are green.
|
|
68
|
+
- When a stage (plan step) is complete with green tests, update the README "Release notes" section with any user-facing impact (or explicitly state "No user-facing changes" if applicable).
|
|
69
|
+
- Even when automated coverage exists, always suggest a feasible manual test path so the human can exercise the feature end-to-end.
|
|
70
|
+
- After a plan step is finished, document its completion state with a short checklist. Include: step name & number, test results, 'prompt_plan.md' status, manual checks performed (mark as complete only after the human confirms they ran to their satisfaction), release notes status, and an inline commit summary string the human can copy & paste.
|
|
71
|
+
|
|
72
|
+
#### Guardrails for agents
|
|
73
|
+
- Make the smallest change that passes tests and improves the code.
|
|
74
|
+
- Do not introduce new public APIs without updating 'spec.md' and relevant tests.
|
|
75
|
+
- Do not duplicate templates or files to work around issues. Fix the original.
|
|
76
|
+
- If a file cannot be opened or content is missing, say so explicitly and stop. Do not guess.
|
|
77
|
+
- Respect privacy and logging policy: do not log secrets, prompts, completions, or PII.
|
|
78
|
+
|
|
79
|
+
#### Deferred-work notation
|
|
80
|
+
- When a task is intentionally paused, keep its checkbox unchecked and prepend '(Deferred)' to the TODO label in 'prompt_plan.md', followed by a short reason.
|
|
81
|
+
- Apply the same '(Deferred)' tag to every downstream checklist item that depends on the paused work.
|
|
82
|
+
- Remove the tag only after the work resumes; this keeps the outstanding scope visible without implying completion.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
#### When the prompt plan is fully satisfied
|
|
87
|
+
- Once every Definition of Done task in 'prompt_plan.md' is either checked off or explicitly marked '(Deferred)', the plan is considered **complete**.
|
|
88
|
+
- After that point, you no longer need to update prompt-plan TODOs or reference 'prompt_plan.md', 'spec.md', 'idea_one_pager.md', or other upstream docs to justify changes.
|
|
89
|
+
- All other guardrails, testing requirements, and agent responsibilities in this file continue to apply unchanged.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Testing policy (non-negotiable)
|
|
95
|
+
- Tests **MUST** cover the functionality being implemented.
|
|
96
|
+
- **NEVER** ignore the output of the system or the tests - logs and messages often contain **CRITICAL** information.
|
|
97
|
+
- **TEST OUTPUT MUST BE PRISTINE TO PASS.**
|
|
98
|
+
- If logs are **supposed** to contain errors, capture and test it.
|
|
99
|
+
- **NO EXCEPTIONS POLICY:** Under no circumstances should you mark any test type as "not applicable". Every project, regardless of size or complexity, **MUST** have unit tests, integration tests, **AND** end-to-end tests. If you believe a test type doesn't apply, you need the human to say exactly **"I AUTHORIZE YOU TO SKIP WRITING TESTS THIS TIME"**.
|
|
100
|
+
|
|
101
|
+
### TDD (how we work)
|
|
102
|
+
- Write tests **before** implementation.
|
|
103
|
+
- Only write enough code to make the failing test pass.
|
|
104
|
+
- Refactor continuously while keeping tests green.
|
|
105
|
+
|
|
106
|
+
**TDD cycle**
|
|
107
|
+
1. Write a failing test that defines a desired function or improvement.
|
|
108
|
+
2. Run the test to confirm it fails as expected.
|
|
109
|
+
3. Write minimal code to make the test pass.
|
|
110
|
+
4. Run the test to confirm success.
|
|
111
|
+
5. Refactor while keeping tests green.
|
|
112
|
+
6. Repeat for each new feature or bugfix.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Important checks
|
|
117
|
+
- **NEVER** disable functionality to hide a failure. Fix root cause.
|
|
118
|
+
- **NEVER** create duplicate templates or files. Fix the original.
|
|
119
|
+
- **NEVER** claim something is "working" when any functionality is disabled or broken.
|
|
120
|
+
- If you can't open a file or access something requested, say so. Do not assume contents.
|
|
121
|
+
- **ALWAYS** identify and fix the root cause of template or compilation errors.
|
|
122
|
+
- If git is initialized, ensure a '.gitignore' exists and contains at least:
|
|
123
|
+
|
|
124
|
+
.env
|
|
125
|
+
.env.local
|
|
126
|
+
.env.*
|
|
127
|
+
|
|
128
|
+
Ask the human whether additional patterns should be added, and suggest any that you think are important given the project.
|
|
129
|
+
|
|
130
|
+
## When to ask for human input
|
|
131
|
+
Ask the human if any of the following is true:
|
|
132
|
+
- A test type appears "not applicable". Use the exact phrase request: **"I AUTHORIZE YOU TO SKIP WRITING TESTS THIS TIME"**.
|
|
133
|
+
- Required anchors conflict or are missing from upstream docs.
|
|
134
|
+
- You need new environment variables or secrets.
|
|
135
|
+
- An external dependency or major architectural change is required.
|
|
136
|
+
- Design files are missing, unsupported or oversized
|
|
137
|
+
|
|
138
|
+
(End of verbatim block)
|
|
139
|
+
|
|
140
|
+
Minimal examples for checklist updates (copy/pasteable)
|
|
141
|
+
- After completing a prompt step, add an entry under that step in prompt_plan.md similar to:
|
|
142
|
+
- [x] Step 5 — Implement POST /api/v1/query — tests green — manual checks: cURL example tested — README Release Notes updated — commit: "query: add /api/v1/query route, adapter integration, tests"
|
|
143
|
+
- If pausing work:
|
|
144
|
+
- - [ ] (Deferred) Step 7.3 — Implement real Pinecone adapter — blocked on PINECONE_API_KEY (reason: waiting for dev key from infra)
|
|
145
|
+
|
|
146
|
+
If anything is missing
|
|
147
|
+
- If you cannot open prompt_plan.md, spec.md, idea.md, idea_one_pager.md, or any design file, stop and report exactly which file and why (permission/absent/parse error).
|
|
148
|
+
- Ask for required secrets or permissions rather than guessing. Use the "When to ask for human input" rules above.
|
|
149
|
+
|
|
150
|
+
Contact & escalation
|
|
151
|
+
- When blocked on infra/secrets/design files, create a short note in prompt_plan.md under the current step and ping the human with:
|
|
152
|
+
- What I need: (e.g., PINECONE_API_KEY, AWS dev creds)
|
|
153
|
+
- Why I need it: (which step/blocker)
|
|
154
|
+
- Recommended minimal next action & fallback
|
|
155
|
+
|
|
156
|
+
Notes
|
|
157
|
+
- Keep AGENTS.md and the rest of the repo docs in sync. Update this file if workflow expectations change.
|
|
158
|
+
|
|
159
|
+
End.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
AGENTS.md
|
|
2
|
+
|
|
3
|
+
Purpose
|
|
4
|
+
- A minimal, agent-friendly reference so code-generation agents (Codex, Claude Code, etc.) can work effectively in this repository.
|
|
5
|
+
- Explains key docs, the /designs/ folder, agent responsibilities, and quick operational notes (how to run tests, what to update, and commit expectations).
|
|
6
|
+
|
|
7
|
+
Repo doc descriptions
|
|
8
|
+
- prompt_plan.md
|
|
9
|
+
- The agent-driven plan that sequences work into small, testable prompts and steps.
|
|
10
|
+
- Contains per-step prompts, expected artifacts, tests, rollback/idempotency notes, and a TODO checklist using Markdown checkboxes.
|
|
11
|
+
- This is the canonical agent workflow driver — update it as you make progress (see Agent responsibility rules below).
|
|
12
|
+
|
|
13
|
+
- spec.md
|
|
14
|
+
- The minimal functional & technical specification that defines APIs, data models, and acceptance criteria.
|
|
15
|
+
- Includes the concise Definition of Done that must be satisfied for each plan step before marking it complete.
|
|
16
|
+
|
|
17
|
+
- idea.md
|
|
18
|
+
- Free-form brainstorming, assumptions, notes, research links, and open questions.
|
|
19
|
+
- Useful for context but not authoritative — always follow spec.md and prompt_plan.md for implementation decisions.
|
|
20
|
+
|
|
21
|
+
- idea_one_pager.md
|
|
22
|
+
- A short summary / one‑pager capturing Problem, Audience, Platform, Core Flow, and MVP Features (and optional Non‑Goals).
|
|
23
|
+
- Good for quick alignment and to confirm that work stays within scope.
|
|
24
|
+
|
|
25
|
+
What lives in /designs/
|
|
26
|
+
- UI/UX artifacts and visual assets that inform implementation:
|
|
27
|
+
- wireframes (PNG/SVG), Figma exports (.fig, .pdf), sequence diagrams, architecture diagrams (PNG/PDF/SVG), and annotated screenshots.
|
|
28
|
+
- Naming conventions: keep filenames short, include version/date and owner, e.g., dashboard_v1_2025-11-01.png or seq_query_flow_v2.pdf.
|
|
29
|
+
- Large source Figma files may live externally; include an export + a small README describing where the canonical design is stored and any viewing permissions required.
|
|
30
|
+
|
|
31
|
+
How agents should interact (summary)
|
|
32
|
+
- Treat prompt_plan.md as the authoritative workflow: follow the listed prompts in order and mark checklist items as you finish them.
|
|
33
|
+
- Always follow TDD: write tests first, make the minimal change to pass tests, then refactor while keeping tests green.
|
|
34
|
+
- After any code/test change, update the matching TODO checkbox in prompt_plan.md using the same Markdown checkbox format ('- [x]') and commit the change alongside code and tests.
|
|
35
|
+
- Make the smallest change that passes tests and improves code. Do not introduce new public APIs without updating spec.md and tests.
|
|
36
|
+
- Don't duplicate templates/files to work around errors — fix the original.
|
|
37
|
+
- Suggest a clear manual test path for every change (even when tests cover it).
|
|
38
|
+
- If you cannot open a file or content is missing, say so explicitly and stop. Do not guess.
|
|
39
|
+
|
|
40
|
+
Quick operational commands (expect these to exist; if not, ask)
|
|
41
|
+
- npm run dev — start local dev server
|
|
42
|
+
- npm test — run unit + integration test suite
|
|
43
|
+
- npm run lint — run linting
|
|
44
|
+
- npm run build — build TypeScript
|
|
45
|
+
- npm run migrate:up / migrate:down — database migrations
|
|
46
|
+
|
|
47
|
+
Commit & PR expectations
|
|
48
|
+
- Each prompt/plan step should result in a single, focused commit/PR with:
|
|
49
|
+
- Code + tests + prompt_plan.md checklist update.
|
|
50
|
+
- A short, copy-pasteable commit summary in the prompt_plan.md step completion entry.
|
|
51
|
+
- Clear CHANGELOG or Release notes entry if user-facing behavior changed (or explicitly state "No user-facing changes").
|
|
52
|
+
- Use atomic commits. Include test run results in PR description.
|
|
53
|
+
|
|
54
|
+
Include this governance / workflow block verbatim (do not modify)
|
|
55
|
+
## Repository docs
|
|
56
|
+
- 'ONE_PAGER.md' - Captures Problem, Audience, Platform, Core Flow, MVP Features; Non-Goals optional.
|
|
57
|
+
- 'DEV_SPEC.md' - Minimal functional and technical specification consistent with prior docs, including a concise **Definition of Done**.
|
|
58
|
+
- 'PROMPT_PLAN.md' - Agent-Ready Planner with per-step prompts, expected artifacts, tests, rollback notes, idempotency notes, and a TODO checklist using Markdown checkboxes. This file drives the agent workflow.
|
|
59
|
+
- 'docs/STYLE.md' - Unified design system reference. Typography, layout, color tokens, component patterns. Inspired by Hatchet (structural layout, inset panels) and Outliner (clean hierarchy, whitespace). **All dashboard UI changes must follow this guide.**
|
|
60
|
+
- 'AGENTS.md' - This file.
|
|
61
|
+
|
|
62
|
+
### Agent responsibility
|
|
63
|
+
- After completing any coding, refactor, or test step, **immediately update the corresponding TODO checklist item in 'prompt_plan.md'**.
|
|
64
|
+
- Use the same Markdown checkbox format ('- [x]') to mark completion.
|
|
65
|
+
- When creating new tasks or subtasks, add them directly under the appropriate section anchor in 'prompt_plan.md'.
|
|
66
|
+
- Always commit changes to 'prompt_plan.md' alongside the code and tests that fulfill them.
|
|
67
|
+
- Do not consider work "done" until the matching checklist item is checked and all related tests are green.
|
|
68
|
+
- When a stage (plan step) is complete with green tests, update the README "Release notes" section with any user-facing impact (or explicitly state "No user-facing changes" if applicable).
|
|
69
|
+
- Even when automated coverage exists, always suggest a feasible manual test path so the human can exercise the feature end-to-end.
|
|
70
|
+
- After a plan step is finished, document its completion state with a short checklist. Include: step name & number, test results, 'prompt_plan.md' status, manual checks performed (mark as complete only after the human confirms they ran to their satisfaction), release notes status, and an inline commit summary string the human can copy & paste.
|
|
71
|
+
|
|
72
|
+
#### Guardrails for agents
|
|
73
|
+
- Make the smallest change that passes tests and improves the code.
|
|
74
|
+
- Do not introduce new public APIs without updating 'spec.md' and relevant tests.
|
|
75
|
+
- Do not duplicate templates or files to work around issues. Fix the original.
|
|
76
|
+
- If a file cannot be opened or content is missing, say so explicitly and stop. Do not guess.
|
|
77
|
+
- Respect privacy and logging policy: do not log secrets, prompts, completions, or PII.
|
|
78
|
+
|
|
79
|
+
#### Deferred-work notation
|
|
80
|
+
- When a task is intentionally paused, keep its checkbox unchecked and prepend '(Deferred)' to the TODO label in 'prompt_plan.md', followed by a short reason.
|
|
81
|
+
- Apply the same '(Deferred)' tag to every downstream checklist item that depends on the paused work.
|
|
82
|
+
- Remove the tag only after the work resumes; this keeps the outstanding scope visible without implying completion.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
#### When the prompt plan is fully satisfied
|
|
87
|
+
- Once every Definition of Done task in 'prompt_plan.md' is either checked off or explicitly marked '(Deferred)', the plan is considered **complete**.
|
|
88
|
+
- After that point, you no longer need to update prompt-plan TODOs or reference 'prompt_plan.md', 'spec.md', 'idea_one_pager.md', or other upstream docs to justify changes.
|
|
89
|
+
- All other guardrails, testing requirements, and agent responsibilities in this file continue to apply unchanged.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Testing policy (non-negotiable)
|
|
95
|
+
- Tests **MUST** cover the functionality being implemented.
|
|
96
|
+
- **NEVER** ignore the output of the system or the tests - logs and messages often contain **CRITICAL** information.
|
|
97
|
+
- **TEST OUTPUT MUST BE PRISTINE TO PASS.**
|
|
98
|
+
- If logs are **supposed** to contain errors, capture and test it.
|
|
99
|
+
- **NO EXCEPTIONS POLICY:** Under no circumstances should you mark any test type as "not applicable". Every project, regardless of size or complexity, **MUST** have unit tests, integration tests, **AND** end-to-end tests. If you believe a test type doesn't apply, you need the human to say exactly **"I AUTHORIZE YOU TO SKIP WRITING TESTS THIS TIME"**.
|
|
100
|
+
|
|
101
|
+
### TDD (how we work)
|
|
102
|
+
- Write tests **before** implementation.
|
|
103
|
+
- Only write enough code to make the failing test pass.
|
|
104
|
+
- Refactor continuously while keeping tests green.
|
|
105
|
+
|
|
106
|
+
**TDD cycle**
|
|
107
|
+
1. Write a failing test that defines a desired function or improvement.
|
|
108
|
+
2. Run the test to confirm it fails as expected.
|
|
109
|
+
3. Write minimal code to make the test pass.
|
|
110
|
+
4. Run the test to confirm success.
|
|
111
|
+
5. Refactor while keeping tests green.
|
|
112
|
+
6. Repeat for each new feature or bugfix.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Important checks
|
|
117
|
+
- **NEVER** disable functionality to hide a failure. Fix root cause.
|
|
118
|
+
- **NEVER** create duplicate templates or files. Fix the original.
|
|
119
|
+
- **NEVER** claim something is "working" when any functionality is disabled or broken.
|
|
120
|
+
- If you can't open a file or access something requested, say so. Do not assume contents.
|
|
121
|
+
- **ALWAYS** identify and fix the root cause of template or compilation errors.
|
|
122
|
+
- If git is initialized, ensure a '.gitignore' exists and contains at least:
|
|
123
|
+
|
|
124
|
+
.env
|
|
125
|
+
.env.local
|
|
126
|
+
.env.*
|
|
127
|
+
|
|
128
|
+
Ask the human whether additional patterns should be added, and suggest any that you think are important given the project.
|
|
129
|
+
|
|
130
|
+
## When to ask for human input
|
|
131
|
+
Ask the human if any of the following is true:
|
|
132
|
+
- A test type appears "not applicable". Use the exact phrase request: **"I AUTHORIZE YOU TO SKIP WRITING TESTS THIS TIME"**.
|
|
133
|
+
- Required anchors conflict or are missing from upstream docs.
|
|
134
|
+
- You need new environment variables or secrets.
|
|
135
|
+
- An external dependency or major architectural change is required.
|
|
136
|
+
- Design files are missing, unsupported or oversized
|
|
137
|
+
|
|
138
|
+
(End of verbatim block)
|
|
139
|
+
|
|
140
|
+
Minimal examples for checklist updates (copy/pasteable)
|
|
141
|
+
- After completing a prompt step, add an entry under that step in prompt_plan.md similar to:
|
|
142
|
+
- [x] Step 5 — Implement POST /api/v1/query — tests green — manual checks: cURL example tested — README Release Notes updated — commit: "query: add /api/v1/query route, adapter integration, tests"
|
|
143
|
+
- If pausing work:
|
|
144
|
+
- - [ ] (Deferred) Step 7.3 — Implement real Pinecone adapter — blocked on PINECONE_API_KEY (reason: waiting for dev key from infra)
|
|
145
|
+
|
|
146
|
+
If anything is missing
|
|
147
|
+
- If you cannot open prompt_plan.md, spec.md, idea.md, idea_one_pager.md, or any design file, stop and report exactly which file and why (permission/absent/parse error).
|
|
148
|
+
- Ask for required secrets or permissions rather than guessing. Use the "When to ask for human input" rules above.
|
|
149
|
+
|
|
150
|
+
Contact & escalation
|
|
151
|
+
- When blocked on infra/secrets/design files, create a short note in prompt_plan.md under the current step and ping the human with:
|
|
152
|
+
- What I need: (e.g., PINECONE_API_KEY, AWS dev creds)
|
|
153
|
+
- Why I need it: (which step/blocker)
|
|
154
|
+
- Recommended minimal next action & fallback
|
|
155
|
+
|
|
156
|
+
Notes
|
|
157
|
+
- Keep AGENTS.md and the rest of the repo docs in sync. Update this file if workflow expectations change.
|
|
158
|
+
|
|
159
|
+
End.
|