@primitive.ai/prim 0.1.0-alpha.90 → 0.1.0-alpha.92

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 (45) hide show
  1. package/README.md +20 -12
  2. package/SKILL.md +6 -6
  3. package/dist/chunk-26P57LAR.js +1491 -0
  4. package/dist/{chunk-LMRYZL3D.js → chunk-5AFRMOPX.js} +1 -1
  5. package/dist/{chunk-RO3F6JYV.js → chunk-5GYQ4J3D.js} +2 -2
  6. package/dist/chunk-5HRR4AOR.js +264 -0
  7. package/dist/{chunk-3EEFL6NJ.js → chunk-67VNLLBN.js} +261 -1
  8. package/dist/{chunk-UZPBB7V4.js → chunk-ADUTW66W.js} +60 -48
  9. package/dist/{chunk-LEMX3IOG.js → chunk-BTNNEH2W.js} +1 -1
  10. package/dist/{chunk-YWO7O6QG.js → chunk-FBAYCS3X.js} +2 -2
  11. package/dist/{chunk-R26A7TWY.js → chunk-FKXFUUWJ.js} +1 -1
  12. package/dist/chunk-H4UNYFUC.js +196 -0
  13. package/dist/{chunk-CUE2LKLR.js → chunk-KFXF2V5G.js} +1 -1
  14. package/dist/{chunk-6IWNH776.js → chunk-LFFLHSQO.js} +4 -3
  15. package/dist/{chunk-C7T7B45R.js → chunk-LGGMJYY4.js} +150 -21
  16. package/dist/{chunk-MAZWKJGL.js → chunk-M6RIJVRE.js} +42 -232
  17. package/dist/{chunk-2JRX7ZR4.js → chunk-NAHHFSLH.js} +16 -5
  18. package/dist/{chunk-FI3LIRCB.js → chunk-OAAP2MY6.js} +2 -2
  19. package/dist/{chunk-Z7YPFWAZ.js → chunk-PCVGBE5B.js} +10 -268
  20. package/dist/chunk-WX52U7Z2.js +112 -0
  21. package/dist/{chunk-PPQYQEIR.js → chunk-ZB4F75SZ.js} +28 -0
  22. package/dist/daemon/server.js +30 -21
  23. package/dist/hook-runtime/daemon/server.js +30 -21
  24. package/dist/hook-runtime/hooks/post-commit.js +20 -20
  25. package/dist/hook-runtime/hooks/post-rewrite.js +20 -20
  26. package/dist/hook-runtime/hooks/post-tool-use.js +666 -147
  27. package/dist/hook-runtime/hooks/pre-tool-use.js +659 -111
  28. package/dist/hook-runtime/hooks/prim-hook.js +627 -111
  29. package/dist/hook-runtime/hooks/session-end.js +610 -27
  30. package/dist/hook-runtime/hooks/session-start.js +1132 -533
  31. package/dist/hook-runtime/index.js +764 -267
  32. package/dist/hook-runtime/statusline-main.js +48 -4
  33. package/dist/hooks/post-commit.js +11 -9
  34. package/dist/hooks/post-rewrite.js +11 -9
  35. package/dist/hooks/post-tool-use.js +73 -48
  36. package/dist/hooks/pre-commit.js +4 -4
  37. package/dist/hooks/pre-tool-use.js +46 -44
  38. package/dist/hooks/prim-hook.js +47 -25
  39. package/dist/hooks/session-end.js +15 -26
  40. package/dist/hooks/session-start.js +59 -32
  41. package/dist/index.js +561 -1430
  42. package/dist/statusline-main.js +48 -4
  43. package/package.json +1 -1
  44. package/dist/chunk-PMRDE2DA.js +0 -310
  45. package/dist/chunk-WB7AUZ4C.js +0 -52
package/README.md CHANGED
@@ -39,7 +39,7 @@ One command does the whole install — auth, session hooks, daemon, git hooks,
39
39
  skill, and the welcome:
40
40
 
41
41
  ```bash
42
- prim setup # add --agent codex or --agent hermes; --no-daemon explicitly opts out
42
+ prim setup # add --agent cursor, codex, or hermes; --no-daemon explicitly opts out
43
43
  ```
44
44
 
45
45
  Or run the steps individually:
@@ -49,7 +49,7 @@ Or run the steps individually:
49
49
  prim auth login
50
50
 
51
51
  # 2. Wire the session hooks (decision capture + presence)
52
- prim claude install # or: prim codex install / prim hermes install
52
+ prim claude install # or: prim cursor install / prim codex install / prim hermes install
53
53
 
54
54
  # 3. Start the companion daemon (latency + team presence)
55
55
  prim daemon start
@@ -85,6 +85,7 @@ step-by-step the agent follows — and the manual fallback — live in
85
85
 
86
86
  ```bash
87
87
  prim setup # Run the whole install in one shot
88
+ prim setup --agent cursor # Same, for Cursor IDE and Cursor CLI
88
89
  prim setup --agent codex # Same, for OpenAI Codex
89
90
  prim setup --agent hermes # Same, for Hermes Agent (global-only config)
90
91
  prim setup --no-daemon # Stop it and persistently opt out of supervised delivery
@@ -102,13 +103,13 @@ prim uninstall
102
103
 
103
104
  Stops the companion daemon, removes the current repository's Prim-owned agent
104
105
  and Git-hook surfaces when run inside a Git repository, removes the user-scoped
105
- Claude, Codex, Hermes, and Git-hook surfaces, then deletes only schema-valid
106
+ Claude, Cursor, Codex, Hermes, and Git-hook surfaces, then deletes only schema-valid
106
107
  Prim runtime bytes. Foreign configuration is retained; ambiguous ownership
107
108
  makes the command fail closed and retain the runtimes. If a removal races or
108
109
  fails after one runtime changes, its JSON result reports each runtime's exact
109
110
  state so rerunning can safely finish cleanup. Authentication,
110
111
  undelivered journals, repository bindings, and agent skill guidance are kept.
111
- Use `prim skill uninstall --agent <claude|codex|hermes> --scope <project|user>`
112
+ Use `prim skill uninstall --agent <claude|cursor|codex|hermes> --scope <project|user>`
112
113
  when you also want to remove a known skill target.
113
114
 
114
115
  ### Auth
@@ -142,8 +143,8 @@ graph, and presence is reported. Each hook
142
143
  self-resolves the CLI at run time (PATH, then a local install, then
143
144
  `npx --yes @latest`), so it keeps working with no global install.
144
145
 
145
- Installs into the current project by default — the repo's `.claude/settings.json`
146
- / `.codex/hooks.json`, resolved from the git root (so any subdirectory works);
146
+ Installs into the current project by default — the repo's `.claude/settings.json`,
147
+ `.cursor/hooks.json`, or `.codex/hooks.json`, resolved from the git root (so any subdirectory works);
147
148
  pass `--scope user` to install machine-wide. Hermes is the exception: it reads
148
149
  shell hooks only from the global `~/.hermes/config.yaml`, so `prim hermes install`
149
150
  is always user-scoped — and prim merges in place, leaving the rest of that file
@@ -152,6 +153,8 @@ is always user-scoped — and prim merges in place, leaving the rest of that fil
152
153
  ```bash
153
154
  prim claude install # Install Claude Code hooks (project scope; uninstall / status)
154
155
  prim claude install --scope user # Install machine-wide instead
156
+ prim cursor install # Install native Cursor hooks (project scope)
157
+ prim cursor install --scope user # Install hooks, skill, and CLI footer machine-wide
155
158
  prim codex install # Install OpenAI Codex hooks (project scope)
156
159
  prim hermes install # Install Hermes Agent hooks (global ~/.hermes/config.yaml)
157
160
  ```
@@ -308,9 +311,11 @@ and offers to install into `.husky/`.
308
311
  prim statusline # Render the team-presence statusline (reads the daemon)
309
312
  ```
310
313
 
311
- Claude Code has one custom status-line slot. Installation uses a staged,
312
- lightweight Primitive renderer when that slot is empty or already Primitive's;
313
- an existing custom status line is preserved and reported explicitly. Use
314
+ Claude Code and Cursor CLI each have one custom status-line slot. Their user-scope
315
+ installations use a staged, lightweight Primitive renderer when that slot is empty
316
+ or already Primitive's; an existing custom status line is preserved even with
317
+ `--force` and reported explicitly. Cursor's Primitive footer replaces Cursor's
318
+ default footer and requires a Cursor CLI restart after installation or removal. Use
314
319
  `prim daemon status` or `prim doctor` for the same health signal in that case.
315
320
 
316
321
  ### Welcome
@@ -337,6 +342,7 @@ prim moves flush # Drain the local journals to the server (also runs fr
337
342
 
338
343
  ```bash
339
344
  prim skill install --agent claude # Install the decision-graph guide for Claude Code
345
+ prim skill install --agent cursor # Install the native Cursor skill
340
346
  prim skill install --agent codex # …or write the guide into another agent's rules file
341
347
  prim skill uninstall --agent claude # Remove it
342
348
  prim skill status --agent claude # Report whether it's installed
@@ -347,9 +353,11 @@ Teaches your agent how to work with the decision graph. For **Claude Code**
347
353
  `<repo>/.claude/skills/prim/` (or `~/.claude/skills/prim/` with `--scope user`)
348
354
  — a `.claude-plugin/plugin.json` + `SKILL.md` that auto-loads as the model-invoked
349
355
  `prim@skills-dir` skill, no marketplace step; restart Claude Code or run
350
- `/reload-plugins` after installing. For every other agent it writes a managed
351
- block into the rules file that agent reads (`--agent codex` → AGENTS.md,
352
- `--agent hermes` → .hermes.md, or an auto-detected .cursor/rules, …). A bare
356
+ `/reload-plugins` after installing. For **Cursor**, it installs an owned `SKILL.md`
357
+ at `<repo>/.cursor/skills/prim/` (or `~/.cursor/skills/prim/` with `--scope user`)
358
+ without overwriting foreign or locally edited files. For the remaining agents it
359
+ writes a managed block into the rules file that agent reads (`--agent codex` →
360
+ AGENTS.md or `--agent hermes` → .hermes.md). A bare
353
361
  `prim skill install` (no `--agent`) auto-detects a rules file and writes the
354
362
  block; pass `--target <path>` for an explicit file.
355
363
 
package/SKILL.md CHANGED
@@ -11,7 +11,7 @@ description: Use the prim CLI for Primitive’s decision graph. MUST INVOKE befo
11
11
 
12
12
  In an active repo, prim passively captures the **decisions** your team makes -- which library, which pattern, which config value -- into a queryable graph, and links them: a decision can depend on earlier decisions (auto-linked from shared files, or related by hand — see *Relate decisions*) and reference the files it touched. **Conflict Gates** can check a later change against that graph and surface any load-bearing decision it conflicts with. When **Enforcement** is enabled for an organization, prim can warn, pause, or block the edit until you reconcile the decision and retry. Capture in active repos runs independently.
13
13
 
14
- Low-level capture runs automatically in active repos through the session hooks installed by `npx --yes @primitive.ai/prim claude install` (Claude Code), `npx --yes @primitive.ai/prim codex install` (Codex), or `npx --yes @primitive.ai/prim hermes install` (Hermes). An inactive repo is not passively captured. Deliberately record higher-order forks in the road through `prim decisions create` as described below. Your job is also to **read** the graph before load-bearing edits and **answer** the occasional rationale confirmation. (Responding to Conflict Gates applies only once Enforcement is enabled — see below.)
14
+ Low-level capture runs automatically in active repos through the session hooks installed by `npx --yes @primitive.ai/prim claude install` (Claude Code), `npx --yes @primitive.ai/prim cursor install` (Cursor), `npx --yes @primitive.ai/prim codex install` (Codex), or `npx --yes @primitive.ai/prim hermes install` (Hermes). An inactive repo is not passively captured. Deliberately record higher-order forks in the road through `prim decisions create` as described below. Your job is also to **read** the graph before load-bearing edits and **answer** the occasional rationale confirmation. (Responding to Conflict Gates applies only once Enforcement is enabled — see below.)
15
15
 
16
16
  ## Auth
17
17
 
@@ -36,10 +36,10 @@ The CLI auto-refreshes a still-valid session from the stored refresh token (proa
36
36
 
37
37
  **Conflict Gates** check each edit against the decision graph before it lands and surface any load-bearing decision it conflicts with. When **Enforcement** is enabled for an organization, a conflicting edit can be warned, blocked, or paused for confirmation until you reconcile the decision and retry. Automatic decision capture in active repos (above) runs independently.
38
38
 
39
- When Enforcement is enabled, before an edit (Claude Code: Edit/Write/MultiEdit; Codex: apply_patch; Hermes: write_file/patch) a PreToolUse hook scores the target file against the graph:
39
+ When Enforcement is enabled, before an edit (Claude Code: Edit/Write/MultiEdit; Cursor: Write/Delete/Shell; Codex: apply_patch; Hermes: write_file/patch) a PreToolUse hook scores the target file against the graph:
40
40
 
41
41
  - **deny** -- the edit is blocked: it conflicts with a load-bearing prior decision. Don't fight it. Read the reason line; it names the decision id. If you genuinely intend to override that decision, run `npx --yes @primitive.ai/prim reconcile dec_<shortId>`, then retry the edit once. Otherwise choose an approach that respects the decision.
42
- - **warn / additional context** -- the edit proceeds, but a relevant prior decision is surfaced. Read it. Codex cannot pause mid-tool, so a would-be `ask` arrives as a **deny** carrying the reconcile directive. Hermes also has no soft-confirm tier, so a would-be `ask` arrives as a **deny** carrying the same directive: reconcile and retry, or set `PRIM_HOOK_MODE=warn` to downgrade it to context-only.
42
+ - **warn / additional context** -- the edit proceeds, but a relevant prior decision is surfaced. Read it. Cursor, Codex, and Hermes cannot pause at this gate, so a would-be `ask` arrives as a **deny** carrying the reconcile directive: reconcile and retry, or set `PRIM_HOOK_MODE=warn` to downgrade it to context-only.
43
43
  - **"decision check skipped / not verified" or "... partial / truncated"** -- the check could not fully run. Treat constraints as UNKNOWN, not clear; never read silence as approval.
44
44
 
45
45
  When enabled, the gate sends its preflight check directly to Primitive and fail-opens on infrastructure errors (for example, a network failure or org-unbound token) -- a service problem would not block your edit. That is why an "unavailable" note matters: it is the honest signal that the check, not your edit, is what failed.
@@ -47,7 +47,7 @@ When enabled, the gate sends its preflight check directly to Primitive and fail-
47
47
  ## Read the graph before large or load-bearing edits
48
48
 
49
49
  - `npx --yes @primitive.ai/prim decisions check --files "src/a.ts,src/b.ts"` -- which active decisions reference the files you're about to touch (comma-separated paths, one `--files` value). Run it before a big change.
50
- - `npx --yes @primitive.ai/prim decisions recent` -- the team's recent decisions, each row badged by author and agent (`Your Claude Code` / `Your Codex` / `Your Hermes`); `--limit <n>` and `--since <dur>` narrow it. `--author "<name>"` filters to one teammate (feed name, `"First Last"`, last name, username, email, or email local-part) -- the way to answer "what has X decided?"; an unknown or ambiguous name comes back as `unavailable` with the reason, and `authorHasDecisions` in the JSON distinguishes "no feed-visible decisions" (false) from "has decisions, none in this window" (true). The page defaults to the 10 most recent, so it can hide older ones: on an author query the JSON's `windowTotal` is how many that teammate has in the window. When `windowTotal` exceeds the rows returned, don't present the page as complete -- tell the user you're showing the most recent N of `windowTotal` and offer to pull the rest, which is a re-run with `--limit <windowTotal>` (capped at 100; `windowTotalCapped` means the count is a floor rendered `N+`, and a window past 100 can't be fetched whole).
50
+ - `npx --yes @primitive.ai/prim decisions recent` -- the team's recent decisions, each row badged by author and agent (`Your Claude Code` / `Your Cursor` / `Your Codex` / `Your Hermes`); `--limit <n>` and `--since <dur>` narrow it. `--author "<name>"` filters to one teammate (feed name, `"First Last"`, last name, username, email, or email local-part) -- the way to answer "what has X decided?"; an unknown or ambiguous name comes back as `unavailable` with the reason, and `authorHasDecisions` in the JSON distinguishes "no feed-visible decisions" (false) from "has decisions, none in this window" (true). The page defaults to the 10 most recent, so it can hide older ones: on an author query the JSON's `windowTotal` is how many that teammate has in the window. When `windowTotal` exceeds the rows returned, don't present the page as complete -- tell the user you're showing the most recent N of `windowTotal` and offer to pull the rest, which is a re-run with `--limit <windowTotal>` (capped at 100; `windowTotalCapped` means the count is a floor rendered `N+`, and a window past 100 can't be fetched whole).
51
51
  - `npx --yes @primitive.ai/prim decisions show <idOrShortId>` and `npx --yes @primitive.ai/prim decisions cascade <idOrShortId>` -- full detail, and the downstream blast radius a change would disturb.
52
52
 
53
53
  Before presenting decision reads, use the current conversation, task, and available memory to understand what matters to the requester and how they want it delivered. Do not dump the API's chronological rows unchanged. Group related decisions around goals or workstreams, lead with decisions that affect the requester's current work, and surface conflicts, supersessions, or consequential tradeoffs before background activity. Explain why an item is relevant when the connection is supported; do not invent relevance or rationale. Preserve the response's `unavailable`, truncation, and count semantics when reshaping it.
@@ -237,7 +237,7 @@ npx --yes @primitive.ai/prim hooks uninstall
237
237
 
238
238
  Under `CI=1` (or with `--non-interactive`), `hooks install` fails fast in a Husky repo unless `--yes` or `--target` is set; the error names both escapes. `hooks uninstall` only removes the `.git/hooks` copies — if a hook was installed into `.husky/`, remove the prim block from that file manually. To suppress the hooks for one commit, use `git commit --no-verify`.
239
239
 
240
- These git hooks are separate from the **session hooks** (`claude install` / `codex install` / `hermes install`) that drive in-session capture (and Conflict Gates, when enabled).
240
+ These git hooks are separate from the **session hooks** (`claude install` / `cursor install` / `codex install` / `hermes install`) that drive in-session capture (and Conflict Gates, when enabled).
241
241
 
242
242
  ## Output formats
243
243
 
@@ -259,7 +259,7 @@ Examples:
259
259
  - **An "unavailable" / "not verified" decision check is not an all-clear.** Treat constraints as UNKNOWN and proceed deliberately; never read the silence as approval — the same holds for Conflict Gates once enabled.
260
260
  - **When Enforcement is enabled, a `deny` means a real prior decision conflicts.** Reconcile only when you genuinely intend to override it; otherwise pick an approach that respects it.
261
261
  - **Reconcile bypasses are single-use and short-lived.** One bypass clears your *next* edit to the governed file; it is not a standing override.
262
- - **Capture of coding activity is automatic only in active repos; never inject moves by hand.** If an active repo's decisions aren't showing up, check that the session hooks are installed (`claude status` / `codex status` / `hermes status`) and the daemon is running. Deliberately authoring a higher-order fork—either at the user's request or under the conservative proactive policy above—is a separate, supported path through `decisions create`; in an inactive repo, honor the per-invocation approval boundary above.
262
+ - **Capture of coding activity is automatic only in active repos; never inject moves by hand.** If an active repo's decisions aren't showing up, check that the session hooks are installed (`claude status` / `cursor status` / `codex status` / `hermes status`) and the daemon is running. Deliberately authoring a higher-order fork—either at the user's request or under the conservative proactive policy above—is a separate, supported path through `decisions create`; in an inactive repo, honor the per-invocation approval boundary above.
263
263
  - **Don't fabricate rationale on a confirmation.** If you don't know why a decision was made, say so rather than guessing.
264
264
 
265
265
  ## After each task