sphica 0.4.0 → 0.5.1

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,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "sphica",
4
- "version": "0.4.0",
5
- "description": "Records conversations automatically and recalls past decisions, rejected options, constraints, and what was said.",
4
+ "version": "0.5.1",
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.0",
4
- "description": "Records conversations automatically and recalls past decisions, rejected options, constraints, and what was said.",
3
+ "version": "0.5.1",
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 decisions made in them.
14
- You or your agent can then look up what was decided, what was rejected, and why, before making the same call again.
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
- - **Look things up while you work.** The MCP tools `recall` and `read` let Claude Code and Codex search past decisions, rejected options, constraints, dead ends, and what you said in earlier sessions.
20
- - **Warnings before an edit (Claude Code).** Before the agent edits a file, a hook shows it the constraints recorded for that exact file and any technical debt that was deliberately left there.
21
- - **Automatic session recording.** Sphica keeps your prompts, the agent's final reply for each turn, and the paths of files changed by the agent's edit tools.
22
- - **Decision records on request.** `/sphica:trace` saves the decisions, rejected options, constraints, and dead ends of a session, with the pull requests and issues mentioned in it, plus where the work stands.
23
- - **Multi-perspective review.** `/sphica:review` runs a separate reviewer for each focus: correctness, security, and written conventions by default, plus redundancy and past decisions with `full`. When Codex is installed, it offers to repeat the review with Codex.
24
- - **Decisions from a pull request.** `/sphica:harvest <number>` reads one GitHub pull request, including its review comments and follow-up commits, and saves what it decided in the same form. The agent picks the decisions, so it works with any pull request template.
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` only: the GitHub CLI (`gh`), signed in with `gh auth login`
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 server, hooks, and skills. The `sphica` CLI comes from npm and is installed separately. You need both.
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 recording queue. Start here whenever something looks wrong.
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 writes sessions to the database only for repositories you register. A registered repository is called a project; run `sphica init` in each repository you want recorded.
84
+ Sphica records sessions only in repositories you register (projects); run `sphica init` in each one.
83
85
 
84
- Then work as usual in Claude Code or Codex. To bring back earlier decisions, ask the agent:
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
- - "What did I say about the migration last week?"
89
- - "Let's continue where we left off."
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, and before a shell command that names such a file (naming it is not proof the command reads it). 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
- The agent searches with `recall` and opens full records with `read`. At the end of a session with decisions worth keeping, run `/sphica:trace`.
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
+ There is no review hook in Codex: run `$sphica:review`.
92
108
 
93
- To keep what a pull request decided, run `/sphica:harvest 123` in Claude Code (`$sphica:harvest 123` in Codex). Without a number, it lists recent pull requests and asks which one.
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, and records are not shared between machines.
98
- - **What.** Your prompts, the agent's final reply for each turn, and the paths of edited files. Background-task notifications and messages from other agents are skipped when Sphica recognizes their format.
99
- - **Unregistered repositories.** Sessions in a repository you have not registered stay in the queue. They are written to the database after you register the repository. Held records are dropped after 30 days, and when more than 1,000 are waiting the oldest go first.
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. Two things call other tools that may: `/sphica:harvest` runs `gh api` with your credentials to read the pull request, and `sphica doctor` runs `npm` and `claude` to check installed versions.
109
- - **Text written by others.** Pull request text read by `/sphica:harvest` may come from anyone. It is passed to the agent as data, and the MCP server cannot write to the database. The command that saves a harvest writes only records of that pull request in the current repository.
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
- To delete a project's data, run `sphica project forget <name>`, where `<name>` is shown by `sphica project list`. Without `--yes`, it only shows how many records would be deleted. It deletes records in the database only. Records still waiting in `~/.sphica/spool` stay there and can be imported again if you register the repository again.
128
+ ## Limits in 0.5.1
112
129
 
113
- Before you stop using a machine, run `sphica capture flush` until `sphica doctor` shows no records waiting to be sent. Each run writes up to 500 records. Records from unregistered repositories are not written, so register those repositories first if you want to keep them.
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
+ - A shell command that names a file gets its decisions even when it does not read the file. A shell command that edits a file gets them only as a command naming it, not as an edit (in Codex, a patch passed to `apply_patch` through the shell still counts as an edit). In Claude Code this covers the Bash tool; commands run through its PowerShell tool (Windows without Git Bash) get no delivery.
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. When a release changes the database schema, the CLI asks you to run `sphica db migrate`. Back up `~/.sphica/sphica.db` before you run it.
163
+ Restart open sessions afterwards.
138
164
 
139
165
  ## Uninstalling
140
166
 
141
167
  ```bash
142
- npm uninstall -g sphica
168
+ sphica uninstall
143
169
  ```
144
170
 
145
- Claude Code:
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 the repository is registered with `sphica project list`. In Codex, also check that the hooks are trusted in `/hooks`.
165
- - **The MCP server reports an older version.** Restart the session, or run `/reload-plugins` in Claude Code.
166
- - **A search finds nothing.** Search matches words. Try other words, English and Japanese, or shorter terms. An empty result doesn't mean nothing was recorded.
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's last harvest |
174
- | `sphica advice` | See how often the edit hook showed constraints |
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
- Run `sphica --help` for these, `sphica -H` for every command (managing projects, and the ones agents and maintenance use), and `sphica <command> --help` for each command's options.
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