majiayu000/agent-estate
Perpetual autonomous work loop for Claude Code — no end condition, no memory regression, no context overfill. Maintains a persistent ledger across all sessions.
npx skills add https://github.com/majiayu000/claude-skill-registry --skill agent-estate
Perpetual autonomous work loop plugin for Claude Code. Turns Claude into an agent that works cycle after cycle, maintaining a persistent ledger across all sessions, never stopping until explicitly told to.
Agent Estate creates an infinite work loop by intercepting Claude's stop events via a shell hook. Each time Claude tries to exit, the hook blocks the exit, increments the cycle counter, and re-injects the prompt — creating a true perpetual agent.
agent-estate/
├── .claude-plugin/plugin.json # Plugin manifest (name, version, author)
├── commands/
│ ├── start.md # /agent-estate:start — activates the loop
│ ├── stop.md # /agent-estate:stop — removes state file to allow exit
│ └── status.md # /agent-estate:status — shows cycle count, ledger summary
├── hooks/
│ ├── hooks.json # Registers stop-hook.sh on the "Stop" event
│ └── stop-hook.sh # Core engine: blocks exit, increments cycle, re-injects prompt
├── scripts/
│ └── setup-estate.sh # Creates .claude/agent-estate.local.md state file
├── LICENSE
└── README.md
hooks/stop-hook.sh)The core engine. Runs on every Claude "Stop" event:
.claude/agent-estate.local.md exists (is the loop active?)done: true in frontmatter): removes state file, exits normally (auto-stop){"decision": "block", "reason": "..."} to prevent exitscripts/setup-estate.sh)Creates the state file at .claude/agent-estate.local.md with YAML frontmatter (active, cycle, started_at, user_prompt) and the full cycle protocol instructions. If already active, outputs current state and continues.
.claude/agent-estate.md)The persistent brain — every Claude session reads and updates it. Contains:
.claude/agent-estate.local.md)Ephemeral file that signals an active loop. Contains the cycle counter and preserved user prompt. Removing this file (via /agent-estate:stop) is the only way to end the loop.
| Command | Description |
|---------|-------------|
| /agent-estate:start | Activate the loop in perpetual mode (no end condition) |
| /agent-estate:start <prompt> | Start perpetual mode with a specific task focus |
| /agent-estate:start --done <prompt> | Start in done mode — auto-stops when task is complete |
| /agent-estate:status | Show current cycle, mode, stats, and the latest handoff message |
| /agent-estate:stop | Manually remove the state file to stop the loop |
Built into the agent instructions, in order:
Each cycle follows this pattern:
.claude/agent-estate.md (the ledger)jq — required for JSON output in the stop hookgit clone https://github.com/MercuriusDream/agent-estate.git
mkdir -p ~/.claude/plugins/local
ln -s "$(pwd)/agent-estate" ~/.claude/plugins/local/agent-estate
chmod +x agent-estate/scripts/setup-estate.sh
chmod +x agent-estate/hooks/stop-hook.sh
/agent-estate:start <prompt> for focused work without being restrictiveTake majiayu000/agent-estate from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.