Observed since 20 Oct, 21:13 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Capture agent runs, diagnose failure patterns, and generate workflow interventions.
AfterAction helps you understand why an agent run went wrong, what it missed, and what to change before the next attempt.
It captures runs, pulls in GitHub PR context, diagnoses repeat failure patterns, and turns that diagnosis into practical interventions such as prompt exports, repo instruction updates, and replay context.
Agent-assisted PR repair often fails in familiar ways:
AfterAction makes those mistakes visible and reusable. Instead of treating each run like a fresh start, it records the run, analyzes the failure surface, and prepares the next attempt with better context.
AGENTS.md, CLAUDE.md, GEMINI.md, CURSOR.md, and COPILOT.mdAfterAction is runner-agnostic by default.
shell: fallback mode for any CLI commandopenclaw: OpenClaw-specific targeting and transcript parsingclaude-code: Claude Code instruction targeting and transcript parsingcodex: Codex instruction targeting and transcript parsingIf a runner exposes richer output, AfterAction can extract structured events such as tool.called, file.edited, and retry.detected. If not, the shell path still works.
Requires Python 3.11+.
pip install afteragent
For development:
git clone https://github.com/txmed82/afteragent.git
cd afteragent
pip install -e .
Capture a simple run:
afteragent exec -- python3 -c "print('hello from afteragent')"
List runs and inspect one:
afteragent runs
afteragent show <run-id>
afteragent diagnose <run-id>
Open the local viewer:
afteragent ui
By default, AfterAction stores everything in .afteragent/ in the current repository.
Use this when you already know what command you want to run and you want the full trace.
afteragent exec -- codex run "Fix the failing tests"
afteragent exec -- openclaw repair
afteragent exec -- python3 scripts/repair.py
Use this when you want the failure surface first: changed files, review threads, checks, and CI evidence.
afteragent validate-pr --repo vega/sphinxext-altair --pr 16
afteragent diagnose <run-id>
Use this when a failed run surfaced useful guidance you want to preserve.
afteragent export-interventions <run-id>
afteragent apply-interventions <run-id>
Typical outputs include:
Use this when you want to retry from a known failure with interventions already loaded.
afteragent replay <run-id> -- python3 -c "import os; print(os.environ['AFTERACTION_SOURCE_RUN'])"
afteragent replay --runner claude-code <run-id> -- claude "Fix the failing PR"
afteragent replay --runner codex <run-id> -- codex run "Address review comments"
Use this when you want to validate a PR, apply interventions, and launch the next attempt in one step.
afteragent attempt-repair --repo vega/sphinxext-altair --pr 16 -- python3 -c "print('repair')"
afteragent attempt-repair --run-id <run-id> --runner openclaw -- openclaw repair
For a live pull request:
afteragent validate-pr --repo owner/name --pr 123
afteragent diagnose <validation-run-id>
afteragent apply-interventions <validation-run-id>
afteragent replay --runner claude-code <validation-run-id> -- claude "Fix the PR"
afteragent ui
For an existing failed local run:
afteragent diagnose <run-id>
afteragent export-interventions <run-id>
afteragent replay <run-id> -- python3 scripts/repair.py
AfterAction compares a replay against its source run and records whether things improved or got worse.
The score takes into account signals such as:
That makes it easier to answer a simple question: did the intervention actually help?
Inside .afteragent/ you will typically find:
afteragent.sqlite3: run metadata and event historyartifacts/: stdout, stderr, git diffs, GitHub context, and CI logsexports/: exported intervention setsapplied/: applied instruction patches and manifestsreplays/: replay input bundles and manifestsYou may also see repo instruction files updated in the project root, depending on the runner and what already exists:
AGENTS.mdCLAUDE.mdGEMINI.mdCURSOR.mdCOPILOT.mdThe repository includes an end-to-end matrix that exercises the subprocess path and runner adapters.
./scripts/e2e_matrix.sh
That script runs:
AfterAction is currently local-first:
ghThat keeps the loop inspectable and easy to run in a normal repository without extra infrastructure.
AfterAgent can optionally run an LLM pass over each captured run to identify failure patterns the rule-based detector missed and to author interventions tailored to that specific run. Four providers are supported: Anthropic, OpenAI, OpenRouter, and Ollama.
export ANTHROPIC_API_KEY=sk-ant-...
afteragent enhance <run-id>
Auto-detect picks anthropic + claude-sonnet-4-5 by default.
afteragent exec --enhance -- claude "fix the failing test"
Forces LLM enhancement for this run even if auto_enhance_on_exec = false in config.
Create .afteragent/config.toml:
[llm]
provider = "anthropic"
model = "claude-sonnet-4-5"
auto_enhance_on_exec = true
ollama pull qwen2.5-coder:7b
mkdir -p .afteragent && cat > .afteragent/config.toml <<EOF
[llm]
provider = "ollama"
model = "qwen2.5-coder:7b"
EOF
afteragent exec -- claude "fix the failing test"
afteragent enhance <run-id>
No API key required. Runs entirely on your machine. Recommended for local iteration before spending on hosted API tokens.
The anthropic and openai SDKs are optional dependencies:
pip install afteragent[anthropic] # Anthropic only
pip install afteragent[openai] # OpenAI / OpenRouter / Ollama
pip install afteragent[all] # Both SDKs
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.3.0 | 11 Apr 2026 | 3 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 21:13 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:dc686c6931a4bb082aad4b755a3eed164df919974a07537af622777a51d8ebcb