sphica 0.4.0 → 0.5.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.
- package/.claude-plugin/plugin.json +2 -2
- package/.codex-plugin/plugin.json +2 -2
- package/README.md +65 -44
- package/db/schema.sql +631 -208
- package/dist/capture.js +353 -174
- package/dist/cli.js +13322 -34392
- package/dist/deliver.js +31951 -0
- package/dist/mcp-record.js +48262 -0
- package/dist/mcp.js +782 -787
- package/hooks/codex.json +25 -0
- package/hooks/hooks.json +26 -11
- package/mcp/claude.json +9 -1
- package/mcp/codex.json +10 -1
- package/package.json +2 -2
- package/skills/glean/SKILL.md +82 -0
- package/skills/glean/agents/openai.yaml +2 -0
- package/skills/harvest/SKILL.md +43 -93
- package/skills/review/SKILL.md +12 -13
- package/skills/review/reviewers/precedent.md +25 -38
- package/skills/trace/SKILL.md +72 -96
- package/db/migrations/0002_drop_artifact_rows.sql +0 -3
- package/db/migrations/0003_rebuild_source_item.sql +0 -45
- package/db/migrations/0004_knowledge_terms.sql +0 -46
- package/db/migrations/0005_terms_function.sql +0 -20
- package/db/migrations/0006_harvest_provenance.sql +0 -45
- package/db/migrations/0007_drop_bulk_import.sql +0 -238
- package/skills/trace/example.json +0 -108
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://anthropic.com/claude-code/plugin.schema.json",
|
|
3
3
|
"name": "sphica",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "Records
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"description": "Records Claude Code and Codex sessions on your machine and keeps past implementation and decisions, with their sources, for your agent to find.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "iroha924",
|
|
8
8
|
"email": "shunichi@hir4ta.com"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sphica",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Records
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Records Claude Code and Codex sessions on your machine and keeps past implementation and decisions, with their sources, for your agent to find.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "iroha924",
|
|
7
7
|
"email": "shunichi@hir4ta.com"
|
package/README.md
CHANGED
|
@@ -9,20 +9,22 @@
|
|
|
9
9
|
|
|
10
10
|
English | [日本語](https://github.com/iroha924/sphica/blob/main/README.ja.md)
|
|
11
11
|
|
|
12
|
-
**Local memory of past decisions for Claude Code and Codex.**
|
|
13
|
-
Sphica records your coding sessions and the
|
|
14
|
-
|
|
12
|
+
**Local memory of past implementation and decisions for Claude Code and Codex.**
|
|
13
|
+
Sphica records your coding sessions, and keeps what was decided, rejected, deferred, and built, each record quoting the words it came from.
|
|
14
|
+
Your agent finds those records when it searches, and sees the relevant ones on its own before it edits a file they apply to.
|
|
15
15
|
The database is a single SQLite file on your machine.
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
19
|
+
- **Automatic recording.** Sphica keeps your prompts, the agent's final reply for each turn, and the paths of the files a turn changed (by the edit tools, or seen in `git status` at the turn's end).
|
|
20
|
+
- **Records with their sources.** `/sphica:trace` turns a session into records: decisions with the options rejected and why, constraints, implementations, findings, dead ends, and open questions. Every record quotes the exact words it came from, and a decision counts as adopted only when you said so.
|
|
21
|
+
- **Pull requests too.** `/sphica:harvest <number>` keeps a GitHub pull request (body, comments, reviews, review comments, commits, and the issues it closes) and records what it decided. A reviewer's suggestion stays a proposal unless the owner or a maintainer adopted it; a merge alone adopts nothing.
|
|
22
|
+
- **Evidence found later.** `/sphica:glean` adds evidence and corrections to existing records. It asks you for the source (an issue URL, the file and line, meeting notes) before saving; a claim without one is kept only as unsourced and never used as fact.
|
|
23
|
+
- **Shown when it matters (Claude Code).** At session start, the current work; before an edit, the active decisions anchored to that file; when your prompt names a recorded option or code symbol, that record.
|
|
24
|
+
- **Search in Japanese and English.** Records carry search words in both languages, so a question in one finds a record written in the other.
|
|
25
|
+
- **Reviews check past decisions.** `/sphica:review` runs a reviewer per focus (correctness, security, written conventions, and past decisions by default; redundancy with `full`), and checks the diff against the records it touches.
|
|
25
26
|
|
|
27
|
+
Records are never rewritten: a correction is a new record that supersedes the old one, and the history stays.
|
|
26
28
|
The agent is told to treat records as history, not instructions, and to trust the code when a record and the current code disagree.
|
|
27
29
|
|
|
28
30
|
## Requirements
|
|
@@ -30,11 +32,11 @@ The agent is told to treat records as history, not instructions, and to trust th
|
|
|
30
32
|
- Node.js 24.15 or later
|
|
31
33
|
- Claude Code or Codex, or both
|
|
32
34
|
- `git`, to identify the repositories you register
|
|
33
|
-
- For `/sphica:harvest`
|
|
35
|
+
- For `/sphica:harvest` and fetching GitHub sources in `/sphica:glean`: the GitHub CLI (`gh`), signed in with `gh auth login`
|
|
34
36
|
|
|
35
37
|
## Install
|
|
36
38
|
|
|
37
|
-
The plugin ships the MCP
|
|
39
|
+
The plugin ships the MCP servers, hooks, and skills. The `sphica` CLI comes from npm and is installed separately. You need both.
|
|
38
40
|
|
|
39
41
|
**1. Install the CLI**
|
|
40
42
|
|
|
@@ -75,28 +77,43 @@ This creates `~/.sphica/sphica.db` and registers the repository. Running it agai
|
|
|
75
77
|
sphica doctor
|
|
76
78
|
```
|
|
77
79
|
|
|
78
|
-
`doctor` checks Node.js, the CLI and plugin versions, the database, and the
|
|
80
|
+
`doctor` checks Node.js, the CLI and plugin versions, the database, the recording queue, and the registered projects. Start here whenever something looks wrong.
|
|
79
81
|
|
|
80
82
|
## Quick start
|
|
81
83
|
|
|
82
|
-
Sphica
|
|
84
|
+
Sphica records sessions only in repositories you register (projects); run `sphica init` in each one.
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
Work as usual. At the end of a session with something worth keeping, run `/sphica:trace` (`$sphica:trace` in Codex).
|
|
87
|
+
`/sphica:trace pending` lists earlier sessions not traced yet. To keep what a pull request decided, run `/sphica:harvest 123`.
|
|
88
|
+
When you find evidence later ("the ops notes say…", "Kimura said the team agreed"), run `/sphica:glean` with what you found.
|
|
89
|
+
|
|
90
|
+
To bring back earlier decisions, ask the agent:
|
|
85
91
|
|
|
86
92
|
- "Did we already decide how to handle retries here?"
|
|
87
|
-
- "Why did we choose this approach?"
|
|
88
|
-
- "
|
|
89
|
-
|
|
93
|
+
- "Why did we choose this approach, and what did we reject?"
|
|
94
|
+
- "Did we try generating thumbnails in a worker before?"
|
|
95
|
+
|
|
96
|
+
### What the agent sees on its own
|
|
97
|
+
|
|
98
|
+
Without being asked, Sphica adds a few past records to what the agent sees, each marked as a past record rather than an instruction:
|
|
99
|
+
|
|
100
|
+
- At session start: the current work and project-wide constraints.
|
|
101
|
+
- On a prompt that names a recorded code symbol, file path, or option.
|
|
102
|
+
- Before the agent reads or edits a file a decision applies to. A read shows each record once per session.
|
|
103
|
+
- Before a review. When you run your own review command (any name containing `review`, or a name listed in the `SPHICA_REVIEW_COMMANDS`
|
|
104
|
+
environment variable, comma-separated), it gets the decisions your local change touches. `/sphica:review` checks them itself. Claude Code only.
|
|
90
105
|
|
|
91
|
-
|
|
106
|
+
In Codex the same happens at session start, on a prompt, before an `apply_patch` edit, and before a shell command that names such a file.
|
|
107
|
+
Edits made through shell commands are not covered, and there is no review hook: run `$sphica:review`.
|
|
92
108
|
|
|
93
|
-
|
|
109
|
+
The agent searches with Sphica's `search` and opens full records with `read`. `status` tells it how much of the history has been traced, so an empty search is not mistaken for "never decided".
|
|
94
110
|
|
|
95
111
|
## What gets recorded and where it goes
|
|
96
112
|
|
|
97
|
-
- **Where.** The database is `~/.sphica/sphica.db`. Records wait in a local queue, `~/.sphica/spool`, until they are written to it. Each machine has its own database
|
|
98
|
-
- **What.** Your prompts, the agent's final reply for each turn, and the paths of
|
|
99
|
-
- **
|
|
113
|
+
- **Where.** The database is `~/.sphica/sphica.db`. Records wait in a local queue, `~/.sphica/spool`, until they are written to it. Each machine has its own database; nothing is shared between machines.
|
|
114
|
+
- **What.** Your prompts, the agent's final reply for each turn, and the paths of changed files. Background-task notifications and messages from other agents are skipped when Sphica recognizes their format. Replies in the middle of a turn, and files created and deleted within one turn, are not seen.
|
|
115
|
+
- **What was shown.** Each automatic delivery is logged by which records it showed, not their text.
|
|
116
|
+
- **Unregistered repositories.** Sessions in a repository you have not registered stay in the queue and are written after you register it. Held records are dropped after 30 days, and when more than 1,000 are waiting the oldest go first.
|
|
100
117
|
- **Secrets.** Only secrets with a recognizable shape are masked:
|
|
101
118
|
- keys with known prefixes
|
|
102
119
|
- `KEY=…` and `"password": …` assignments
|
|
@@ -105,12 +122,21 @@ To keep what a pull request decided, run `/sphica:harvest 123` in Claude Code (`
|
|
|
105
122
|
- `mysql -p`
|
|
106
123
|
|
|
107
124
|
**Anything else is stored as typed, so do not paste secrets into a session.**
|
|
108
|
-
- **Network.** Sphica has no account, no hosted service, and no telemetry, and makes no network connections itself.
|
|
109
|
-
- **Text written by others.** Pull request
|
|
125
|
+
- **Network.** Sphica has no account, no hosted service, and no telemetry, and makes no network connections itself. `/sphica:harvest` and `/sphica:glean` run `gh api` with your credentials to read pull requests and issues, and `sphica doctor` runs `npm` and `claude` to check installed versions.
|
|
126
|
+
- **Text written by others.** Pull request and issue text may come from anyone. It is kept as a source and passed to the agent as data, never as instructions, and only the owner's or a maintainer's words can adopt a decision.
|
|
110
127
|
|
|
111
|
-
|
|
128
|
+
## Limits in 0.5.0
|
|
112
129
|
|
|
113
|
-
|
|
130
|
+
- Structured records exist only for what you traced, harvested, or gleaned. Everything else is searchable only as captured text (`search` with `sources: true`).
|
|
131
|
+
- In Codex, a shell command that names a file gets its decisions even when the command does not read it, and edits made through shell commands get none.
|
|
132
|
+
- In Codex, `$sphica:trace`, `$sphica:harvest`, and `$sphica:glean` write only when Codex tells Sphica which directory the session is in. Codex 0.157.1 does, through an experimental MCP capability; if a later Codex stops, they stop with a message and write nothing.
|
|
133
|
+
- Showing a record does not make the agent follow it. In our evaluation Codex received and found an earlier decision against a request, and still carried out the request as asked.
|
|
134
|
+
- A code location in a record is checked against your working tree when it is read ("located", "moved", "missing"). A located symbol does not prove the decision still holds.
|
|
135
|
+
|
|
136
|
+
## Upgrading from 0.4
|
|
137
|
+
|
|
138
|
+
0.5.0 keeps records in a new format. A 0.4 database is refused and left unchanged; its records are not carried over.
|
|
139
|
+
Move `~/.sphica/sphica.db` aside (keep it if you want the old data), then run `sphica init` again in each repository.
|
|
114
140
|
|
|
115
141
|
## Updating
|
|
116
142
|
|
|
@@ -134,46 +160,41 @@ codex plugin marketplace upgrade sphica
|
|
|
134
160
|
codex plugin add sphica@sphica
|
|
135
161
|
```
|
|
136
162
|
|
|
137
|
-
Restart open sessions afterwards.
|
|
163
|
+
Restart open sessions afterwards.
|
|
138
164
|
|
|
139
165
|
## Uninstalling
|
|
140
166
|
|
|
141
167
|
```bash
|
|
142
|
-
|
|
168
|
+
sphica uninstall
|
|
143
169
|
```
|
|
144
170
|
|
|
145
|
-
|
|
171
|
+
This deletes `~/.sphica` (the database and the recording queue) after asking, and shows the commands that remove the rest:
|
|
146
172
|
|
|
147
173
|
```bash
|
|
148
|
-
claude plugin uninstall sphica@sphica
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
Codex:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
codex plugin remove sphica@sphica
|
|
174
|
+
claude plugin uninstall sphica@sphica && claude plugin marketplace remove sphica
|
|
175
|
+
codex plugin remove sphica@sphica && codex plugin marketplace remove sphica
|
|
176
|
+
npm uninstall -g sphica
|
|
155
177
|
```
|
|
156
178
|
|
|
157
|
-
Your records stay in `~/.sphica/` until you delete that directory yourself.
|
|
158
|
-
|
|
159
179
|
## Troubleshooting
|
|
160
180
|
|
|
161
181
|
Run `sphica doctor` first. It shows which part is out of date or not working. Common cases:
|
|
162
182
|
|
|
163
183
|
- **`sphica: command not found`.** The plugin does not put the CLI on your PATH. Run `npm i -g sphica`.
|
|
164
|
-
- **Nothing is recorded.** Check that
|
|
165
|
-
- **The MCP
|
|
166
|
-
- **A search finds nothing.** Search matches words. Try other words,
|
|
184
|
+
- **Nothing is recorded.** Check that `sphica doctor` lists the repository under Projects. In Codex, also check that the hooks are trusted in `/hooks`.
|
|
185
|
+
- **The MCP servers report an older version.** Restart the session, or run `/reload-plugins` in Claude Code.
|
|
186
|
+
- **A search finds nothing.** Search matches words. Try other words, the other language, an identifier, or fewer words. Ask the agent to check `status`: sessions not traced yet are searchable only as captured text.
|
|
187
|
+
- **`doctor` says the full-text index is broken.** Run `sphica doctor --reindex`.
|
|
167
188
|
|
|
168
189
|
## Commands
|
|
169
190
|
|
|
170
191
|
| Command | What it does |
|
|
171
192
|
|---|---|
|
|
172
193
|
| `sphica init` | Create the database and register the current repository |
|
|
173
|
-
| `sphica doctor` | Check versions, the database, recording, and each project
|
|
174
|
-
| `sphica
|
|
194
|
+
| `sphica doctor` | Check versions, the database, recording, and each registered project |
|
|
195
|
+
| `sphica uninstall` | Delete `~/.sphica` and show how to remove the plugin and the CLI |
|
|
175
196
|
|
|
176
|
-
|
|
197
|
+
Everything else runs inside Claude Code and Codex, through the `/sphica:*` commands and Sphica's MCP tools.
|
|
177
198
|
|
|
178
199
|
## Security
|
|
179
200
|
|