{
  "markdown": "<p align=\"center\">\n  <img src=\"assets/elephant.png\" width=\"520\" alt=\"Elephant, the coding agent that never forgets\">\n</p>\n\n<h1 align=\"center\">Elephant</h1>\n\n<p align=\"center\">\n  <em>The model forgets. The elephant doesn't.</em>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://github.com/vishesh9131/elephant/stargazers\"><img src=\"https://img.shields.io/github/stars/vishesh9131/elephant?style=flat-square&color=111111&label=stars\" alt=\"GitHub stars\"></a>\n  <a href=\"https://github.com/vishesh9131/elephant/releases/latest\"><img src=\"https://img.shields.io/github/v/release/vishesh9131/elephant?style=flat-square&color=111111&label=release\" alt=\"Latest release\"></a>\n  <a href=\"https://github.com/vishesh9131/elephant/actions/workflows/ci.yml\"><img src=\"https://img.shields.io/github/actions/workflow/status/vishesh9131/elephant/ci.yml?branch=main&style=flat-square&color=111111&label=build\" alt=\"Build status\"></a>\n  <img src=\"https://img.shields.io/badge/works%20with-20%2B%20agents-111111?style=flat-square\" alt=\"Works with 20+ agents\">\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-111111?style=flat-square\" alt=\"MIT license\"></a>\n</p>\n\n<p align=\"center\">\n  <strong>Claude hits quota. Codex keeps going.</strong><br>\n  <sub>Automatic, local-first session continuity across AI coding harnesses.</sub>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://vishesh9131.github.io/elephant/\"><strong>Visit the Elephant website →</strong></a>\n</p>\n\n---\n\nYou know the ritual.\n\nClaude has the entire problem in its head. It has read the repo, found the bug,\nchanged six files, failed one test, and finally understood why.\n\nThen:\n\n```text\nYou've hit your usage limit.\n```\n\nYou open another agent. It cheerfully asks what you are working on.\n\nNow **you** are the context window.\n\nElephant removes that part.\n\n## Without / with Elephant\n\nWithout Elephant:\n\n```text\nClaude:  You've hit your usage limit.\nCodex:   What would you like to work on?\nYou:     Okay, so first you need to understand this 47-message conversation...\n```\n\nWith Elephant:\n\n```text\nClaude:    You've hit your usage limit.\n\n           [open the same repo in Codex]\n\nElephant:  Recovered the previous Claude Code session.\n           Objective: fix refresh-token rotation.\n           State: implementation complete; one integration test still fails.\n           Changed: auth/session.py, tests/test_rotation.py\n\nCodex:     I found the failing test. Continuing from there.\n```\n\nThe dead model does not need to summarize anything. Elephant was already\nrecording while it was alive.\n\n## How it works\n\nElephant is a plugin, not another command you babysit.\n\n```text\nEvery prompt, response, tool call, failure, and file change\n                         │\n                         ▼\n             append-only local journal\n                         │\n              completed turn / compaction /\n              interruption / quota failure\n                         │\n                         ▼\n                recovery capsule\n                         │\n             open the repo in another agent\n                         │\n                         ▼\n             objective + state + Git evidence\n```\n\nIt remembers:\n\n- the current objective and last completed state;\n- the last prompt and model response;\n- modified files and live Git state;\n- recent tool/model failures;\n- the latest 20 session events;\n- a redacted transcript reference when the host exposes one.\n\nEvery capture-capable native shell writes the same versioned event format. They\nshare `~/.elephant/elephant.db`, so Claude's memory is visible to Codex, Hermes,\nPi, OpenCode, Copilot, and every other Elephant adapter.\n\n## Three layers\n\n```text\n┌──────────────────────────────────────────────────────────────┐\n│ Native shells                                               │\n│ Claude · Codex · Hermes · OpenCode · Pi · Copilot · Gemini │\n├──────────────────────────────────────────────────────────────┤\n│ Elephant kernel                                             │\n│ redact · journal · checkpoint · inspect Git · build capsule │\n├──────────────────────────────────────────────────────────────┤\n│ Continuation                                                │\n│ automatic startup injection · Elephant Resume              │\n└──────────────────────────────────────────────────────────────┘\n```\n\nOne memory format. Thin native adapters. No universal fake CLI pretending every\nagent exposes the same API.\n\n## Install\n\nInstall once in each harness you want to hand work between. Python 3.10+ must\nbe available as `python3` for the local kernel and lifecycle hooks.\n\n### Claude Code\n\nSend these as two separate prompts inside Claude Code:\n\n```text\n/plugin marketplace add vishesh9131/elephant\n```\n\n```text\n/plugin install elephant@elephant\n```\n\nElephant adds lifecycle capture, local MCP recovery tools, automatic startup\nrecovery, and namespaced commands such as `/elephant:memorize`,\n`/elephant:resume`, and `/elephant:help`.\n\n### Codex\n\n```bash\ncodex plugin marketplace add vishesh9131/elephant\n```\n\nOpen `/plugins`, choose the **Elephant** marketplace, and install Elephant.\nReview and trust its local lifecycle hooks when Codex asks, then start a new\nsession.\n\n### GitHub Copilot CLI\n\n```bash\ncopilot plugin marketplace add vishesh9131/elephant\ncopilot plugin install elephant@elephant\n```\n\nThe same commands work interactively with a `/` prefix. Elephant captures all\nnine Copilot CLI plugin lifecycle events and provides the `resume` skill.\n\n### Gemini CLI\n\n```bash\ngemini extensions install https://github.com/vishesh9131/elephant --ref=v0.4.5\n```\n\nGemini loads Elephant's project context and `resume` skill. The public repo is\ntagged for Gemini's extension gallery crawler.\n\n### Pi\n\n```bash\npi install git:github.com/vishesh9131/elephant@v0.4.5\n```\n\nRequires Node.js 22.19+. Pi loads the native JavaScript extension,\n`/elephant <command>`, `/resume`, and the Elephant skills.\n\n### Hermes Agent\n\n```bash\nhermes plugins install vishesh9131/elephant --enable\n```\n\nRestart Hermes after installing. Elephant registers native lifecycle hooks, the\nrecovery tools, both Elephant skills, and `/elephant <command>`.\n\nWhy `/elephant` instead of `/resume`? Hermes already owns `/resume`. The\nelephant remembers names too.\n\n### OpenCode\n\nFrom a checkout, point your `opencode.json` at Elephant's JavaScript plugin:\n\n```json\n{\n  \"plugin\": [\"/absolute/path/to/elephant/.opencode/plugins/elephant.mjs\"]\n}\n```\n\nThe plugin captures prompts, responses, tool calls, compaction, idle, errors,\nand session end. The npm package is prepared but not published yet.\n\n## The rest of the herd\n\nNot every harness exposes lifecycle hooks. Elephant says exactly what each one\ncan do instead of painting “98% quota used” on a guess.\n\n| Harness | Support | Surface |\n|---|---|---|\n| Claude Code, Codex, Hermes, OpenCode, Pi | Native continuity | Hooks/extensions capture automatically and inject recovery |\n| GitHub Copilot CLI | Native recovery | Marketplace plugin, nine hooks, MCP, and skill |\n| Gemini / Antigravity, Qoder, Devin, Grok Build | Native recovery | Extension/plugin manifest plus recovery skill |\n| OpenClaw, Swival | Native recovery | Packaged skill collection |\n| Cursor | Portable recovery | [`.cursor/rules`](.cursor/rules) + Elephant MCP |\n| Windsurf | Portable recovery | [`.windsurf/rules`](.windsurf/rules) + Elephant MCP |\n| Cline | Portable recovery | [`.clinerules`](.clinerules) + Elephant MCP |\n| Kiro | Portable recovery | [`.kiro/steering`](.kiro/steering) + Elephant MCP |\n| CodeWhale, Amp, Jules, compatible hosts | Portable recovery | [`AGENTS.md`](AGENTS.md) |\n\nSee the [full platform matrix](docs/platform-native.md) for capability details\nand current conformance status.\n\n## What happens near quota?\n\nMostly, nothing special—and that is the point.\n\nMost coding harnesses do **not** expose an exact subscription percentage.\nElephant never invents one. Quota signals are stored as `exact`, `estimated`,\nor `unknown`.\n\nInstead of gambling everything on a mythical “99% used” callback, Elephant:\n\n1. journals continuously;\n2. checkpoints after every completed model turn;\n3. checkpoints again before compaction and at session end;\n4. records native interruption and quota-failure events when the host provides\n   them.\n\nIf the quota dies without warning, the memory is already on disk.\n\n## Manual handoff\n\nAutomatic journaling stays active, but you can force a handoff whenever you\nwant. In Claude Code:\n\n```text\n/elephant:memorize\n```\n\nThen open the same repository in Codex and invoke:\n\n```text\n$elephant resume\n```\n\nCodex receives the freshest capsule, compares it with the live worktree, and\ncontinues the unfinished objective. Codex exposes installed skills through `$`\nmentions; Claude plugin skills are namespaced as `/elephant:<command>`.\n\nFor a named chat handoff, use `@Elephant exact auth-fix` before switching\nharnesses, then `@Elephant pull auth-fix` in the new one. The prompt hook saves\nthe label before model execution and refreshes it on quota failure. If Elephant\nwas installed mid-session, it finds only the active chat for the exact current\nproject and safely snapshots its newest 256 KiB instead of copying an unbounded\nor unrelated transcript. Pull feeds\nthe redacted chat to the new harness, identifies the previous harness, and gives\na short summary without starting work until you ask.\n\nCodex `exact` uses the current bundled runtime before a possibly older Elephant\nMCP process. This preserves the active chat after a plugin refresh without\nrequiring the user to reconstruct it.\n\n| Command | Purpose |\n|---|---|\n| `memorize` | Force a fresh checkpoint of the current session |\n| `exact <label>` | Save a redacted chat snapshot in SQLite under a durable label |\n| `pull <label>` | Feed a labeled chat to another harness and summarize the handoff |\n| `resume [memory-id]` | Recover the latest or a selected memory and continue |\n| `help` | Show the complete command card |\n| `status` | Show protection, freshness, and transcript coverage |\n| `history [limit]` | List recent project memories |\n| `peek [memory-id]` | Preview recovery without continuing |\n| `note <text>` | Preserve an exact high-priority user instruction |\n| `doctor` | Check storage and adapter readiness |\n| `usage` | Show database, transcript, project, and global disk usage |\n| `clean [age] [--keep N] [--yes]` | Preview ancient sessions, then delete only with explicit confirmation |\n| `pin [memory-id]` | Protect a memory's entire source session from cleanup |\n| `unpin [memory-id]` | Remove cleanup protection from a source session |\n| `compact` | Repack SQLite and reclaim unused database pages without deleting memories |\n| `forget <target> --yes` | Permanently delete a capsule, session, or project memory |\n\nHermes and Pi use `/elephant <command>`. Other skill-capable hosts use\n`$elephant <command>`, their native skill picker, or natural-language invocation.\n\nCleanup is deliberately two-step. This only previews sessions older than 30\ndays, always retains at least the newest 10 sessions, and skips anything pinned:\n\n```text\n/elephant:clean\n```\n\nTo apply that preview in Claude Code, explicitly confirm it:\n\n```text\n/elephant:clean 30d --keep 10 --yes\n```\n\nThen `/elephant:compact` can reclaim unused database pages. In Codex, use the\nsame arguments after `$elephant`; in Hermes and Pi, use `/elephant`.\n\n## Local means local\n\nElephant has no account, cloud, analytics, telemetry, ad network, or mysterious\n“improve the product” upload.\n\n```text\n~/.elephant/\n├── elephant.db       # events, recovery capsules, and cleanup pins\n└── transcripts/      # optional compressed transcript copies\n```\n\nSensitive keys and common credential formats are redacted before persistence.\nRedaction is defense-in-depth, not magic: protect the machine and do not share\nthe database casually.\n\nSet `ELEPHANT_DATA_DIR` to move the store. Read the [privacy notice](docs/privacy.md)\nand [security policy](SECURITY.md).\n\n## Resume explicitly\n\nAutomatic recovery happens when a native host starts a new session in a project\nthat has an Elephant capsule from another session.\n\nWhen you want to ask directly:\n\n| Host | Command / skill |\n|---|---|\n| Claude Code | `/elephant:resume` |\n| Codex | `$elephant resume` |\n| Pi | `/elephant resume` or `/resume` |\n| Hermes | `/elephant resume` |\n| Other skill-capable hosts | invoke the `elephant` skill with `resume` |\n\nRecovery compares the capsule's Git metadata with the live worktree. The files\non disk win. Elephant remembers the past; it does not overwrite the present.\n\n## Tested, not merely listed\n\nThe conformance suite proves the same flow across adapters:\n\n```text\ncapture → checkpoint → switch harness → recover → verify Git state\n```\n\nThe current release includes:\n\n- real plugin-load checks for Claude Code, OpenCode, Pi, Copilot, and Hermes\n  when their binaries are installed, plus remote marketplace discovery in\n  Codex;\n- live model-turn verification for Copilot CLI and Hermes;\n- cross-harness Claude → OpenCode → Pi → portable recovery contracts;\n- 11 Python/JavaScript tests for journaling, redaction, MCP, manifests, and\n  continuation.\n\nRun everything available on your machine:\n\n```bash\nPYTHONPATH=src python3 scripts/conformance.py\npython3 -m unittest discover -s tests -v\n```\n\nThe event protocol is documented in [docs/protocol.md](docs/protocol.md).\n\n## FAQ\n\n**Does Elephant ask the dying model to summarize the session?**\n\nNo. A model at quota is about as useful as a fire alarm after the building is\ngone. Elephant records continuously and builds the handoff itself.\n\n**Does it copy my session to another company's server?**\n\nNo. Harnesses still send prompts to their own configured model providers, but\nElephant's journal stays on your machine.\n\n**Can it really know when I am at 98%?**\n\nOnly if the harness exposes that number. Most do not. Elephant would rather be\nuseful at an honest `unknown` than impressive at a fictional `98%`.\n\n**What if the repo changed after the handoff?**\n\nThe live worktree is authoritative. Elephant shows the old capsule as evidence,\ncompares Git state, and continues from what actually exists.\n\n**Why “Elephant”?**\n\nBecause “Cross-Harness Context Persistence Orchestration Kernel” remembered the\narchitecture and forgot the joke.\n\n## Development\n\nThe core is dependency-free Python. Host-specific code stays thin: manifests,\nhook maps, skills, and small JavaScript/Python adapters around the shared event\nprotocol.\n\nTo add another harness:\n\n1. declare what its API genuinely exposes;\n2. map native events into the Elephant protocol;\n3. package the host's native install surface;\n4. prove capture → checkpoint → recovery in conformance tests.\n\nContributions are welcome. Fake support badges are not.\n\n## License\n\n[MIT](LICENSE). Elephants travel better when the gate is open.\n",
  "bytes": 14786,
  "sha": "b7bf3b43c66eaf3f96a48cede76175cd8cc713522267bc59b7fe685b1ce94955",
  "repo_slug": "vishesh9131/elephant",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_vishesh9131_elephant_f4a285c0/readme"
}