sphica 0.2.0 → 0.4.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.
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: trace
3
- description: Stores the decisions made in the current session (decisions and rejected options, constraints, non-goals, dead ends, findings, deliberate debts, verifications, questions) and the current work status in the database. The conversation itself is recorded automatically, so pick only what keeps the next decision from going wrong. Use only when the user explicitly asks.
3
+ description: Stores every decision made in the current session (decisions and rejected options, constraints, non-goals, dead ends, findings, deliberate debts, verifications, questions), the pull requests and issues they came up with, and the current work status in the database. Use only when the user explicitly asks.
4
4
  argument-hint: "[work theme]"
5
5
  disable-model-invocation: true
6
- allowed-tools: Read, Bash(node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" trace *)
6
+ allowed-tools: Read, Edit(~/.sphica/drafts/**), Write(~/.sphica/drafts/**), Bash(node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" trace *)
7
7
  ---
8
8
 
9
9
  # trace — store decisions in a form you can look up next time
@@ -11,8 +11,8 @@ allowed-tools: Read, Bash(node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" trace *)
11
11
  Target: **$ARGUMENTS**
12
12
 
13
13
  Claude Code and Codex record conversations automatically (the owner's messages, the AI's last reply, edited files).
14
- **trace stores only the decisions picked from that conversation, and the current work status.** A "list of what was done" is already in git log,
15
- so do not write one.
14
+ **trace stores the decisions picked from that conversation, and the current work status.** A "list of what was done" is already in git log,
15
+ so do not write one. The whole session counts, including what was said before the conversation was compacted (context shows it).
16
16
 
17
17
  ## Failures this skill prevents
18
18
 
@@ -23,28 +23,31 @@ so do not write one.
23
23
  | Not writing what is unresolved | Work resumes as if it were understood, and stalls midway |
24
24
  | Writing assertions without evidence | They are read as facts and later overturned |
25
25
  | Deleting overturned decisions | Why it changed is lost, and the original option is proposed again |
26
- | Storing everything | Work logs push decisions out, and search becomes unreadable |
26
+ | Storing work logs | Work logs push decisions out, and search becomes unreadable |
27
+ | Dropping the pull request or issue a decision came with | The decision cannot be found from the number people remember |
27
28
 
28
29
  ## Flow
29
30
 
30
- `$M` is the CLI: `node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js"` in Claude Code, and `node "../../dist/cli.js"` from this Skill's directory
31
- in Codex (Sphica is not on Codex's PATH, and shell scripts do not run on Windows).
31
+ `$M` is the CLI: `node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js"` in Claude Code. In Codex, it is `node "<absolute path of this Skill's directory>/../../dist/cli.js"`
32
+ (Sphica is not on Codex's PATH, and shell scripts do not run on Windows). **Run every command from the repository root**; do not change
33
+ into the Skill's directory.
32
34
 
33
35
  1. **Read the material**: `$M trace context`. It shows this session's conversation, touched files, items already recorded,
34
36
  and work in progress with its decision keys. If the conversation is not recorded yet, write from your own context.
35
37
  It stops when both Claude Code and Codex sessions are in the environment, so name your host
36
38
  with `--host claude-code` or `--host codex`
37
- 2. **Write**: assemble the record JSON. The shape is below and in [example.json](example.json). **Do not create a file**
38
- (pass it on stdin so it never stays in the repository)
39
- 3. **Check**: put the JSON after `$M trace check - <<'TRACE'` and end with a `TRACE` line. It checks the shape and
40
- rules without touching the database. If it is rejected, fix it before moving on
41
- 4. **Store**: the same form with `$M trace save - <<'TRACE'`. The same key overwrites, and items you did not write stay (it appends).
42
- Write `session` exactly as context showed it (it stops if it differs from the current session)
43
- 5. **Report**: show the owner what was stored, in the same shape as Sphica's other output (`✦` for the title, Markdown tables, a final `╰─` line).
39
+ 2. **Write**: run `$M trace draft`. It prints an `id` and a `file` under `~/.sphica/drafts/`. Write the record JSON to that file with
40
+ your file-writing tool (not through the shell, and never inside the repository). The shape is below and in [example.json](example.json)
41
+ 3. **Check**: `$M trace check <id>`. It checks the shape and rules without touching the database. If it is rejected, fix the same file
42
+ and check again
43
+ 4. **Store**: `$M trace save <id>`. The same key overwrites, and items you did not write stay (it appends). Write `session` exactly as
44
+ context showed it (it stops if it differs from the current session). It removes the draft after storing; if it says the draft could
45
+ not be removed, the record is stored: do not save again
46
+ 5. **Report**: show the owner what was stored, in the same shape as Sphica's other output (Markdown tables, a final `╰─` line).
44
47
  Copy the closing line's counts exactly as save printed them
45
48
 
46
49
  ```
47
- ✦ **sphica trace** · <work title>
50
+ **sphica trace** · <work title>
48
51
 
49
52
  | kind | key | summary |
50
53
  |---|---|---|
@@ -70,13 +73,19 @@ an empty list clears them.
70
73
 
71
74
  ## What to store
72
75
 
73
- **Only what cannot be recovered from code, tests, AGENTS, or git, and whose absence would make the next decision go wrong.** Do not store
76
+ **Every decision made in the session**, plus what cannot be recovered from code, tests, AGENTS, or git. Do not store
74
77
  a running commentary, verifications that simply passed, or state that matters only to this session. Answers the owner chose (shown as Q / A in context)
75
78
  are material for decisions themselves.
76
79
 
80
+ When the conversation mentions a pull request or an issue, put it in the `refs` of the items it relates to (`pr:#<number>`, `issue:#<number>`).
81
+ Search finds records by these numbers. If none is mentioned, add none.
82
+
83
+ If context lists items already recorded in this session, write each again with the same key when it still holds or changed, set it to
84
+ `retired` / `resolved` / `superseded` when it no longer does, and leave it out only when it stays as it is.
85
+
77
86
  | kind | What to write |
78
87
  |---|---|
79
- | `decision` | What was decided. `context` (why it was needed), `options` (`chosen: true` on the chosen one, `why` on rejected ones), `confirmation` (how to check it holds), `downsides` (disadvantages accepted knowingly) |
88
+ | `decision` | What was decided. `context` (why it was needed), `options` (`chosen: true` on the chosen one, `why` on any rejected ones), `confirmation` (how to check it holds), `downsides` (disadvantages accepted knowingly) |
80
89
  | `constraint` | What must not change. If it applies to files, `files` with `role: "applies_to"`: the hook shows it before editing |
81
90
  | `non_goal` | What was decided not to do. Without it, whoever resumes widens the scope |
82
91
  | `dead_end` | A path tried that failed, and why it failed |
@@ -95,7 +104,8 @@ that a person must do with "Human:" (or the same marker in the conversation's la
95
104
  ## Rules check enforces
96
105
 
97
106
  - `key` is a meaningful word (lowercase letters and digits, `.` `_` `-`). `at` is ISO 8601 with an offset
98
- - A decision needs rejected options with their `why`. An accepted decision needs an option with `chosen: true` and a `confirmation`
107
+ - A decision needs `options`, at least the one chosen (`chosen: true` when accepted). Rejected options are written only when some were
108
+ compared, each with its `why`. An accepted decision needs a `confirmation`
99
109
  - `confidence: "fact"` needs `refs` or an evidence file (`role: "evidence"`). If you cannot give one, use `inference`
100
110
  - **Do not delete overturned decisions.** Write the old decision's key in the new decision's `supersedes`. For a decision from another session,
101
111
  use the `<host>:<session>#<key>` form context shows. A decision marked `superseded` in this record