sphica 0.0.0 → 0.2.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.2.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.2.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,211 @@
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
+ - **GitHub and docs import.** `sphica harvest` imports pull requests, issues, and the repository's Markdown files.
25
+
26
+ 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
+
28
+ ## Requirements
29
+
30
+ - Node.js 24.15 or later
31
+ - Claude Code or Codex, or both
32
+ - `git`, to identify the repositories you register
33
+ - For `sphica harvest` only: the GitHub CLI (`gh`), signed in with `gh auth login`
34
+
35
+ ## Install
36
+
37
+ The plugin ships the MCP server, hooks, and skills. The `sphica` CLI comes from npm and is installed separately. You need both.
38
+
39
+ **1. Install the CLI**
40
+
41
+ ```bash
42
+ npm i -g sphica
43
+ ```
44
+
45
+ **2. Add the plugin**
46
+
47
+ Claude Code:
48
+
49
+ ```bash
50
+ claude plugin marketplace add iroha924/sphica
51
+ claude plugin install sphica@sphica
52
+ ```
53
+
54
+ Codex:
55
+
56
+ ```bash
57
+ codex plugin marketplace add iroha924/sphica --ref main
58
+ codex plugin add sphica@sphica
59
+ ```
60
+
61
+ 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.
62
+
63
+ **3. Create the database**
64
+
65
+ ```bash
66
+ sphica init
67
+ ```
68
+
69
+ This creates `~/.sphica/sphica.db`. Running it again leaves an existing database untouched.
70
+
71
+ **4. Check the setup**
72
+
73
+ ```bash
74
+ sphica doctor
75
+ ```
76
+
77
+ `doctor` checks Node.js, the CLI and plugin versions, the database, and the recording queue. Start here whenever something looks wrong.
78
+
79
+ ## Quick start
80
+
81
+ Sphica writes sessions to the database only for repositories you register. A registered repository is called a project.
82
+
83
+ ```bash
84
+ cd ~/Projects/your-repo
85
+ sphica project add
86
+ ```
87
+
88
+ If the repository has no `origin` remote, give it a name: `sphica project add --name <name>`.
89
+
90
+ Then work as usual in Claude Code or Codex. To bring back earlier decisions, ask the agent:
91
+
92
+ - "Did we already decide how to handle retries here?"
93
+ - "Why did we choose this approach?"
94
+ - "What did I say about the migration last week?"
95
+ - "Let's continue where we left off."
96
+
97
+ The agent searches with `recall` and opens full records with `read`. At the end of a session with decisions worth keeping, run `/sphica:trace`.
98
+
99
+ To import GitHub history and Markdown docs:
100
+
101
+ ```bash
102
+ sphica harvest # every project Sphica can find on this machine
103
+ sphica harvest --cwd . # only the current repository
104
+ ```
105
+
106
+ Without `--cwd`, Sphica looks for projects directly under `~/Projects` and for projects registered with `--name`. Use `--cwd` for a repository somewhere else.
107
+ Docs are read from the default branch of `origin`, or from the local `HEAD` when there is no `origin`.
108
+
109
+ ## What gets recorded and where it goes
110
+
111
+ - **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.
112
+ - **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.
113
+ - **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.
114
+ - **Secrets.** Only secrets with a recognizable shape are masked:
115
+ - keys with known prefixes
116
+ - `KEY=…` and `"password": …` assignments
117
+ - credentials in URLs
118
+ - authorization headers
119
+ - `mysql -p`
120
+
121
+ **Anything else is stored as typed, so do not paste secrets into a session.**
122
+ - **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.
123
+ - **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.
124
+
125
+ 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.
126
+
127
+ 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.
128
+
129
+ ## Updating
130
+
131
+ The CLI and the plugin are updated separately.
132
+
133
+ ```bash
134
+ npm i -g sphica@latest
135
+ ```
136
+
137
+ Claude Code:
138
+
139
+ ```bash
140
+ claude plugin marketplace update sphica
141
+ claude plugin update sphica@sphica
142
+ ```
143
+
144
+ Codex:
145
+
146
+ ```bash
147
+ codex plugin marketplace upgrade sphica
148
+ codex plugin add sphica@sphica
149
+ ```
150
+
151
+ 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.
152
+
153
+ ## Uninstalling
154
+
155
+ ```bash
156
+ npm uninstall -g sphica
157
+ ```
158
+
159
+ Claude Code:
160
+
161
+ ```bash
162
+ claude plugin uninstall sphica@sphica
163
+ ```
164
+
165
+ Codex:
166
+
167
+ ```bash
168
+ codex plugin remove sphica@sphica
169
+ ```
170
+
171
+ Your records stay in `~/.sphica/` until you delete that directory yourself.
172
+
173
+ ## Troubleshooting
174
+
175
+ Run `sphica doctor` first. It shows which part is out of date or not working. Common cases:
176
+
177
+ - **`sphica: command not found`.** The plugin does not put the CLI on your PATH. Run `npm i -g sphica`.
178
+ - **Nothing is recorded.** Check that the repository is registered with `sphica project list`. In Codex, also check that the hooks are trusted in `/hooks`.
179
+ - **The MCP server reports an older version.** Restart the session, or run `/reload-plugins` in Claude Code.
180
+ - **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.
181
+
182
+ ## Commands
183
+
184
+ | Command | What it does |
185
+ |---|---|
186
+ | `sphica init` | Create the database |
187
+ | `sphica doctor` | Check versions, the database, and recording |
188
+ | `sphica project add` | Register the current repository as a project |
189
+ | `sphica harvest` | Import GitHub pull requests, issues, and Markdown docs |
190
+
191
+ Run `sphica --help` for the everyday commands, `sphica -H` for every command (including the ones agents and maintenance use), and `sphica <command> --help` for each command's options.
192
+
193
+ ## Security
194
+
195
+ Report vulnerabilities privately as described in [SECURITY.md](https://github.com/iroha924/sphica/blob/main/SECURITY.md).
196
+
197
+ 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.
198
+ The maintainer checks its SHA-512 checksum and provenance, then approves publication with two-factor authentication.
199
+ 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.
200
+
201
+ 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.
202
+
203
+ ## Contributing
204
+
205
+ 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.
206
+
207
+ 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.
208
+
209
+ ## License
210
+
211
+ [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.