sphica 0.0.0 → 0.1.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.
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
+ "name": "sphica",
4
+ "version": "0.1.0",
5
+ "description": "Records conversations automatically and recalls past decisions, rejected options, constraints, and what was said.",
6
+ "author": {
7
+ "name": "iroha924",
8
+ "email": "shunichi@hir4ta.com"
9
+ },
10
+ "homepage": "https://github.com/iroha924/sphica",
11
+ "repository": "https://github.com/iroha924/sphica",
12
+ "keywords": [
13
+ "knowledge",
14
+ "rag",
15
+ "conversations",
16
+ "decisions",
17
+ "sqlite"
18
+ ],
19
+ "mcpServers": "./mcp/claude.json"
20
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "sphica",
3
+ "version": "0.1.0",
4
+ "description": "Records conversations automatically and recalls past decisions, rejected options, constraints, and what was said.",
5
+ "author": {
6
+ "name": "iroha924",
7
+ "email": "shunichi@hir4ta.com"
8
+ },
9
+ "homepage": "https://github.com/iroha924/sphica",
10
+ "repository": "https://github.com/iroha924/sphica",
11
+ "skills": "./skills/",
12
+ "hooks": "./hooks/codex.json",
13
+ "mcpServers": "./mcp/codex.json"
14
+ }
package/README.md CHANGED
@@ -1,5 +1,220 @@
1
1
  # Sphica
2
2
 
3
- Records Claude Code and Codex sessions on your machine and recalls past decisions, rejected options, constraints, and what was said.
3
+ [![License](https://img.shields.io/github/license/iroha924/sphica)](https://github.com/iroha924/sphica/blob/main/LICENSE)
4
+ [![CI](https://github.com/iroha924/sphica/actions/workflows/check.yml/badge.svg)](https://github.com/iroha924/sphica/actions/workflows/check.yml)
5
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/iroha924/sphica/badge)](https://scorecard.dev/viewer/?uri=github.com/iroha924/sphica)
6
+ [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/14787/badge)](https://www.bestpractices.dev/projects/14787)
7
+ [![SLSA Build L2](https://img.shields.io/badge/SLSA-Build%20L2-green)](https://www.npmjs.com/package/sphica#provenance)
8
+ [![Dependabot: GitHub Actions](https://img.shields.io/badge/Dependabot-GitHub%20Actions-025E8C?logo=dependabot)](https://github.com/iroha924/sphica/blob/main/.github/dependabot.yml)
4
9
 
5
- This version is a placeholder. The first release is coming soon.
10
+ English | [日本語](https://github.com/iroha924/sphica/blob/main/README.ja.md)
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.
15
+ The database is a single SQLite file on your machine.
16
+
17
+ ## Features
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 or others 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, 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
+ - **Terminal dashboard.** `sphica dashboard` browses sessions, work in progress, and search results. It is read-only.
25
+ - **GitHub and docs import.** `sphica harvest` imports pull requests, issues, and the repository's Markdown files.
26
+
27
+ The agent is told to treat records as history, not instructions, and to trust the code when a record and the current code disagree.
28
+
29
+ ## Requirements
30
+
31
+ - Node.js 24.15 or later
32
+ - Claude Code or Codex, or both
33
+ - `git`, to identify the repositories you register
34
+ - For `sphica harvest` only: the GitHub CLI (`gh`), signed in with `gh auth login`
35
+
36
+ ## Install
37
+
38
+ The plugin ships the MCP server, hooks, and skills. The `sphica` CLI comes from npm and is installed separately. You need both.
39
+
40
+ **1. Install the CLI**
41
+
42
+ ```bash
43
+ npm i -g sphica
44
+ ```
45
+
46
+ **2. Add the plugin**
47
+
48
+ Claude Code:
49
+
50
+ ```bash
51
+ claude plugin marketplace add iroha924/sphica
52
+ claude plugin install sphica@sphica
53
+ ```
54
+
55
+ Codex:
56
+
57
+ ```bash
58
+ codex plugin marketplace add iroha924/sphica --ref main
59
+ codex plugin add sphica@sphica
60
+ ```
61
+
62
+ In Codex, open `/hooks` and mark Sphica's hooks as trusted. Nothing is recorded until you do. If a plugin update changes the hooks, trust them again.
63
+
64
+ **3. Create the database**
65
+
66
+ ```bash
67
+ sphica init
68
+ ```
69
+
70
+ This creates `~/.sphica/sphica.db`. Running it again leaves an existing database untouched.
71
+
72
+ **4. Check the setup**
73
+
74
+ ```bash
75
+ sphica doctor
76
+ ```
77
+
78
+ `doctor` checks Node.js, the CLI and plugin versions, the database, and the recording queue. Start here whenever something looks wrong.
79
+
80
+ ## Quick start
81
+
82
+ Sphica writes sessions to the database only for repositories you register. A registered repository is called a project.
83
+
84
+ ```bash
85
+ cd ~/Projects/your-repo
86
+ sphica project add
87
+ ```
88
+
89
+ If the repository has no `origin` remote, give it a name: `sphica project add --name <name>`.
90
+
91
+ Then work as usual in Claude Code or Codex. To bring back earlier decisions, ask the agent:
92
+
93
+ - "Did we already decide how to handle retries here?"
94
+ - "Why did we choose this approach?"
95
+ - "What did I say about the migration last week?"
96
+ - "Let's continue where we left off."
97
+
98
+ The agent searches with `recall` and opens full records with `read`. At the end of a session with decisions worth keeping, run `/sphica:trace`.
99
+
100
+ To import GitHub history and Markdown docs:
101
+
102
+ ```bash
103
+ sphica harvest # every project Sphica can find on this machine
104
+ sphica harvest --cwd . # only the current repository
105
+ ```
106
+
107
+ Without `--cwd`, Sphica looks for projects directly under `~/Projects` and for projects registered with `--name`. Use `--cwd` for a repository somewhere else.
108
+ Docs are read from the default branch of `origin`, or from the local `HEAD` when there is no `origin`.
109
+
110
+ To browse everything in the terminal:
111
+
112
+ ```bash
113
+ sphica dashboard # Tab switches screens, / searches, p changes project, q quits
114
+ ```
115
+
116
+ ## What gets recorded and where it goes
117
+
118
+ - **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.
119
+ - **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.
120
+ - **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.
121
+ - **Secrets.** Only secrets with a recognizable shape are masked:
122
+ - keys with known prefixes
123
+ - `KEY=…` and `"password": …` assignments
124
+ - credentials in URLs
125
+ - authorization headers
126
+ - `mysql -p`
127
+
128
+ **Anything else is stored as typed, so do not paste secrets into a session.**
129
+ - **Network.** Sphica has no account, no hosted service, and no telemetry, and makes no network connections itself. Two commands call other tools that may: `sphica harvest` runs `git fetch` and `gh api` with your credentials, and `sphica doctor` runs `npm` and `claude` to check installed versions.
130
+ - **Text written by others.** Pull request and issue text imported by `harvest` may come from anyone. It is passed to the agent as data, and the MCP server cannot write to the database.
131
+
132
+ 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.
133
+
134
+ 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.
135
+
136
+ ## Updating
137
+
138
+ The CLI and the plugin are updated separately.
139
+
140
+ ```bash
141
+ npm i -g sphica@latest
142
+ ```
143
+
144
+ Claude Code:
145
+
146
+ ```bash
147
+ claude plugin marketplace update sphica
148
+ claude plugin update sphica@sphica
149
+ ```
150
+
151
+ Codex:
152
+
153
+ ```bash
154
+ codex plugin marketplace upgrade sphica
155
+ codex plugin add sphica@sphica
156
+ ```
157
+
158
+ 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.
159
+
160
+ ## Uninstalling
161
+
162
+ ```bash
163
+ npm uninstall -g sphica
164
+ ```
165
+
166
+ Claude Code:
167
+
168
+ ```bash
169
+ claude plugin uninstall sphica@sphica
170
+ ```
171
+
172
+ Codex:
173
+
174
+ ```bash
175
+ codex plugin remove sphica@sphica
176
+ ```
177
+
178
+ Your records stay in `~/.sphica/` until you delete that directory yourself.
179
+
180
+ ## Troubleshooting
181
+
182
+ Run `sphica doctor` first. It shows which part is out of date or not working. Common cases:
183
+
184
+ - **`sphica: command not found`.** The plugin does not put the CLI on your PATH. Run `npm i -g sphica`.
185
+ - **Nothing is recorded.** Check that the repository is registered with `sphica project list`. In Codex, also check that the hooks are trusted in `/hooks`.
186
+ - **The MCP server reports an older version.** Restart the session, or run `/reload-plugins` in Claude Code.
187
+ - **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.
188
+
189
+ ## Commands
190
+
191
+ | Command | What it does |
192
+ |---|---|
193
+ | `sphica init` | Create the database |
194
+ | `sphica doctor` | Check versions, the database, and recording |
195
+ | `sphica project add` | Register the current repository as a project |
196
+ | `sphica harvest` | Import GitHub pull requests, issues, and Markdown docs |
197
+ | `sphica search <words>` | Search from the terminal |
198
+ | `sphica dashboard` | Browse sessions, work, and search results |
199
+
200
+ Run `sphica --help` for the full list and `sphica <command> --help` for each command's options.
201
+
202
+ ## Security
203
+
204
+ Report vulnerabilities privately as described in [SECURITY.md](https://github.com/iroha924/sphica/blob/main/SECURITY.md).
205
+
206
+ Since 0.37.1, each release is built by GitHub Actions from a tag on the head of a pull request whose CI has passed, and staged on npm.
207
+ The maintainer checks its SHA-512 checksum and provenance, then approves publication with two-factor authentication.
208
+ For these versions, the [npm page](https://www.npmjs.com/package/sphica#provenance) links to the workflow and the commit each one was built from.
209
+
210
+ Dependabot opens pull requests to update the GitHub Actions used in CI. It does not cover the npm dependencies bundled into the package, because Dependabot cannot read the Bun lockfile format (v2) this repository uses.
211
+
212
+ ## Contributing
213
+
214
+ Issues are welcome. Pull requests from outside contributors are closed without review, because the review tools here run with maintainer credentials and cannot safely check out code written by others.
215
+
216
+ Changes that add or change behavior include automated tests in the same pull request. CI runs them with `bun run verify` on every pull request.
217
+
218
+ ## License
219
+
220
+ [MIT](https://github.com/iroha924/sphica/blob/main/LICENSE). The published package bundles its dependencies. Their licenses are listed in `THIRD_PARTY_NOTICES.md` inside the package.