jorgex-stack 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 (124) hide show
  1. package/LICENSE +21 -0
  2. package/PRD.md +297 -0
  3. package/README.md +58 -0
  4. package/dist/cli.js +2894 -0
  5. package/package.json +51 -0
  6. package/stack/agents/README.md +33 -0
  7. package/stack/agents/backend-analyst.md +61 -0
  8. package/stack/agents/code-reviewer.md +66 -0
  9. package/stack/agents/code-simplifier.md +81 -0
  10. package/stack/agents/comment-fixer.md +54 -0
  11. package/stack/agents/docs-maintainer.md +88 -0
  12. package/stack/agents/engram.md +124 -0
  13. package/stack/agents/frontend-analyst.md +51 -0
  14. package/stack/agents/implementer.md +55 -0
  15. package/stack/agents/orchestrator.md +192 -0
  16. package/stack/agents/security-auditor.md +66 -0
  17. package/stack/agents/silent-failure-hunter.md +167 -0
  18. package/stack/agents/test-analyzer.md +91 -0
  19. package/stack/agents/tester.md +71 -0
  20. package/stack/agents/translator.md +101 -0
  21. package/stack/agents/type-design-analyzer.md +128 -0
  22. package/stack/commands/xreview.md +80 -0
  23. package/stack/config/defaults.json +37 -0
  24. package/stack/hooks/hooks.json +18 -0
  25. package/stack/mcp/servers.json +19 -0
  26. package/stack/plugins/opencode/engram.ts +378 -0
  27. package/stack/plugins/opencode/hooks.ts +766 -0
  28. package/stack/plugins/opencode/package.json +10 -0
  29. package/stack/plugins/opencode/worktree.ts +405 -0
  30. package/stack/scripts/post-pr-review.cjs +156 -0
  31. package/stack/skills/agent-browser/SKILL.md +55 -0
  32. package/stack/skills/agent-delegation/SKILL.md +58 -0
  33. package/stack/skills/deploy-to-vercel/SKILL.md +296 -0
  34. package/stack/skills/deploy-to-vercel/resources/deploy-codex.sh +301 -0
  35. package/stack/skills/deploy-to-vercel/resources/deploy.sh +301 -0
  36. package/stack/skills/diagnose/SKILL.md +117 -0
  37. package/stack/skills/diagnose/scripts/hitl-loop.template.sh +41 -0
  38. package/stack/skills/find-skills/SKILL.md +133 -0
  39. package/stack/skills/graphify/.graphify_version +1 -0
  40. package/stack/skills/graphify/SKILL.md +1319 -0
  41. package/stack/skills/mcp-builder/LICENSE.txt +202 -0
  42. package/stack/skills/mcp-builder/SKILL.md +236 -0
  43. package/stack/skills/mcp-builder/reference/evaluation.md +602 -0
  44. package/stack/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
  45. package/stack/skills/mcp-builder/reference/node_mcp_server.md +970 -0
  46. package/stack/skills/mcp-builder/reference/python_mcp_server.md +719 -0
  47. package/stack/skills/mcp-builder/scripts/connections.py +151 -0
  48. package/stack/skills/mcp-builder/scripts/evaluation.py +373 -0
  49. package/stack/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  50. package/stack/skills/mcp-builder/scripts/requirements.txt +2 -0
  51. package/stack/skills/obsidian-cli/SKILL.md +106 -0
  52. package/stack/skills/obsidian-markdown/SKILL.md +196 -0
  53. package/stack/skills/obsidian-markdown/references/CALLOUTS.md +58 -0
  54. package/stack/skills/obsidian-markdown/references/EMBEDS.md +63 -0
  55. package/stack/skills/obsidian-markdown/references/PROPERTIES.md +61 -0
  56. package/stack/skills/react-doctor/SKILL.md +19 -0
  57. package/stack/skills/skill-creator/LICENSE.txt +202 -0
  58. package/stack/skills/skill-creator/SKILL.md +485 -0
  59. package/stack/skills/skill-creator/agents/analyzer.md +274 -0
  60. package/stack/skills/skill-creator/agents/comparator.md +202 -0
  61. package/stack/skills/skill-creator/agents/grader.md +223 -0
  62. package/stack/skills/skill-creator/assets/eval_review.html +146 -0
  63. package/stack/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  64. package/stack/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  65. package/stack/skills/skill-creator/references/schemas.md +430 -0
  66. package/stack/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  67. package/stack/skills/skill-creator/scripts/generate_report.py +326 -0
  68. package/stack/skills/skill-creator/scripts/improve_description.py +248 -0
  69. package/stack/skills/skill-creator/scripts/package_skill.py +136 -0
  70. package/stack/skills/skill-creator/scripts/quick_validate.py +103 -0
  71. package/stack/skills/skill-creator/scripts/run_eval.py +310 -0
  72. package/stack/skills/skill-creator/scripts/run_loop.py +332 -0
  73. package/stack/skills/skill-creator/scripts/utils.py +47 -0
  74. package/stack/skills/supabase/SKILL.md +135 -0
  75. package/stack/skills/supabase/assets/feedback-issue-template.md +17 -0
  76. package/stack/skills/supabase/references/skill-feedback.md +17 -0
  77. package/stack/skills/supabase-postgres-best-practices/SKILL.md +64 -0
  78. package/stack/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
  79. package/stack/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
  80. package/stack/skills/supabase-postgres-best-practices/references/_template.md +34 -0
  81. package/stack/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
  82. package/stack/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
  83. package/stack/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
  84. package/stack/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
  85. package/stack/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
  86. package/stack/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
  87. package/stack/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
  88. package/stack/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
  89. package/stack/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
  90. package/stack/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
  91. package/stack/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
  92. package/stack/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
  93. package/stack/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
  94. package/stack/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
  95. package/stack/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
  96. package/stack/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
  97. package/stack/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
  98. package/stack/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
  99. package/stack/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
  100. package/stack/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
  101. package/stack/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
  102. package/stack/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
  103. package/stack/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
  104. package/stack/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
  105. package/stack/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
  106. package/stack/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
  107. package/stack/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
  108. package/stack/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
  109. package/stack/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
  110. package/stack/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
  111. package/stack/skills/supabase-postgres-best-practices/references/security-rls-performance.md +63 -0
  112. package/stack/skills/tdd/SKILL.md +109 -0
  113. package/stack/skills/tdd/deep-modules.md +33 -0
  114. package/stack/skills/tdd/interface-design.md +31 -0
  115. package/stack/skills/tdd/mocking.md +59 -0
  116. package/stack/skills/tdd/refactoring.md +10 -0
  117. package/stack/skills/tdd/tests.md +61 -0
  118. package/stack/skills/to-issues/SKILL.md +83 -0
  119. package/stack/skills/to-prd/SKILL.md +72 -0
  120. package/stack/skills/work-lifecycle/SKILL.md +79 -0
  121. package/stack/skills/work-lifecycle/references/plan-template.md +185 -0
  122. package/stack/system-prompt/AGENTS.md +171 -0
  123. package/stack/system-prompt/engram-protocol.md +53 -0
  124. package/upstreams.json +96 -0
@@ -0,0 +1,31 @@
1
+ # Interface Design for Testability
2
+
3
+ Good interfaces make testing natural:
4
+
5
+ 1. **Accept dependencies, don't create them**
6
+
7
+ ```typescript
8
+ // Testable
9
+ function processOrder(order, paymentGateway) {}
10
+
11
+ // Hard to test
12
+ function processOrder(order) {
13
+ const gateway = new StripeGateway();
14
+ }
15
+ ```
16
+
17
+ 2. **Return results, don't produce side effects**
18
+
19
+ ```typescript
20
+ // Testable
21
+ function calculateDiscount(cart): Discount {}
22
+
23
+ // Hard to test
24
+ function applyDiscount(cart): void {
25
+ cart.total -= discount;
26
+ }
27
+ ```
28
+
29
+ 3. **Small surface area**
30
+ - Fewer methods = fewer tests needed
31
+ - Fewer params = simpler test setup
@@ -0,0 +1,59 @@
1
+ # When to Mock
2
+
3
+ Mock at **system boundaries** only:
4
+
5
+ - External APIs (payment, email, etc.)
6
+ - Databases (sometimes - prefer test DB)
7
+ - Time/randomness
8
+ - File system (sometimes)
9
+
10
+ Don't mock:
11
+
12
+ - Your own classes/modules
13
+ - Internal collaborators
14
+ - Anything you control
15
+
16
+ ## Designing for Mockability
17
+
18
+ At system boundaries, design interfaces that are easy to mock:
19
+
20
+ **1. Use dependency injection**
21
+
22
+ Pass external dependencies in rather than creating them internally:
23
+
24
+ ```typescript
25
+ // Easy to mock
26
+ function processPayment(order, paymentClient) {
27
+ return paymentClient.charge(order.total);
28
+ }
29
+
30
+ // Hard to mock
31
+ function processPayment(order) {
32
+ const client = new StripeClient(process.env.STRIPE_KEY);
33
+ return client.charge(order.total);
34
+ }
35
+ ```
36
+
37
+ **2. Prefer SDK-style interfaces over generic fetchers**
38
+
39
+ Create specific functions for each external operation instead of one generic function with conditional logic:
40
+
41
+ ```typescript
42
+ // GOOD: Each function is independently mockable
43
+ const api = {
44
+ getUser: (id) => fetch(`/users/${id}`),
45
+ getOrders: (userId) => fetch(`/users/${userId}/orders`),
46
+ createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
47
+ };
48
+
49
+ // BAD: Mocking requires conditional logic inside the mock
50
+ const api = {
51
+ fetch: (endpoint, options) => fetch(endpoint, options),
52
+ };
53
+ ```
54
+
55
+ The SDK approach means:
56
+ - Each mock returns one specific shape
57
+ - No conditional logic in test setup
58
+ - Easier to see which endpoints a test exercises
59
+ - Type safety per endpoint
@@ -0,0 +1,10 @@
1
+ # Refactor Candidates
2
+
3
+ After TDD cycle, look for:
4
+
5
+ - **Duplication** → Extract function/class
6
+ - **Long methods** → Break into private helpers (keep tests on public interface)
7
+ - **Shallow modules** → Combine or deepen
8
+ - **Feature envy** → Move logic to where data lives
9
+ - **Primitive obsession** → Introduce value objects
10
+ - **Existing code** the new code reveals as problematic
@@ -0,0 +1,61 @@
1
+ # Good and Bad Tests
2
+
3
+ ## Good Tests
4
+
5
+ **Integration-style**: Test through real interfaces, not mocks of internal parts.
6
+
7
+ ```typescript
8
+ // GOOD: Tests observable behavior
9
+ test("user can checkout with valid cart", async () => {
10
+ const cart = createCart();
11
+ cart.add(product);
12
+ const result = await checkout(cart, paymentMethod);
13
+ expect(result.status).toBe("confirmed");
14
+ });
15
+ ```
16
+
17
+ Characteristics:
18
+
19
+ - Tests behavior users/callers care about
20
+ - Uses public API only
21
+ - Survives internal refactors
22
+ - Describes WHAT, not HOW
23
+ - One logical assertion per test
24
+
25
+ ## Bad Tests
26
+
27
+ **Implementation-detail tests**: Coupled to internal structure.
28
+
29
+ ```typescript
30
+ // BAD: Tests implementation details
31
+ test("checkout calls paymentService.process", async () => {
32
+ const mockPayment = jest.mock(paymentService);
33
+ await checkout(cart, payment);
34
+ expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
35
+ });
36
+ ```
37
+
38
+ Red flags:
39
+
40
+ - Mocking internal collaborators
41
+ - Testing private methods
42
+ - Asserting on call counts/order
43
+ - Test breaks when refactoring without behavior change
44
+ - Test name describes HOW not WHAT
45
+ - Verifying through external means instead of interface
46
+
47
+ ```typescript
48
+ // BAD: Bypasses interface to verify
49
+ test("createUser saves to database", async () => {
50
+ await createUser({ name: "Alice" });
51
+ const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
52
+ expect(row).toBeDefined();
53
+ });
54
+
55
+ // GOOD: Verifies through interface
56
+ test("createUser makes user retrievable", async () => {
57
+ const user = await createUser({ name: "Alice" });
58
+ const retrieved = await getUser(user.id);
59
+ expect(retrieved.name).toBe("Alice");
60
+ });
61
+ ```
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: to-issues
3
+ description: Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices. Use when user wants to convert a plan into issues, create implementation tickets, or break down work into issues.
4
+ ---
5
+
6
+ # To Issues
7
+
8
+ Break a plan into independently-grabbable issues using vertical slices (tracer bullets).
9
+
10
+ The issue tracker and triage label vocabulary should have been provided to you — run `/setup-matt-pocock-skills` if not.
11
+
12
+ ## Process
13
+
14
+ ### 1. Gather context
15
+
16
+ Work from whatever is already in the conversation context. If the user passes an issue reference (issue number, URL, or path) as an argument, fetch it from the issue tracker and read its full body and comments.
17
+
18
+ ### 2. Explore the codebase (optional)
19
+
20
+ If you have not already explored the codebase, do so to understand the current state of the code. Issue titles and descriptions should use the project's domain glossary vocabulary, and respect ADRs in the area you're touching.
21
+
22
+ ### 3. Draft vertical slices
23
+
24
+ Break the plan into **tracer bullet** issues. Each issue is a thin vertical slice that cuts through ALL integration layers end-to-end, NOT a horizontal slice of one layer.
25
+
26
+ Slices may be 'HITL' or 'AFK'. HITL slices require human interaction, such as an architectural decision or a design review. AFK slices can be implemented and merged without human interaction. Prefer AFK over HITL where possible.
27
+
28
+ <vertical-slice-rules>
29
+ - Each slice delivers a narrow but COMPLETE path through every layer (schema, API, UI, tests)
30
+ - A completed slice is demoable or verifiable on its own
31
+ - Prefer many thin slices over few thick ones
32
+ </vertical-slice-rules>
33
+
34
+ ### 4. Quiz the user
35
+
36
+ Present the proposed breakdown as a numbered list. For each slice, show:
37
+
38
+ - **Title**: short descriptive name
39
+ - **Type**: HITL / AFK
40
+ - **Blocked by**: which other slices (if any) must complete first
41
+ - **User stories covered**: which user stories this addresses (if the source material has them)
42
+
43
+ Ask the user:
44
+
45
+ - Does the granularity feel right? (too coarse / too fine)
46
+ - Are the dependency relationships correct?
47
+ - Should any slices be merged or split further?
48
+ - Are the correct slices marked as HITL and AFK?
49
+
50
+ Iterate until the user approves the breakdown.
51
+
52
+ ### 5. Publish the issues to the issue tracker
53
+
54
+ For each approved slice, publish a new issue to the issue tracker. Use the issue body template below. These issues are considered ready for AFK agents, so publish them with the correct triage label unless instructed otherwise.
55
+
56
+ Publish issues in dependency order (blockers first) so you can reference real issue identifiers in the "Blocked by" field.
57
+
58
+ <issue-template>
59
+ ## Parent
60
+
61
+ A reference to the parent issue on the issue tracker (if the source was an existing issue, otherwise omit this section).
62
+
63
+ ## What to build
64
+
65
+ A concise description of this vertical slice. Describe the end-to-end behavior, not layer-by-layer implementation.
66
+
67
+ Avoid specific file paths or code snippets — they go stale fast. Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it here and note briefly that it came from a prototype. Trim to the decision-rich parts — not a working demo, just the important bits.
68
+
69
+ ## Acceptance criteria
70
+
71
+ - [ ] Criterion 1
72
+ - [ ] Criterion 2
73
+ - [ ] Criterion 3
74
+
75
+ ## Blocked by
76
+
77
+ - A reference to the blocking ticket (if any)
78
+
79
+ Or "None - can start immediately" if no blockers.
80
+
81
+ </issue-template>
82
+
83
+ Do NOT close or modify any parent issue.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: to-prd
3
+ description: Turn the current conversation context into a PRD at work/{name}/PRD.md (work-lifecycle flow). Use when user wants to create a PRD from the current context.
4
+ ---
5
+
6
+ This skill takes the current conversation context and codebase understanding and produces a PRD. Do NOT interview the user — just synthesize what you already know.
7
+
8
+ ## Process
9
+
10
+ 1. Explore the repo to understand the current state of the codebase, if you haven't already. Use the project's domain glossary vocabulary throughout the PRD, and respect any ADRs in the area you're touching.
11
+
12
+ 2. Sketch out the seams at which you're going to test the feature. Existing seams should be preferred to new ones. Use the highest seam possible. If new seams are needed, propose them at the highest point you can.
13
+
14
+ Check with the user that these seams match their expectations.
15
+
16
+ 3. Write the PRD using the template below to `work/{name}/PRD.md`, where `{name}` is the work's canonical kebab-case name (see the `work-lifecycle` skill) — the human reviews it there. Exception: if the project manages its work through an issue tracker and the user wants the PRD there, publish it to the tracker instead and apply the `ready-for-agent` triage label — no need for additional triage.
17
+
18
+ <prd-template>
19
+
20
+ ## Problem Statement
21
+
22
+ The problem that the user is facing, from the user's perspective.
23
+
24
+ ## Solution
25
+
26
+ The solution to the problem, from the user's perspective.
27
+
28
+ ## User Stories
29
+
30
+ A LONG, numbered list of user stories. Each user story should be in the format of:
31
+
32
+ 1. As an <actor>, I want a <feature>, so that <benefit>
33
+
34
+ <user-story-example>
35
+ 1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending
36
+ </user-story-example>
37
+
38
+ This list of user stories should be extremely extensive and cover all aspects of the feature.
39
+
40
+ ## Implementation Decisions
41
+
42
+ A list of implementation decisions that were made. This can include:
43
+
44
+ - The modules that will be built/modified
45
+ - The interfaces of those modules that will be modified
46
+ - Technical clarifications from the developer
47
+ - Architectural decisions
48
+ - Schema changes
49
+ - API contracts
50
+ - Specific interactions
51
+
52
+ Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
53
+
54
+ Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it within the relevant decision and note briefly that it came from a prototype. Trim to the decision-rich parts — not a working demo, just the important bits.
55
+
56
+ ## Testing Decisions
57
+
58
+ A list of testing decisions that were made. Include:
59
+
60
+ - A description of what makes a good test (only test external behavior, not implementation details)
61
+ - Which modules will be tested
62
+ - Prior art for the tests (i.e. similar types of tests in the codebase)
63
+
64
+ ## Out of Scope
65
+
66
+ A description of the things that are out of scope for this PRD.
67
+
68
+ ## Further Notes
69
+
70
+ Any further notes about the feature.
71
+
72
+ </prd-template>
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: work-lifecycle
3
+ description: Single source for how a piece of work is tracked and advances — PRD and plan as files in work/{name}/ while in progress; task specs, phase outcomes and history in Engram memory. Use when starting, tracking, resuming or closing a piece of work, or when deciding where a PRD, plan, task or backlog item should live.
4
+ ---
5
+
6
+ # Work Lifecycle
7
+
8
+ One rule kills duplication: **every piece of information has exactly ONE home**. Files are for what a human reviews; memory is for what subagents consume and for history. Nothing is ever stored in two places.
9
+
10
+ ## Identity
11
+
12
+ Every piece of work gets a **canonical kebab-case name** when it starts (e.g. `checkout-refactor`), shared with the branch if applicable. The name stays the same across its whole life — it is the key to everything else.
13
+
14
+ ## Where everything lives
15
+
16
+ | Piece | Single home | Why there |
17
+ |---|---|---|
18
+ | PRD | `work/{name}/PRD.md` | Written once, reviewed by the human |
19
+ | Plan (goal, approach, task board) | `work/{name}/plan.md` | The status board: humans glance at it; statuses flip with surgical edits |
20
+ | Full spec of each atomic task | Engram `work/{name}/task/{NN}` | Only subagents consume it; visible from any worktree |
21
+ | Phase outcomes, decisions, findings | Engram `work/{name}/{phase}` | History — must survive the folder and compactions |
22
+ | Final outcome | Engram `work/{name}/done` | Permanent record of what shipped |
23
+ | Pending / backlog items | Engram `work/backlog` — ONE key per project | All pending ideas in a single upserted list |
24
+
25
+ `work/` is **scaffolding, not product**: add it to the project's `.gitignore`. It contains ONLY work in progress — an empty `work/` means nothing is half-done. No `1-TODOs/`, no `3-finalized/`, no phase subfolders.
26
+
27
+ ## Starting
28
+
29
+ 1. Pick the canonical name and create `work/{name}/`. If the item came from the backlog, remove it from `work/backlog` in the same step.
30
+ 2. Produce the PRD with the `to-prd` skill → `work/{name}/PRD.md`. The human reviews it there.
31
+ 3. Write `work/{name}/plan.md` (structure in `references/plan-template.md`): goal, chosen approach, success criteria, and the task table — number, title, one-line description, status, wave, deps.
32
+ 4. Save the full spec of each atomic task to memory: one `mem_save` per task with topic_key `work/{name}/task/{NN}` (content structure in `references/plan-template.md`).
33
+
34
+ ## Executing
35
+
36
+ - Execution happens inside a git worktree created for the work (branch = canonical name); the user's main checkout stays untouched until merge.
37
+ - Delegation handoff: the subagent receives its **topic_key + task title**, never the task content inline. It retrieves the spec itself (`mem_search` → `mem_get_observation`).
38
+ - The subagent saves its phase outcome under the topic_key the orchestrator gave it (`work/{name}/{phase}`) BEFORE its final report.
39
+ - Task status lives ONLY in the plan.md table: flip it (⬜ → ✅) with a surgical edit when the task closes. Do not mirror statuses into memory, and do not re-read the whole plan after every task — it is already in context; re-read it on resume.
40
+
41
+ ## HTML review view (on demand)
42
+
43
+ When presenting the PRD or the plan for human review on non-trivial work, OFFER a disposable HTML view (e.g. side-by-side approach comparison for the PRD, task table + dependency graph for the plan). Rules:
44
+
45
+ - Only generate it if the human says yes — never by default.
46
+ - The markdown is the ONLY source of truth: requested changes are applied to `PRD.md`/`plan.md`, and the HTML is regenerated from the updated markdown if another review round is needed. The HTML is never edited as a document and never read by subagents.
47
+ - It lives in `work/{name}/` (e.g. `plan.review.html`, `PRD.review.html`) and is DELETED as soon as its artifact is approved — before execution starts.
48
+
49
+ ## Pending work (backlog)
50
+
51
+ All pending or future work of a project lives under the SINGLE topic_key `work/backlog` (upsert): one list, each item a short title + one-liner. Never one topic_key per idea, never a TODOs folder. When an item starts, it graduates: remove it from the backlog and create its `work/{name}/`. Review findings deliberately NOT applied also land here, one line each (what + why deferred).
52
+
53
+ If the project manages work through an issue tracker, issues (`to-issues`) take this role instead — don't keep both.
54
+
55
+ ## Resuming
56
+
57
+ 1. Read `work/{name}/plan.md` — the board says what's done and what's pending.
58
+ 2. If detail is needed: `mem_search("work/{name}")` for the latest phase outcomes (or `mem_context` if recent).
59
+ 3. Continue from the first task without ✅.
60
+
61
+ ## Closing
62
+
63
+ When the work is finalized (e.g. PR created and merged into its target branch):
64
+
65
+ 1. `mem_save` under `work/{name}/done`: outcome, what shipped, anything left pending.
66
+ 2. If the PRD has lasting documentation value, move it to where the project keeps docs (e.g. `docs/`); otherwise its key decisions already live in `done`.
67
+ 3. **Delete `work/{name}/`** and remove the work's worktree. Nothing to archive — git has the code, memory has the story.
68
+ 4. `mem_session_summary` covers the session as usual.
69
+
70
+ ## Rules
71
+
72
+ - One piece of work = one canonical name, stable across its whole life.
73
+ - Don't mix several distinct pieces of work under the same name/topic_key.
74
+ - Same evolving phase → same topic_key (upsert). Different phases and different tasks must not overwrite each other.
75
+ - Never persist the same artifact in two homes — no file + memory copies, no hybrid writes.
76
+
77
+ ## Legacy `work/` folders
78
+
79
+ If a repo still has the old `work/1-TODOs / 2-inProgress / 3-finalized` structure: respect what exists, don't extend it. When you touch a piece of work living there, migrate it to this flow: pending ideas → one entry each in `work/backlog`; an in-progress folder → `work/{name}/` keeping only PRD.md and plan.md, its tasks to memory; finalized folders → one `mem_save` per piece worth keeping, then delete them with the user's OK.
@@ -0,0 +1,185 @@
1
+ # Plan & Task Templates
2
+
3
+ Templates for the two artifacts of a piece of work: `plan.md` (file — the status board) and the atomic tasks (Engram observations). `[name]` is the canonical kebab-case name shared by `work/[name]/`, the branch and every topic_key.
4
+
5
+ ---
6
+
7
+ ## `work/[name]/` contents
8
+
9
+ ```
10
+ work/[name]/
11
+ ├── PRD.md # decisions and design (written by the to-prd skill)
12
+ └── plan.md # master index + task status board
13
+ ```
14
+
15
+ The full spec of each task is NOT a file: it lives in Engram, one observation per task with topic_key `work/[name]/task/[NN]` (the `[NN]` matches the `#` column of the plan table).
16
+
17
+ ---
18
+
19
+ ## plan.md — Template
20
+
21
+ ```markdown
22
+ # [Readable Feature Name]
23
+
24
+ **Canonical name**: `[name]`
25
+ **Branch**: [branch name] | **Date**: YYYY-MM-DD | **Status**: In progress
26
+
27
+ ## Goal
28
+
29
+ [What is being built and why — 2-4 lines]
30
+
31
+ ## Chosen approach
32
+
33
+ [Summary of the approved design — why this approach was chosen]
34
+
35
+ ### Discarded: [name]
36
+
37
+ [Why it wasn't chosen]
38
+
39
+ ## Success criteria
40
+
41
+ - [ ] [Verifiable behavior 1]
42
+ - [ ] [Verifiable behavior 2]
43
+ - [ ] Task-specific verification passes, if applicable
44
+
45
+ ## Tasks
46
+
47
+ > Full spec of task NN → Engram topic_key `work/[name]/task/NN`.
48
+ > Status lives ONLY in this table — update it with a surgical edit per task.
49
+
50
+ | # | Task | One-liner | Status | Wave | Deps |
51
+ |---|------|-----------|--------|------|------|
52
+ | 01 | [descriptive name] | [one-line description] | ⬜ | 1 | — |
53
+ | 02 | [descriptive name] | [one-line description] | ⬜ | 1 | — |
54
+ | 03 | [descriptive name] | [one-line description] | ⬜ | 2 | 01 |
55
+ | 04 | [descriptive name] | [one-line description] | ⬜ | 2 | 01, 02 |
56
+
57
+ **Statuses**: ⬜ Pending → 🔴 RED → 🟢 GREEN → 🔍 Review → ✅ Done
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Task observation — Template (`mem_save` per task)
63
+
64
+ Each task observation is self-contained: a subagent retrieves it by topic_key and has all the context needed to work without asking back. Don't write unnecessary information or full code blocks unless needed. In the context section, write only what the subagent needs to understand it perfectly.
65
+
66
+ `mem_save` fields:
67
+
68
+ - **title**: `[name]/task/[NN] — [descriptive task name]`
69
+ - **topic_key**: `work/[name]/task/[NN]`
70
+ - **type**: `architecture`
71
+ - **content**: the markdown below
72
+
73
+ Status, wave and dependencies live in the plan.md table (single home) — do NOT repeat them here.
74
+
75
+ ```markdown
76
+ # T[NN]: [Descriptive task name]
77
+
78
+ ## Intent
79
+
80
+ [EXPLICIT: why we're doing this task. The problem it solves or the need it covers.]
81
+
82
+ ## Affected files
83
+
84
+ > Only include files the agent of THIS task can modify.
85
+ > If there are tests, translations or user docs, create a separate task for the right specialist.
86
+
87
+ | File | Action | Why |
88
+ |------|--------|-----|
89
+ | `path/to/file` | CREATE | [concrete reason] |
90
+ | `path/to/other` | MODIFY | [concrete reason] |
91
+
92
+ ## Out of scope / Delegate
93
+
94
+ | Agent | Pending work | Required inputs |
95
+ |-------|--------------|-----------------|
96
+ | `[agent]` | [work that belongs to another scope] | [minimal inputs] |
97
+
98
+ ## Constraints
99
+
100
+ [Technical constraints the subagent MUST respect. If none beyond project rules, say so explicitly.]
101
+
102
+ ## Context
103
+
104
+ [Extracted from the analysts' output — only what's relevant for THIS task. Copy real code snippets, don't describe them. Indicate source file:line for each snippet.]
105
+
106
+ ### Current relevant state
107
+
108
+ [Existing code being modified or extended — copy literally]
109
+
110
+ ### Pattern to follow
111
+
112
+ [If there's an existing pattern in the codebase to replicate — copy literally with file:line]
113
+
114
+ ## Specification
115
+
116
+ [What the code must do — exact behavior.]
117
+
118
+ ### Expected behavior
119
+
120
+ - **Input**: [what it receives]
121
+ - **Output**: [what it returns/produces]
122
+ - **Side effects**: [queries, mutations, etc. if any]
123
+
124
+ ### Edge cases
125
+
126
+ - [Edge case and how to handle it]
127
+
128
+ ### Business rules
129
+
130
+ - [Rule]
131
+
132
+ ## Acceptance criteria
133
+
134
+ [VERIFIABLE and SPECIFIC criteria — not generic. Each must be checkable manually or automatically.]
135
+
136
+ - [ ] [Verifiable criterion 1]
137
+ - [ ] [Verifiable criterion 2]
138
+ - [ ] Task-specific verification passes, if applicable
139
+
140
+ ## Additional notes
141
+
142
+ [Anything the subagent should know that doesn't fit above.]
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Backlog entry — Template (`work/backlog`)
148
+
149
+ ONE observation per project holds every pending idea (topic_key `work/backlog`, upserted). Each item is just:
150
+
151
+ ```markdown
152
+ - **[short title]** — [one-line description of the idea and its value]
153
+ ```
154
+
155
+ When an item starts, remove it from this list and create its `work/[name]/`.
156
+
157
+ ---
158
+
159
+ ## Task creation rules
160
+
161
+ ### Atomicity
162
+
163
+ - **Max ~5 implementation steps** per task. If more → split into two tasks.
164
+
165
+ ### Structure
166
+
167
+ - **Natural order**: data layer → generated types → services/hooks → components/UI.
168
+ - **Numbering**: `01`, `02`, `03`... (two digits) — shared by the plan table row and the topic_key.
169
+
170
+ ### Context
171
+
172
+ - Copy only the relevant info from the analysis, not the whole report.
173
+ - **Copy code literally**, don't describe it.
174
+ - Indicate source file and line for each copied snippet.
175
+
176
+ ### Acceptance criteria
177
+
178
+ - **VERIFIABLE**: "the type includes X", not "the type is correct".
179
+ - **SPECIFIC**: no copy-paste of generic criteria.
180
+ - **COMPLETE**: cover happy path, edge cases and errors.
181
+
182
+ ### Constraints
183
+
184
+ - Include the relevant project rules as constraints.
185
+ - If there are no special constraints, say so explicitly.