Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ venv/
/env/
build/
dist/
!/plugin/opencode/dist/
!/plugin/opencode/dist/**

# Node
node_modules/
Expand Down Expand Up @@ -51,4 +53,4 @@ benchmarks/memory_comparison/results

# Local design docs / brainstorm specs (kept out of public repo)
docs/superpowers/
marketing/
marketing/
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
VERSION_FILES := package.json plugin/pyproject.toml \
plugin/.claude-plugin/plugin.json plugin/.codex-plugin/plugin.json \
.claude-plugin/marketplace.json README.md
LOCK_FILES := plugin/uv.lock reflexio.lock.json
LOCK_FILES := package-lock.json plugin/uv.lock reflexio.lock.json
PYPROJECT := plugin/pyproject.toml

help:
Expand Down Expand Up @@ -93,6 +93,7 @@ bump: check-version unskip-worktree ## Rewrite version in all release manifests
package.json plugin/.claude-plugin/plugin.json plugin/.codex-plugin/plugin.json \
.claude-plugin/marketplace.json
@sed -i.bak -E 's/^version = "[^"]+"/version = "$(VERSION)"/' plugin/pyproject.toml
@python3 -c 'import json, pathlib; p=pathlib.Path("package-lock.json"); data=json.loads(p.read_text()); data["version"]="$(VERSION)"; data["packages"][""]["version"]="$(VERSION)"; p.write_text(json.dumps(data, indent=2) + "\n")'
@sed -i.bak -E 's|badge/version-[0-9]+\.[0-9]+\.[0-9]+([.-][A-Za-z0-9.-]+)?-green\.svg|badge/version-$(VERSION)-green.svg|' README.md
@rm -f package.json.bak plugin/pyproject.toml.bak \
plugin/.claude-plugin/plugin.json.bak plugin/.codex-plugin/plugin.json.bak \
Expand All @@ -116,6 +117,7 @@ bump: check-version unskip-worktree ## Rewrite version in all release manifests

publish-npm: check-vendor-reflexio check-locked-project-version ## Publish the current version to npm
@echo "→ npm publish"
npm run build:opencode
npm publish --access public

publish-pypi: check-pypi-compatible-reflexio unskip-worktree ## Build and publish the current version to PyPI
Expand All @@ -126,6 +128,7 @@ publish-pypi: check-pypi-compatible-reflexio unskip-worktree ## Build and publis

publish-dry: unskip-worktree check-vendor-reflexio check-locked-project-version ## Show what would be published without uploading
@echo "→ npm publish --dry-run"
@npm run build:opencode
@npm publish --dry-run
@echo ""
@echo "→ uv build (dry: inspect plugin/dist/ manually)"
Expand All @@ -135,6 +138,7 @@ publish-dry: unskip-worktree check-vendor-reflexio check-locked-project-version

package: check-vendor-reflexio check-locked-project-version ## Build the npm tarball locally without publishing
@echo "→ npm pack"
@npm run build:opencode
@tarball=$$(npm pack 2>/dev/null | tail -1); \
abs=$$(cd "$$(dirname "$$tarball")" && pwd)/$$(basename "$$tarball"); \
echo ""; \
Expand All @@ -143,8 +147,10 @@ package: check-vendor-reflexio check-locked-project-version ## Build the npm tar
echo "Install locally with one of:"; \
echo " npm install -g $$abs && claude-smart install"; \
echo " npm install -g $$abs && claude-smart install --host codex"; \
echo " npm install -g $$abs && claude-smart install --host opencode"; \
echo " npx --package=$$abs -- claude-smart install"; \
echo " npx --package=$$abs -- claude-smart install --host codex"
echo " npx --package=$$abs -- claude-smart install --host codex"; \
echo " npx --package=$$abs -- claude-smart install --host opencode"

publish: check-pypi-compatible-reflexio publish-npm publish-pypi ## Publish to both npm and PyPI

Expand Down
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
claude-smart
</h1>

<h4 align="center">A self-improvement plugin for <a href="https://claude.com/claude-code" target="_blank">Claude Code</a> and Codex that turns interactions into durable skills they follow in future sessions.</h4>
<h4 align="center">A self-improvement plugin for <a href="https://claude.com/claude-code" target="_blank">Claude Code</a>, Codex, and OpenCode that turns interactions into durable skills they follow in future sessions.</h4>

<p align="center">
<a href="LICENSE">
Expand All @@ -22,7 +22,7 @@
<img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg" alt="Node">
</a>
<a href="#quick-start">
<img src="https://img.shields.io/badge/hosts-Claude%20Code%20%2B%20Codex-purple.svg" alt="Hosts">
<img src="https://img.shields.io/badge/hosts-Claude%20Code%20%2B%20Codex%20%2B%20OpenCode-purple.svg" alt="Hosts">
</a>
<a href="https://discord.gg/7fnCxahase">
<img src="https://img.shields.io/badge/Discord-Join%20community-5865F2?logo=discord&logoColor=white" alt="Discord">
Expand Down Expand Up @@ -98,6 +98,24 @@ npx claude-smart uninstall --host codex

Restart Codex after uninstalling. The uninstaller stops local claude-smart services and removes plugin/cache/config state; learned data under `~/.reflexio/` and `~/.claude-smart/` is preserved and shared with Claude Code, so you can switch between hosts without losing skills or preferences.

### OpenCode

```bash
npx claude-smart install --host opencode
```

Then restart OpenCode in your project so it loads the plugin from `opencode.json`, the documented project config file. If that project does not already have a root config but does have `.opencode/opencode.json` or `.opencode/opencode.jsonc`, the installer updates that existing file instead of creating a second config. If both locations exist, the root config wins. Use `--global` to install into `~/.config/opencode/opencode.json` for all OpenCode projects on this machine. When run through `npx`, long-lived local services are prepared from OpenCode's installed plugin package on the next OpenCode launch instead of from npm's temporary `npx` cache.

OpenCode support is new and uses OpenCode's npm plugin loader to inject relevant learned context before each model request. Learning extraction runs `opencode run --pure` from an isolated temp project, so it uses OpenCode's default model unless you set `CLAUDE_SMART_OPENCODE_MODEL=provider/model`. Set that env var if your normal project config pins a different provider or model.

To uninstall:

```bash
npx claude-smart uninstall --host opencode
```

Restart OpenCode after uninstalling. The uninstaller removes only the `claude-smart` entry from OpenCode's plugin list; learned data under `~/.reflexio/` and `~/.claude-smart/` is preserved and shared across hosts.

Developing the plugin itself? See [DEVELOPER.md](./DEVELOPER.md#developing-locally) for what the installer does, manual toggles via `/plugins`, and clone-based development.

> **Not supported:** Claude Code Cowork, claude.ai/code web, or remote Codex environments without local plugin hooks — they run outside your local machine, so the local backend/dashboard and `~/.reflexio/` aren't reachable.
Expand Down Expand Up @@ -163,7 +181,7 @@ A web UI for browsing session histories, inspecting preferences, and editing pro

## How It Works

claude-smart builds three artifacts as you work and injects the relevant ones into Claude Code or Codex:
claude-smart builds three artifacts as you work and injects the relevant ones into Claude Code, Codex, or OpenCode:

- **Preferences** (project-scoped) — how you work in this specific repo (stack, role, small quirks). *e.g.* "uses pnpm, not npm"; "prefers terse answers"; "backend engineer — explain frontend with backend analogues."
- **Project-specific skills** — durable rules with triggers and rationales learned from corrections in a project. *e.g.* "always pass `--run` to `npm test` — watch mode hangs CI."
Expand Down Expand Up @@ -216,6 +234,7 @@ Advanced users can tune claude-smart via environment variables — see [DEVELOPE
| `.claude/settings.local.json` or `~/.claude/settings.json` | Claude Code hook environment, such as `CLAUDE_SMART_ENABLE_OPTIMIZER`; use project-local settings for one repo or user settings for all projects. |
| `~/.codex/config.toml` | Codex plugin state, hook feature flags, and per-hook trust entries after `claude-smart install --host codex`. |
| `~/.codex/plugins/cache/reflexioai/claude-smart/<version>/` | Codex's cached install of the `claude-smart` plugin from the `ReflexioAI` marketplace. |
| `opencode.json` / `opencode.jsonc`, or existing `.opencode/opencode.json*` | OpenCode local plugin config patched by `claude-smart install --host opencode`; the installer updates only the claude-smart entry in OpenCode's plugin list. |
| `~/.reflexio/plugin-root` | Self-healed symlink to the active plugin dir (managed by `ensure-plugin-root.sh` — written on install, refreshed each `SessionStart`). Claude Code slash commands and Codex shell-command helpers resolve through it, so don't delete it; if you do, the next session will recreate it. |
| `~/.claude-smart/sessions/{session_id}.jsonl` | Per-session buffer. User turns, assistant turns, tool invocations, `{"published_up_to": N}` watermarks. Safe to inspect and safe to delete — everything past the latest watermark has already been written to reflexio's DB. |
| `~/.claude-smart/node/current/` | Private Node.js/npm runtime used by hooks and the dashboard after install. |
Expand All @@ -229,8 +248,6 @@ For troubleshooting, see [TROUBLESHOOTING.md](./TROUBLESHOOTING.md).

claude-smart is powered by [**Reflexio**](https://reflexio.ai) — the self-improving engine that turns interactions into durable, reusable skills.

> **Building your own agent?** Want the same self-improvement loop — learning from corrections, optimizing proven paths, and growing a skill library — inside *your* product or agent? Get in touch at [**reflexio.ai**](https://reflexio.ai).

---

## License
Expand All @@ -248,4 +265,4 @@ See the [LICENSE](LICENSE) file for details.

---

**Powered by** [Reflexio](https://reflexio.ai) · **Runs on** [Claude Code](https://claude.com/claude-code) and Codex · **Written in** Python 3.12+
**Powered by** [Reflexio](https://reflexio.ai) · **Runs on** [Claude Code](https://claude.com/claude-code), Codex, and OpenCode · **Written in** Python 3.12+
Loading
Loading