Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By dzianisvv0.1.0MITIn 1 marketplace
Makes Claude stop after 30 minutes of working time in a session to reflect on its goal and blockers, then take the next concrete step. Idle gaps longer than 10 minutes reset the clock.
Trending plugins
7-day copy clicks
Run automatically on Claude Code events. Claude doesn't decide.
2 cautions to review before installing
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Long-task reflection hook for opencode and Claude Code. After 30 minutes of working time in a session, the agent gets a reflection prompt in its context and is told to act on the answer:
AUTOREFLECT: you have been working on this task for a while. Stop and reflect before the next step.
1. What are you doing right now?
2. What is the goal?
3. What is the acceptance criteria?
4. Did you complete the task? If not, what is wrong?
5. Is the implementation plan correct, or does it have to be revisited?
6. Are you moving in the right direction, or is there a better/faster way to resolve the issues and blockers?
7. Can you unblock yourself?
Then act on the answers: take the next concrete step now.
Idle sessions are never touched. The clock only runs while an execution is in progress; a gap
longer than idleResetMs (10 minutes) starts the next task from zero.
v2 loads a plugin directory through server.ts. Add the directory to plugin in
~/.config/opencode/opencode.json (a directory path, not a file — v2 rejects file paths):
{
"plugin": ["file:///absolute/path/to/opencode-plugins/packages/session-autoreflect"]
}
The plugin loads on the next config reload; no restart needed.
| Variable | Default | Meaning |
|---|---|---|
AUTOREFLECT_ENABLED | 1 | 0 disables the plugin |
AUTOREFLECT_INTERVAL_MS | 1800000 | working time before a reflection |
AUTOREFLECT_IDLE_RESET_MS | 600000 | idle gap that resets the accumulator |
AUTOREFLECT_TICK_MS | 30000 | timer resolution |
AUTOREFLECT_INCLUDE_CHILD | 0 | also reflect inside subagent sessions |
AUTOREFLECT_HOME | ~/.cache/session-autoreflect | event log directory |
Same keys are accepted in ~/.config/opencode/session-autoreflect.json (enabled,
intervalMs, idleResetMs, tickMs, includeChild); env vars win.
Each injection is logged to $AUTOREFLECT_HOME/events.jsonl (armed when the timer fires,
inject when the prompt reaches the model).
hooks/hooks.json registers three hooks:
PostToolUse — accumulates working time and returns additionalContext with the prompt.Stop — the task finished, reset the clock.SessionStart — reset the clock.Install from the marketplace:
claude plugin marketplace add dzianisv/opencode-plugins
claude plugin install session-autoreflect@opencode-plugins
Or wire the script directly into ~/.claude/settings.json:
{
"hooks": {
"PostToolUse": [{ "hooks": [{ "type": "command", "command": "python3 \"/abs/path/claude/autoreflect.py\" post-tool" }] }],
"Stop": [{ "hooks": [{ "type": "command", "command": "python3 \"/abs/path/claude/autoreflect.py\" stop" }] }],
"SessionStart": [{ "hooks": [{ "type": "command", "command": "python3 \"/abs/path/claude/autoreflect.py\" session-start" }] }]
}
}
State lives in ~/.claude/session-autoreflect/<session_id>.json (0700/0600). Same env vars
as above.
bun test # opencode
python3 -m unittest discover -s claude/tests # Claude Code
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub dzianisv/agents-plugins --plugin session-autoreflectPlugins from other owners that cover similar ground