agent-token-saver-devin
Skill8 starsChanged 3 months agoMITView on GitHub
Devin token-saver profile — repo-instructions + shell-wrapper + KB retrieval instead of host hooks; subagents use bounded capsules.
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-token-saverSkill
- agent-token-saverSkill
The file
Files
Agent Token Saver — Devin Profile
Devin hat keine host-nativen Prompt-Hooks (wie Codex UserPromptSubmit oder Claude PreToolUse). Dieses Profil ersetzt Hooks durch 3 portable Seams:
- Repo-Instructions (
AGENTS.md) — einmal gelesen, keine per-turn Kosten. - Shell-Wrapper (
devin-token-saver.sh) — sourced die universelleagent-token-saver.shund leitet noisy Commands durchrtk. - Knowledge Base —
SKILL.md+ Referenzen, RAG-gated (zero-hot: lädt nur, wenn Task es braucht).
When to use
- Devin-Sessions auf Repo mit
.agents/skills/agent-token-saver-devin/SKILL.md. - Delegate-Subagents (parallele Lanes).
- Workloads mit Host-Instruction-Bloat (10k–60k+ Tokens).
Nicht verwenden bei hook-fähigen Agents (Codex, Claude Code, Hermes, GG Coder) — da agent-token-saver canonical nutzen.
Default ladder
AGENTS.mdnennt Wrapper + Capsule-Protokoll — einmal gelesen.source scripts/devin-token-saver.shinstalliert Aliases (ps,git diff,git log,docker logs,cat *.log) →rtkwenn present, else passthrough. Die universellenats-*/goal-*Funktionen kommen vonagent-token-saver.sh;devin-*sind Backward-Compat-Aliase.si route "<task>" --max 1 --strict --json— explicit CLI, nie auto-load.- KB für tiefe Docs —
FULL_CONTEXT_MEASUREMENT,SUBAGENT_CONTEXT_PROTOCOLlive in Devins KB. - Delegate-Subagents: 300–700 Token Capsule, closed oracle, max 3 Worker.
- Post-Session:
agent-token-ledgerüber exported JSONL →unattributed_input_tokens.
Setup
./install-universal.sh --profile lean --agent repo --project /path/to/target
cp skills/agent-token-saver-devin/SKILL.md /path/to/target/.agents/skills/agent-token-saver-devin/
cp integration/cli/devin-token-saver.sh /path/to/target/scripts/ && chmod +x /path/to/target/scripts/devin-token-saver.sh
cp integration/cli/agent-token-saver.sh /path/to/target/scripts/ && chmod +x /path/to/target/scripts/agent-token-saver.shDann Devin-Block an AGENTS.md anhängen (Template in integration/cli/devin-bootstrap.md).
Wrapper contract (fail-open)
rtkfehlt → Alias passthrough.sifehlt → Routing übersprungen. Kein Error.- Aliases ändern nie Approval-Policy oder User-Input. Idempotent bei zweimaligem Sourcing.
Delegate protocol
- 1 Controller (teures Model) + max 3 Worker (billig, z.B.
kimi-worker). - Pro Worker: 300–700 Token Capsule (Pfade, Hashes, Constraints, PASS/FAIL-Oracle). Kein Parent-Transcript.
- 0 oder 1 gerouteter Skill pro Worker — nie der Controller-Katalog.
agent-token-ledgersummiert Parent + Children + Retries. Parallelismus spart Wall-Time, nicht automatisch Provider-Tokens.
Ref: docs/SUBAGENT_CONTEXT_PROTOCOL.md.
Maximization stack (optional, additiv)
Synapse Ultra (Pre/Post-Session Brain)
- Pre:
ats-synapse-prime "<topic> devin <repo> decisions"(alias:devin-synapse-prime) →synx hybridzero-hot RAG. - Post:
ats-synapse-remember "<title>" "<decision>"(alias:devin-synapse-remember) →synx put. - Post:
ats-synapse-ingest <session.jsonl>(alias:devin-synapse-ingest) →devin-usage.py→~/.synapse/brain.db, tracksunattributed_input_tokensinmeta.ATS_AGENT_NAME=devinwird vom Devin-Wrapper gesetzt. - Inspect:
synapse-ultra events --agent devin,replay --session <id>,why --uri file:src/foo.rs --depth 5.
DuckLake (Token-Ledger Time-Travel)
just dl-ingest token_ledger data/benchmarks/devin-session-*.json— Snapshots.just dl-at token_ledger 30— Time-Travel.just dl-branch conservative-routing— A/B.just dl-sql "SELECT skill, COUNT(*) FROM c.token_ledger GROUP BY skill"— OLAP.
DuckLake = OLAP (Parquet + Snapshots), Synapse = OLTP (live Brain). Sie komponieren.
VelesDB & L1 PROMPT_COMMAND
Evaluiert, nicht integriert. Details in MASTER-PLAN.md §6 (Revisit-Kriterien) und §3 (L1-Trap-Conditions).
Goal-achievement system (omnigoal pattern)
Die universelle goal-* CLI implementiert oracle-gated stop: Session stoppt wenn Oracle PASS oder Budget erschöpft. Goals als JSON in ~/.synapse/goals/ — cross-agent koordinierbar ohne Transcript-Sharing. devin-goal-* sind Backward-Compat-Aliase.
# 1. Goal mit checkable Definition-of-Done
goal-init "fix-cargo-test" \
--oracle "cargo test --workspace 2>&1 | tail -1 | grep -q 'test result: ok'" \
--budget-tokens 50000 --deadline 2h
# 2. Prime + Route + Spawn (Capsule, NICHT Transcript)
ats-synapse-prime "devin superweb cargo-test decisions"
si route "fix cargo test" --max 1 --strict --json
goal-spawn fix-cargo-test --capsule capsules/extract-errors.md --skill none
# 3. Check + Close (persistiert Summary zu synx)
goal-check fix-cargo-test
goal-close fix-cargo-test --summary "Fixed 3 errors, oracle green, 12k tokens"Warum superintelligent:
- Oracle-gated stop — keine "I think I'm done" Self-Delusion.
- Bottleneck-Identification —
goal-checkextrahierterror|fail|missing|panic, Agent arbeitet an Root-Cause. - Bounded budget —
--budget-tokenscappt Runaway-Sessions. - Cross-agent coordination via Goal-JSON — Subagents sehen Capsule + Goal, nicht 200k-Token-Transcript. Das ist der Token-Saver-Integration-Punkt.
- Persistent outcome —
goal-close→synx put→ nächste Session kannats-synapse-primees abrufen. - DuckLake-archiveable —
just dl-ingest goals ~/.synapse/goals/*.jsonfür Time-Travel-Analytics.
Oracle-Design-Regeln:
- Single shell command, return 0 on success. Teste Outcome, nicht Process. Deterministisch.
- Beispiele:
cargo test ... | grep -q 'test result: ok'·grep -c 'TODO' src/lib.rs | grep -q '^0$'·jq -e '.passes > 100' reports/bench.json·superweb qa <url> --fail-on any
When NOT to use: Triviale Tasks (<5 min, <5k Tokens) · One-shot Research · exploratives Pair-Programming (Oracle forciert zu frühe Konvergenz).
ROI: Bei Tasks >30 min oder >20k Tokens: 40–60% Token-Savings (gemessen auf cargo-test-fix Workflows).
What this profile does NOT do
- Kein MCP-Server im Default — CLI/File/JSON-Seams sind billiger. Nur
context-mode/Graphifyon-demand. - Kein Skill-Auto-Loading — Router ist explicit CLI. Max 1 Skill, nie 2+.
- Kein Ponytail/Caveman im Default — Instruction-Tokens kosten mehr als sie bei kurzen Answers sparen.
- Kein Host-Instruction-Bloat in
AGENTS.md— tiefere Docs in KB.
Done gate
- Selbes Resultat vor/nach Optimierung. · Wrapper sourced, Aliases verifiziert (
type ps). ·si routereturned 0 oder 1 Skill. · Worker haben unabhängige Capsules. ·agent-token-ledgerran,unattributed_input_tokensrecorded. · Optionale Tools blieben optional.
Companion CLI
agent-token-saver doctor --profile teams --json
si route "<task>" --max 1 --strict --json
agent-token-ledger --usage parent=run.jsonl --usage child-1=delegate1.jsonl --provider codex --expected-workers 1 --require-complete-team --require-within-guard --out token-ledger.mdSee also
skills/agent-token-saver/SKILL.md— canonical hook-based skill.integration/cli/agent-token-saver.sh— universeller Shell-Wrapper (ats-*+goal-*).integration/cli/devin-token-saver.sh— Devin-spezifischer Wrapper (devin-*Aliase).skills/agent-token-saver-devin/MASTER-PLAN.md— 8-Phase Rollout + ROI-Messung + Test-Prompt.skills/agent-token-saver-devin/capsule-template.md— Capsule-Vorlage.docs/SUBAGENT_CONTEXT_PROTOCOL.md·docs/CLI_FIRST_POLICY.md·docs/FULL_CONTEXT_MEASUREMENT.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

