Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 0 additions & 11 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ unfamiliar code with its composed-context command before exploring.
npm install -g lean-ctx-bin && lean-ctx onboard
```

## Cross-session memory — engram

Use [engram](https://github.com/Gentleman-Programming/engram) MCP tools for
persistent cross-session memory: recall relevant context at session start,
store durable decisions/facts as you learn them, create a handoff before a
long session ends.

```bash
go install github.com/Gentleman-Programming/engram/cmd/engram@latest
engram mcp # or whatever your tool's MCP config points at
```

## Web search

Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ agentflare/
│ ├── components.rs # registry: each entry checks + fixes itself, host-aware
│ ├── paths.rs # home-dir resolution
│ ├── state.rs # ~/.agentflare/state.json — on/off flag for hooks
│ ├── rule_text.rs # shared rule copy (Exa, git, lean-ctx, engram usage)
│ ├── engram_install.rs # engram safe-install logic (go install/brew only)
│ ├── rule_text.rs # shared rule copy (Exa, git, lean-ctx usage)
│ ├── cost.rs # cost tracking
│ ├── optimize.rs # optimization logic
│ └── pricing.rs # model pricing data
Expand Down
280 changes: 280 additions & 0 deletions KNOWN_ISSUES.md

Large diffs are not rendered by default.

32 changes: 10 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ Two non-overlapping layers, plus two Claude-Code-only companions:
| Layer | What it compresses | Tool |
|---|---|---|
| **lean-ctx** | tool I/O *within* a session — reads, shell output, search, up to 99% | [yvgude/lean-ctx](https://github.com/yvgude/lean-ctx) |
| **engram** | knowledge *across* sessions — decisions, facts, preferences that survive a session ending | [Gentleman-Programming/engram](https://github.com/Gentleman-Programming/engram) |
| **Caveman** (Claude Code only) | conversation verbosity, ~65% | companion plugin |
| **Ponytail** (Claude Code only) | code-writing over-engineering | companion plugin |

lean-ctx and engram aren't substitutes for each other — one saves tokens inside a
session, the other saves the re-explaining tax across sessions.
lean-ctx handles token compression within a session.

**Why Rust, not Node:** Claude Code doesn't bundle or require Node.js — it's a
standalone compiled binary. A plugin whose hooks shell out to `node` breaks on
Expand All @@ -49,7 +47,6 @@ supporting evidence in its own repo, it's flagged instead of repeated.
| lean-ctx | 98.1% compression (`map` mode), 96.7% (`signatures`), ~99.99% cached re-read | CI-gated, reproducible via `lean-ctx benchmark report .`, measured on a 50-file repo with the GPT-4o tokenizer | High — real, reproducible, methodology named |
| Caveman | 65% avg output-token reduction (range 22–87%, 10 prompts) | Committed in `benchmarks/`/`evals/` — and its own docs flag the failure mode: ~1–1.5k input-token overhead per turn can make it net-negative on already-terse workloads (`docs/HONEST-NUMBERS.md`) | High — reproducible, unusually transparent about limits |
| Ponytail | ~54% less code (94% ceiling on best task), ~20% cheaper, ~27% faster, 100% safe | 12 real feature tasks on a FastAPI+React repo, Haiku 4.5, n=4 — self-corrected an earlier overgeneralized single-shot figure | High — reproducible, self-corrected once already |
| engram | "95.8% accuracy on LongMemEval-S — #1 globally" | **Not citing this.** No benchmark directory, results file, or harness exists anywhere in the repo, despite being listed as a shipped feature. | Unverifiable — flagged, not repeated |

### Real usage, one live project

Expand All @@ -60,11 +57,10 @@ for a sense of scale. Not a controlled benchmark; one data point, your mileage v
lean-ctx 34.2M tokens saved 92% compression $88.45 saved (lifetime; lean-ctx gain)
caveman 1.16M tokens saved (~65%) (single session; caveman-stats hook)
ponytail 23 `ponytail:` shortcut markers logged, no token figure (ponytail doesn't measure per-repo savings)
engram 2 sessions, 11 observations tracked, across 2 projects (engram stats)
```

Check your own: `lean-ctx gain` · `/caveman-stats` (Claude Code) · `ponytail-debt` skill ·
`engram stats`. Don't trust this table blindly either — re-run those commands yourself.
Check your own: `lean-ctx gain` · `/caveman-stats` (Claude Code) · `ponytail-debt` skill.
Don't trust this table blindly either — re-run those commands yourself.

---

Expand Down Expand Up @@ -127,21 +123,14 @@ plugin loader:
codex plugin marketplace add getappz/agentflare
codex plugin install agentflare
```
then `agentflare init --agent codex` for the rules/lean-ctx/engram setup (Codex's
then `agentflare init --agent codex` for rules/lean-ctx setup (Codex's
hook wiring itself comes from the plugin manifest, not `init`).

Each run: writes rule files (if absent), installs lean-ctx (`npm install -g
lean-ctx-bin && lean-ctx onboard`) and engram (`go install`/`brew`, never the
prebuilt Windows binary — see below) if missing, wires hooks/MCP where the host
lean-ctx-bin && lean-ctx onboard`) if missing, wires hooks/MCP where the host
supports it. Detection-first — already-satisfied components are skipped, nothing
gets clobbered.

**engram's install safety**: the project's own docs say prebuilt Windows binaries
get flagged as AV false positives, and explicitly recommend `go install` or
Homebrew instead. `agentflare init` only auto-installs engram through one of those
two paths; if neither is available, it prints the exact command instead of
downloading something that might trip your AV.

## Docs-only fallback (Aider, other AGENTS.md readers)

```bash
Expand All @@ -158,8 +147,7 @@ src/
│ # dirs::home_dir() ignores HOME/USERPROFILE overrides on
│ # Windows, learned the hard way)
├── state.rs # ~/.agentflare/state.json — on/off flag for the hooks
├── rule_text.rs # shared rule copy (Exa, git, lean-ctx, engram usage)
├── engram_install.rs # engram's safe-install logic (go install/brew only)
├── rule_text.rs # shared rule copy (Exa, git, lean-ctx usage)
├── components.rs # registry: each entry checks + fixes itself, host-aware
├── init.rs # `agentflare init --agent X` — runs every component,
│ # wires hooks directly for claude-code/cursor
Expand All @@ -178,15 +166,15 @@ Adding a new managed component means adding one entry to `components.rs` — nei

## What Gets Created

**Claude Code**: `~/.claude/rules/{exa,git,lean-ctx,engram}.md`, `~/.claude/settings.json` hooks section, `~/.config/{caveman,ponytail}/config.json`, `~/.agentflare/`.
**Claude Code**: `~/.claude/rules/{exa,git,lean-ctx}.md`, `~/.claude/settings.json` hooks section, `~/.config/{caveman,ponytail}/config.json`, `~/.agentflare/`.

**Codex**: project-local `AGENTS.md` (only if absent), `~/.agentflare/`.

**Cursor**: project-local `.cursor/rules/agentflare.mdc`, `.cursor/hooks.json`, `~/.cursor/mcp.json`, `~/.agentflare/`.

**Windsurf/VS Code/Cline**: project-local rules file (see table above), MCP config for lean-ctx/engram.
**Windsurf/VS Code/Cline**: project-local rules file (see table above), MCP config for lean-ctx.

**Continue**: `.continue/mcpServers/{agentflare,engram}.json`.
**Continue**: `.continue/mcpServers/agentflare.json`.

Nothing is created if it already exists.

Expand All @@ -196,7 +184,7 @@ Nothing is created if it already exists.

Remove the binary (see Install section above), then remove whatever `init`
wrote for the hosts you set up — see "What Gets Created" above. Ponytail/
Caveman/engram plugins themselves stay installed (uninstall separately if
Caveman plugins themselves stay installed (uninstall separately if
wanted).

---
Expand Down
5 changes: 2 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ Please report security issues privately, not as a public GitHub issue:

agentflare is a **local-only CLI**. `agentflare init --agent X` writes hook/rule
config files into your agent's own config (e.g. `~/.claude/settings.json`,
`.cursor/hooks.json`) and installs its two managed components — lean-ctx and
engram — via each tool's own package manager (`npm`, `go install`, `brew`).
`.cursor/hooks.json`) and installs lean-ctx via npm.
`agentflare hook session-start|prompt-submit` runs at your agent's hook
call sites, reading/writing only files under `~/.agentflare/` and the config
paths listed in the README's "What Gets Created" section.

**Does:**
- Read/write its own state at `~/.agentflare/state.json`
- Write hook/rule config into the target agent's own settings files (only if absent — never overwrites)
- Shell out to `npm`, `go`, `brew`, `git` to install/check lean-ctx and engram
- Shell out to `npm`, `go`, `brew`, `git` to install/check lean-ctx
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

**Does NOT:**
- Make any network requests itself (no telemetry, no update check, no dependencies that touch the network — see `Cargo.toml`: `clap`, `serde`, `serde_json`, `dirs` only)
Expand Down
2 changes: 1 addition & 1 deletion crates/agentflare-artifacts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- *(artifacts)* handoff envelope, version diff, git provenance, dedupe, search
- *(artifacts)* version history, CAS updates, md/mermaid rendering, LAN sharing
- *(artifacts)* add agentflare artifacts serve CLI, fix tests
- *(hook)* add SessionEnd hook with engram handoff
- *(hook)* add SessionEnd hook

### Fixed

Expand Down
10 changes: 5 additions & 5 deletions crates/gateway-registry/src/audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ mod tests {
fn record_appends_a_line_with_expected_fields_and_no_raw_args() {
let tmp = tempfile::NamedTempFile::new().unwrap();
let path = tmp.path();
let args = serde_json::json!({"secret_value": "do-not-leak-me"});
let args = serde_json::json!({"query": "x", "limit": 5});

record(path, "engram", "memory_store", &args, Ok(()));
record(path, "engram", "memory_store", &args, Err("Upstream"));
record(path, "memory_store", "search", &args, Ok(()));
record(path, "memory_store", "search", &args, Err("Upstream"));

let contents = std::fs::read_to_string(path).unwrap();
assert!(!contents.contains("do-not-leak-me"), "{contents}");
let lines: Vec<&str> = contents.lines().filter(|l| !l.is_empty()).collect();
assert_eq!(lines.len(), 2);

let first: Value = serde_json::from_str(lines[0]).unwrap();
assert_eq!(first["server"], "engram");
assert_eq!(first["tool"], "memory_store");
assert_eq!(first["server"], "memory_store");
assert_eq!(first["tool"], "search");
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
assert_eq!(first["outcome"], "ok");
assert!(first["args_hash"].is_string());

Expand Down
Loading