@primitive.ai/prim 0.1.0-alpha.12 → 0.1.0-alpha.121
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/README.md +550 -38
- package/SKILL.md +320 -75
- package/assets/primitive-gameplan/SKILL.md +134 -0
- package/assets/primitive-gameplan/claude-hooks.json +28 -0
- package/assets/primitive-gameplan/scripts/activate.mjs +37 -0
- package/dist/chunk-2DNC2MUN.js +503 -0
- package/dist/chunk-2PFJJO2M.js +262 -0
- package/dist/chunk-4GLVJLEQ.js +55 -0
- package/dist/chunk-4GYJHN26.js +1440 -0
- package/dist/chunk-6DEROXLM.js +22695 -0
- package/dist/chunk-7LXRFXZG.js +1992 -0
- package/dist/chunk-AKGRY7OU.js +1572 -0
- package/dist/chunk-BHT6X3T5.js +1450 -0
- package/dist/chunk-DQ4I3FLF.js +164 -0
- package/dist/chunk-DVHD6LBQ.js +258 -0
- package/dist/chunk-EZXEWFDG.js +210 -0
- package/dist/chunk-HG7FJK7R.js +253 -0
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/chunk-JXRJLHE4.js +168 -0
- package/dist/chunk-JZC2LHS6.js +209 -0
- package/dist/chunk-KZB4ABIB.js +13 -0
- package/dist/chunk-LQLP26RL.js +459 -0
- package/dist/chunk-M4NZJCPQ.js +135 -0
- package/dist/chunk-MRDY7VQP.js +96 -0
- package/dist/chunk-NMZSCSMY.js +157 -0
- package/dist/chunk-NQZLXYTW.js +36 -0
- package/dist/chunk-OXW6PSPT.js +439 -0
- package/dist/chunk-OYHYCK4K.js +13 -0
- package/dist/chunk-S3ZIMGXV.js +844 -0
- package/dist/chunk-WN7OURQ3.js +175 -0
- package/dist/daemon/server.js +26506 -0
- package/dist/hook-runtime/daemon/server.js +26507 -0
- package/dist/hook-runtime/hooks/post-commit.js +23898 -0
- package/dist/hook-runtime/hooks/post-rewrite.js +23797 -0
- package/dist/hook-runtime/hooks/post-tool-use.js +36213 -0
- package/dist/hook-runtime/hooks/pre-commit.js +1741 -0
- package/dist/hook-runtime/hooks/pre-tool-use-worker.js +35071 -0
- package/dist/hook-runtime/hooks/pre-tool-use.js +96 -0
- package/dist/hook-runtime/hooks/prim-hook.js +36273 -0
- package/dist/hook-runtime/hooks/session-end.js +1250 -0
- package/dist/hook-runtime/hooks/session-start.js +34021 -0
- package/dist/hook-runtime/index.js +71700 -0
- package/dist/hook-runtime/statusline-main.js +954 -0
- package/dist/hooks/post-commit.js +197 -0
- package/dist/hooks/post-rewrite.js +206 -0
- package/dist/hooks/post-tool-use.js +295 -0
- package/dist/hooks/pre-commit.js +16 -108
- package/dist/hooks/pre-tool-use-worker.js +238 -0
- package/dist/hooks/pre-tool-use.js +87 -0
- package/dist/hooks/prim-hook.js +245 -0
- package/dist/hooks/session-end.js +67 -0
- package/dist/hooks/session-start.js +312 -0
- package/dist/index.js +11249 -572
- package/dist/statusline-main.js +953 -0
- package/package.json +51 -17
- package/skills/prim-welcome/SKILL.md +197 -0
- package/dist/chunk-3APLWTLB.js +0 -165
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: primitive-gameplan
|
|
3
|
+
description: Use alongside write-gameplan and write-workstream to bring applicable Primitive Decisions into architectural discussion, review plans for unsupported architectural additions, and preserve engineer-approved resolutions. Does not replace either public skill or authorize implementation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Primitive companion for gameplanning
|
|
7
|
+
|
|
8
|
+
Use the public planning skill unchanged. This companion adds decision context to
|
|
9
|
+
its existing architecture discussion and final review; it adds no schema fields
|
|
10
|
+
or human checkpoints between execution patches. Codex is the primary host:
|
|
11
|
+
discover this companion under `.agents/skills`, make the public skills available
|
|
12
|
+
to Codex, and use `$write-gameplan` or `$write-workstream`.
|
|
13
|
+
`prim gameplan install --agent codex` places a dispatcher
|
|
14
|
+
in the user's Codex hooks to load this companion for explicit invocations;
|
|
15
|
+
`AGENTS.md` also binds implicit planning-skill use.
|
|
16
|
+
Claude retains `/write-gameplan` and `/write-workstream` through
|
|
17
|
+
[the Claude hook configuration](claude-hooks.json), merged into
|
|
18
|
+
`.claude/settings.json` without replacing existing hooks.
|
|
19
|
+
|
|
20
|
+
## Before choosing architecture
|
|
21
|
+
|
|
22
|
+
Inspect the requested behavior and its existing code path. Identify both the
|
|
23
|
+
intended code files and the plan/workstream path, even if the plan does not exist
|
|
24
|
+
yet. From the target repository root, use the installed `prim` CLI, or
|
|
25
|
+
`npx --yes @primitive.ai/prim` when there is no `prim` executable:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
prim auth status
|
|
29
|
+
prim decisions check --files "src/billing/export.ts,gameplans/billing-export.yaml"
|
|
30
|
+
prim decisions show dec_123
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Replace the example paths and ID with real ones. `check` accepts comma-separated
|
|
34
|
+
repo-relative paths and emits JSON without a `--json` flag. Check intended code
|
|
35
|
+
paths as well as the artifact: a decision scoped to billing may not govern the
|
|
36
|
+
gameplans directory. Repeat the lookup if the planned footprint expands. Use
|
|
37
|
+
`show` on decisions you will rely on to inspect their full constraints, rationale,
|
|
38
|
+
source/attribution, status, and scope. A path match alone does not settle a choice.
|
|
39
|
+
|
|
40
|
+
Give a short brief before patch decomposition: relevant settled choices,
|
|
41
|
+
explicitly rejected approaches, and remaining architectural questions. Cite the
|
|
42
|
+
Decision IDs and explain their bearing on this change. Do not invent a blanket
|
|
43
|
+
ban on validators, workers, or persistence from an example of overengineering.
|
|
44
|
+
|
|
45
|
+
An empty successful lookup means no matching decisions were returned, not that
|
|
46
|
+
the proposed architecture is approved. Nonzero exits, `unavailable`, partial or
|
|
47
|
+
truncated responses, and missing provenance mean coverage is unknown or limited.
|
|
48
|
+
Report that limitation and use available engineer-supplied constraints. Do not
|
|
49
|
+
claim Primitive clearance, start an authentication flow, enable capture, or change
|
|
50
|
+
enforcement settings merely to finish planning.
|
|
51
|
+
|
|
52
|
+
## Resolve choices in the existing format
|
|
53
|
+
|
|
54
|
+
Use `architectureDesign.decisions[].resolution` in the public gameplan schema:
|
|
55
|
+
|
|
56
|
+
- `engineer_approved`: an actual engineer answer or identifiable engineer-approved
|
|
57
|
+
source covers this exact choice and scope. Evidence includes the Primitive ID,
|
|
58
|
+
substantive constraint, source of approval, and why it applies here.
|
|
59
|
+
- `constrained`: binding requirements eliminate meaningful alternatives; explain
|
|
60
|
+
that reasoning, including the applicable Decision when one supplies a constraint.
|
|
61
|
+
- `delegated`: the engineer explicitly delegated this choice within a stated
|
|
62
|
+
scope; retain that delegation. The agent's resulting selection is not a new
|
|
63
|
+
user-originated decision without ratification.
|
|
64
|
+
- `unresolved`: the remaining choice needs an answer. Keep it in `openQuestions`
|
|
65
|
+
too, and leave dependent patches/specs provisional until it is resolved.
|
|
66
|
+
|
|
67
|
+
Keep rationale in `resolution.rationale`. A captured agent suggestion, an author
|
|
68
|
+
name, adoption status alone, an existing implementation, or a broad milestone is
|
|
69
|
+
not evidence that an engineer approved a new mechanism. For example, approval of
|
|
70
|
+
PostgreSQL does not approve another durable ledger. Conflicting or ambiguous
|
|
71
|
+
Decisions require clarification; do not silently prefer the newest one.
|
|
72
|
+
|
|
73
|
+
When alternatives remain, present the minimal approach, credible alternatives,
|
|
74
|
+
and relevant prior constraints before choosing. Ask one question at a time when
|
|
75
|
+
answers depend on each other. Do not repeat a question already answered within
|
|
76
|
+
the same scope. For a workstream, use its existing decisions/open-questions prose
|
|
77
|
+
rather than introducing gameplan fields.
|
|
78
|
+
|
|
79
|
+
## Review the complete artifact before handoff
|
|
80
|
+
|
|
81
|
+
Read the solution, operational considerations, every patch, and every formal spec
|
|
82
|
+
against the resolved architecture. Look for consequential choices introduced as
|
|
83
|
+
implementation details: another source of truth, validation boundary, state
|
|
84
|
+
lifetime, worker, scheduler, retry protocol, or cross-runtime data flow. Check
|
|
85
|
+
each against its actual evidence and scope, not merely whether an ID is present.
|
|
86
|
+
This is a semantic review by the planning agent: `prim decisions check` is a
|
|
87
|
+
lookup, not that review.
|
|
88
|
+
|
|
89
|
+
For an unsupported addition, identify the patch and concrete choice. Remove an
|
|
90
|
+
unnecessary agent-added mechanism consistently from the artifact, or present it
|
|
91
|
+
as an unresolved exception with alternatives before finalizing dependent work.
|
|
92
|
+
Discussion of a rejected option is allowed; adopting it without resolution is not.
|
|
93
|
+
Re-run the public skill's schema/spec validation after changes. A validator PASS
|
|
94
|
+
does not verify that a human approved the design.
|
|
95
|
+
|
|
96
|
+
## Preserve the answers
|
|
97
|
+
|
|
98
|
+
At a natural planning boundary, retain durable engineer resolutions in Primitive
|
|
99
|
+
when recording is authorized. Check the applicable records and
|
|
100
|
+
`prim decisions recent --limit 20` to avoid duplicates. Use the installed Prim
|
|
101
|
+
recording policy when available; a request to draft a plan alone does not grant
|
|
102
|
+
permission to publish decisions into an inactive repository.
|
|
103
|
+
|
|
104
|
+
Before a create, check `prim decisions create --help`. Record the exact approved
|
|
105
|
+
choice with `--intent`, `--attribution user`, source-grounded `--rationale`, one
|
|
106
|
+
`--decided` per binding constraint, and `--alternatives` only for options actually
|
|
107
|
+
rejected. An agent selection under delegation uses `--attribution agent` unless
|
|
108
|
+
the engineer ratifies that selection. Missing rationale is a question, not a
|
|
109
|
+
license to invent one. Apply only the approved scope using `--files`,
|
|
110
|
+
`--scope-dir`, or `--scope-repo`; include the plan path when that scope governs it.
|
|
111
|
+
Do not silently broaden a code-only constraint to all plans or the whole repo.
|
|
112
|
+
|
|
113
|
+
Honor existing recording authorization without asking again. For an inactive repo,
|
|
114
|
+
Prim's global `--yes` is appropriate only for a specifically authorized create;
|
|
115
|
+
npm's `npx --yes` is merely package-install confirmation. Preserve returned IDs
|
|
116
|
+
in the existing evidence fields. Report failed writes as unsaved, retaining the
|
|
117
|
+
approved wording in the plan for recovery; after an ambiguous failure, check for
|
|
118
|
+
an existing record before retrying. Never invent an ID or a successful save.
|
|
119
|
+
|
|
120
|
+
For parent workstreams, follow the public skill's write-back procedure: present
|
|
121
|
+
the concrete edits and obtain its required approval before applying them. Saving
|
|
122
|
+
a Primitive Decision does not authorize a workstream edit.
|
|
123
|
+
|
|
124
|
+
## Enforcement boundary
|
|
125
|
+
|
|
126
|
+
Existing Conflict Gates may inspect saved plans when enabled and in scope. This
|
|
127
|
+
companion neither installs nor enables gates. It does not guarantee detection of
|
|
128
|
+
every architectural implication or cryptographically verify approval. Chat-only
|
|
129
|
+
plans bypass file-write gates, and infrastructure failures may fail open.
|
|
130
|
+
|
|
131
|
+
If a gate flags a conflict, surface the governing Decision and resolve the
|
|
132
|
+
architectural choice with the engineer. Do not run `prim reconcile`, weaken gate
|
|
133
|
+
mode, or change/supersede the Decision merely to make the plan pass. A bypass or
|
|
134
|
+
change of constraint needs explicit engineer authorization for that action.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"UserPromptExpansion": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "(^|:)write-(gameplan|workstream)$",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "node \"$CLAUDE_PROJECT_DIR/.agents/skills/primitive-gameplan/scripts/activate.mjs\"",
|
|
10
|
+
"timeout": 5
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"PreToolUse": [
|
|
16
|
+
{
|
|
17
|
+
"matcher": "Skill",
|
|
18
|
+
"hooks": [
|
|
19
|
+
{
|
|
20
|
+
"type": "command",
|
|
21
|
+
"command": "node \"$CLAUDE_PROJECT_DIR/.agents/skills/primitive-gameplan/scripts/activate.mjs\"",
|
|
22
|
+
"timeout": 5
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
const event = JSON.parse(readFileSync(0, "utf8"));
|
|
4
|
+
let name;
|
|
5
|
+
if (event.hook_event_name === "UserPromptSubmit") {
|
|
6
|
+
name = event.prompt?.match(
|
|
7
|
+
/^\s*[$/](write-(?:gameplan|workstream))(?=\s|$)/
|
|
8
|
+
)?.[1];
|
|
9
|
+
} else if (
|
|
10
|
+
event.hook_event_name === "UserPromptExpansion" &&
|
|
11
|
+
event.expansion_type === "slash_command"
|
|
12
|
+
) {
|
|
13
|
+
name = event.command_name;
|
|
14
|
+
} else if (
|
|
15
|
+
event.hook_event_name === "PreToolUse" &&
|
|
16
|
+
event.tool_name === "Skill"
|
|
17
|
+
) {
|
|
18
|
+
name = event.tool_input?.skill;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (
|
|
22
|
+
typeof name === "string" &&
|
|
23
|
+
/^(?:[^:]+:)*write-(?:gameplan|workstream)$/.test(name)
|
|
24
|
+
) {
|
|
25
|
+
const companion = readFileSync(
|
|
26
|
+
new URL("../SKILL.md", import.meta.url),
|
|
27
|
+
"utf8"
|
|
28
|
+
);
|
|
29
|
+
process.stdout.write(
|
|
30
|
+
`${JSON.stringify({
|
|
31
|
+
hookSpecificOutput: {
|
|
32
|
+
hookEventName: event.hook_event_name,
|
|
33
|
+
additionalContext: `This repository uses the Primitive planning companion alongside ${name}. Its local skill follows:\n\n${companion}`,
|
|
34
|
+
},
|
|
35
|
+
})}\n`
|
|
36
|
+
);
|
|
37
|
+
}
|