afteragent 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AfterAction Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: afteragent
3
+ Version: 0.1.0
4
+ Summary: Capture agent runs, diagnose failure patterns, and generate workflow interventions.
5
+ Author-email: Colin <colinson@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/txmed82/afteragent
8
+ Project-URL: Repository, https://github.com/txmed82/afteragent
9
+ Project-URL: Issues, https://github.com/txmed82/afteragent/issues
10
+ Keywords: agent,debugging,ci,workflow,diagnostics,llm
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Testing
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Dynamic: license-file
23
+
24
+ # AfterAction
25
+
26
+ AfterAction helps you understand why an agent run went wrong, what it missed, and what to change before the next attempt.
27
+
28
+ 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.
29
+
30
+ ## Why this exists
31
+
32
+ Agent-assisted PR repair often fails in familiar ways:
33
+
34
+ - the agent keeps fixing the wrong files
35
+ - failing CI checks never make it into the plan
36
+ - review comments stay unresolved across attempts
37
+ - the next run starts without the lessons from the last one
38
+
39
+ 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.
40
+
41
+ ## Who it's for
42
+
43
+ - engineers using coding agents to fix pull requests
44
+ - teams experimenting with Claude Code, Codex, OpenClaw, or plain CLI runners
45
+ - people who want a local audit trail for agent behavior
46
+ - anyone trying to turn trial-and-error repair loops into a more disciplined workflow
47
+
48
+ ## What it does
49
+
50
+ - captures command runs, output, exit codes, diffs, events, and artifacts
51
+ - ingests GitHub PR context including changed files, review threads, checks, workflow runs, and CI log excerpts
52
+ - diagnoses patterns like repeated failures, low overlap with failing files, ignored review comments, and broad edit drift
53
+ - exports interventions as task prompts, runner context, replay context, and repo instruction patches
54
+ - applies repo instruction updates to files like `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `CURSOR.md`, and `COPILOT.md`
55
+ - replays a prior run with intervention context injected into the environment
56
+ - scores replay outcomes so you can tell whether the next attempt improved or regressed
57
+ - serves a local UI for runs, findings, interventions, and replay comparisons
58
+
59
+ ## Runner support
60
+
61
+ AfterAction is runner-agnostic by default.
62
+
63
+ - `shell`: fallback mode for any CLI command
64
+ - `openclaw`: OpenClaw-specific targeting and transcript parsing
65
+ - `claude-code`: Claude Code instruction targeting and transcript parsing
66
+ - `codex`: Codex instruction targeting and transcript parsing
67
+
68
+ If 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.
69
+
70
+ ## Installation
71
+
72
+ Requires Python 3.11+.
73
+
74
+ ```bash
75
+ pip install afteragent
76
+ ```
77
+
78
+ For development:
79
+
80
+ ```bash
81
+ git clone https://github.com/txmed82/afteragent.git
82
+ cd afteragent
83
+ pip install -e .
84
+ ```
85
+
86
+ ## Quick start
87
+
88
+ Capture a simple run:
89
+
90
+ ```bash
91
+ afteragent exec -- python3 -c "print('hello from afteragent')"
92
+ ```
93
+
94
+ List runs and inspect one:
95
+
96
+ ```bash
97
+ afteragent runs
98
+ afteragent show <run-id>
99
+ afteragent diagnose <run-id>
100
+ ```
101
+
102
+ Open the local viewer:
103
+
104
+ ```bash
105
+ afteragent ui
106
+ ```
107
+
108
+ By default, AfterAction stores everything in `.afteragent/` in the current repository.
109
+
110
+ ## Common use cases
111
+
112
+ ### 1. Capture a local agent run
113
+
114
+ Use this when you already know what command you want to run and you want the full trace.
115
+
116
+ ```bash
117
+ afteragent exec -- codex run "Fix the failing tests"
118
+ afteragent exec -- openclaw repair
119
+ afteragent exec -- python3 scripts/repair.py
120
+ ```
121
+
122
+ ### 2. Snapshot a live pull request before making changes
123
+
124
+ Use this when you want the failure surface first: changed files, review threads, checks, and CI evidence.
125
+
126
+ ```bash
127
+ afteragent validate-pr --repo vega/sphinxext-altair --pr 16
128
+ afteragent diagnose <run-id>
129
+ ```
130
+
131
+ ### 3. Export or apply interventions from a prior run
132
+
133
+ Use this when a failed run surfaced useful guidance you want to preserve.
134
+
135
+ ```bash
136
+ afteragent export-interventions <run-id>
137
+ afteragent apply-interventions <run-id>
138
+ ```
139
+
140
+ Typical outputs include:
141
+
142
+ - a task prompt export
143
+ - runner policy context
144
+ - replay context JSON
145
+ - repo instruction patches
146
+
147
+ ### 4. Replay a run with better context
148
+
149
+ Use this when you want to retry from a known failure with interventions already loaded.
150
+
151
+ ```bash
152
+ afteragent replay <run-id> -- python3 -c "import os; print(os.environ['AFTERACTION_SOURCE_RUN'])"
153
+ afteragent replay --runner claude-code <run-id> -- claude "Fix the failing PR"
154
+ afteragent replay --runner codex <run-id> -- codex run "Address review comments"
155
+ ```
156
+
157
+ ### 5. Run the full repair loop in one command
158
+
159
+ Use this when you want to validate a PR, apply interventions, and launch the next attempt in one step.
160
+
161
+ ```bash
162
+ afteragent attempt-repair --repo vega/sphinxext-altair --pr 16 -- python3 -c "print('repair')"
163
+ afteragent attempt-repair --run-id <run-id> --runner openclaw -- openclaw repair
164
+ ```
165
+
166
+ ## Typical workflow
167
+
168
+ For a live pull request:
169
+
170
+ ```bash
171
+ afteragent validate-pr --repo owner/name --pr 123
172
+ afteragent diagnose <validation-run-id>
173
+ afteragent apply-interventions <validation-run-id>
174
+ afteragent replay --runner claude-code <validation-run-id> -- claude "Fix the PR"
175
+ afteragent ui
176
+ ```
177
+
178
+ For an existing failed local run:
179
+
180
+ ```bash
181
+ afteragent diagnose <run-id>
182
+ afteragent export-interventions <run-id>
183
+ afteragent replay <run-id> -- python3 scripts/repair.py
184
+ ```
185
+
186
+ ## What the replay score means
187
+
188
+ AfterAction compares a replay against its source run and records whether things improved or got worse.
189
+
190
+ The score takes into account signals such as:
191
+
192
+ - run status and exit code
193
+ - number of findings
194
+ - failing check count
195
+ - failure-file count
196
+ - unresolved review-thread surface
197
+ - overlap between edits and the known failure surface
198
+
199
+ That makes it easier to answer a simple question: did the intervention actually help?
200
+
201
+ ## Files you will see
202
+
203
+ Inside `.afteragent/` you will typically find:
204
+
205
+ - `afteragent.sqlite3`: run metadata and event history
206
+ - `artifacts/`: stdout, stderr, git diffs, GitHub context, and CI logs
207
+ - `exports/`: exported intervention sets
208
+ - `applied/`: applied instruction patches and manifests
209
+ - `replays/`: replay input bundles and manifests
210
+
211
+ You may also see repo instruction files updated in the project root, depending on the runner and what already exists:
212
+
213
+ - `AGENTS.md`
214
+ - `CLAUDE.md`
215
+ - `GEMINI.md`
216
+ - `CURSOR.md`
217
+ - `COPILOT.md`
218
+
219
+ ## End-to-end test matrix
220
+
221
+ The repository includes an end-to-end matrix that exercises the subprocess path and runner adapters.
222
+
223
+ ```bash
224
+ ./scripts/e2e_matrix.sh
225
+ ```
226
+
227
+ That script runs:
228
+
229
+ - the full unit and integration suite
230
+ - the fixture-backed end-to-end tests for shell, OpenClaw, Claude Code, and Codex flows
231
+
232
+ ## Current shape
233
+
234
+ AfterAction is currently local-first:
235
+
236
+ - local SQLite storage
237
+ - filesystem artifacts
238
+ - GitHub context pulled through `gh`
239
+ - small built-in UI served from the CLI
240
+
241
+ That keeps the loop inspectable and easy to run in a normal repository without extra infrastructure.
@@ -0,0 +1,218 @@
1
+ # AfterAction
2
+
3
+ AfterAction helps you understand why an agent run went wrong, what it missed, and what to change before the next attempt.
4
+
5
+ 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.
6
+
7
+ ## Why this exists
8
+
9
+ Agent-assisted PR repair often fails in familiar ways:
10
+
11
+ - the agent keeps fixing the wrong files
12
+ - failing CI checks never make it into the plan
13
+ - review comments stay unresolved across attempts
14
+ - the next run starts without the lessons from the last one
15
+
16
+ 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.
17
+
18
+ ## Who it's for
19
+
20
+ - engineers using coding agents to fix pull requests
21
+ - teams experimenting with Claude Code, Codex, OpenClaw, or plain CLI runners
22
+ - people who want a local audit trail for agent behavior
23
+ - anyone trying to turn trial-and-error repair loops into a more disciplined workflow
24
+
25
+ ## What it does
26
+
27
+ - captures command runs, output, exit codes, diffs, events, and artifacts
28
+ - ingests GitHub PR context including changed files, review threads, checks, workflow runs, and CI log excerpts
29
+ - diagnoses patterns like repeated failures, low overlap with failing files, ignored review comments, and broad edit drift
30
+ - exports interventions as task prompts, runner context, replay context, and repo instruction patches
31
+ - applies repo instruction updates to files like `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `CURSOR.md`, and `COPILOT.md`
32
+ - replays a prior run with intervention context injected into the environment
33
+ - scores replay outcomes so you can tell whether the next attempt improved or regressed
34
+ - serves a local UI for runs, findings, interventions, and replay comparisons
35
+
36
+ ## Runner support
37
+
38
+ AfterAction is runner-agnostic by default.
39
+
40
+ - `shell`: fallback mode for any CLI command
41
+ - `openclaw`: OpenClaw-specific targeting and transcript parsing
42
+ - `claude-code`: Claude Code instruction targeting and transcript parsing
43
+ - `codex`: Codex instruction targeting and transcript parsing
44
+
45
+ If 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.
46
+
47
+ ## Installation
48
+
49
+ Requires Python 3.11+.
50
+
51
+ ```bash
52
+ pip install afteragent
53
+ ```
54
+
55
+ For development:
56
+
57
+ ```bash
58
+ git clone https://github.com/txmed82/afteragent.git
59
+ cd afteragent
60
+ pip install -e .
61
+ ```
62
+
63
+ ## Quick start
64
+
65
+ Capture a simple run:
66
+
67
+ ```bash
68
+ afteragent exec -- python3 -c "print('hello from afteragent')"
69
+ ```
70
+
71
+ List runs and inspect one:
72
+
73
+ ```bash
74
+ afteragent runs
75
+ afteragent show <run-id>
76
+ afteragent diagnose <run-id>
77
+ ```
78
+
79
+ Open the local viewer:
80
+
81
+ ```bash
82
+ afteragent ui
83
+ ```
84
+
85
+ By default, AfterAction stores everything in `.afteragent/` in the current repository.
86
+
87
+ ## Common use cases
88
+
89
+ ### 1. Capture a local agent run
90
+
91
+ Use this when you already know what command you want to run and you want the full trace.
92
+
93
+ ```bash
94
+ afteragent exec -- codex run "Fix the failing tests"
95
+ afteragent exec -- openclaw repair
96
+ afteragent exec -- python3 scripts/repair.py
97
+ ```
98
+
99
+ ### 2. Snapshot a live pull request before making changes
100
+
101
+ Use this when you want the failure surface first: changed files, review threads, checks, and CI evidence.
102
+
103
+ ```bash
104
+ afteragent validate-pr --repo vega/sphinxext-altair --pr 16
105
+ afteragent diagnose <run-id>
106
+ ```
107
+
108
+ ### 3. Export or apply interventions from a prior run
109
+
110
+ Use this when a failed run surfaced useful guidance you want to preserve.
111
+
112
+ ```bash
113
+ afteragent export-interventions <run-id>
114
+ afteragent apply-interventions <run-id>
115
+ ```
116
+
117
+ Typical outputs include:
118
+
119
+ - a task prompt export
120
+ - runner policy context
121
+ - replay context JSON
122
+ - repo instruction patches
123
+
124
+ ### 4. Replay a run with better context
125
+
126
+ Use this when you want to retry from a known failure with interventions already loaded.
127
+
128
+ ```bash
129
+ afteragent replay <run-id> -- python3 -c "import os; print(os.environ['AFTERACTION_SOURCE_RUN'])"
130
+ afteragent replay --runner claude-code <run-id> -- claude "Fix the failing PR"
131
+ afteragent replay --runner codex <run-id> -- codex run "Address review comments"
132
+ ```
133
+
134
+ ### 5. Run the full repair loop in one command
135
+
136
+ Use this when you want to validate a PR, apply interventions, and launch the next attempt in one step.
137
+
138
+ ```bash
139
+ afteragent attempt-repair --repo vega/sphinxext-altair --pr 16 -- python3 -c "print('repair')"
140
+ afteragent attempt-repair --run-id <run-id> --runner openclaw -- openclaw repair
141
+ ```
142
+
143
+ ## Typical workflow
144
+
145
+ For a live pull request:
146
+
147
+ ```bash
148
+ afteragent validate-pr --repo owner/name --pr 123
149
+ afteragent diagnose <validation-run-id>
150
+ afteragent apply-interventions <validation-run-id>
151
+ afteragent replay --runner claude-code <validation-run-id> -- claude "Fix the PR"
152
+ afteragent ui
153
+ ```
154
+
155
+ For an existing failed local run:
156
+
157
+ ```bash
158
+ afteragent diagnose <run-id>
159
+ afteragent export-interventions <run-id>
160
+ afteragent replay <run-id> -- python3 scripts/repair.py
161
+ ```
162
+
163
+ ## What the replay score means
164
+
165
+ AfterAction compares a replay against its source run and records whether things improved or got worse.
166
+
167
+ The score takes into account signals such as:
168
+
169
+ - run status and exit code
170
+ - number of findings
171
+ - failing check count
172
+ - failure-file count
173
+ - unresolved review-thread surface
174
+ - overlap between edits and the known failure surface
175
+
176
+ That makes it easier to answer a simple question: did the intervention actually help?
177
+
178
+ ## Files you will see
179
+
180
+ Inside `.afteragent/` you will typically find:
181
+
182
+ - `afteragent.sqlite3`: run metadata and event history
183
+ - `artifacts/`: stdout, stderr, git diffs, GitHub context, and CI logs
184
+ - `exports/`: exported intervention sets
185
+ - `applied/`: applied instruction patches and manifests
186
+ - `replays/`: replay input bundles and manifests
187
+
188
+ You may also see repo instruction files updated in the project root, depending on the runner and what already exists:
189
+
190
+ - `AGENTS.md`
191
+ - `CLAUDE.md`
192
+ - `GEMINI.md`
193
+ - `CURSOR.md`
194
+ - `COPILOT.md`
195
+
196
+ ## End-to-end test matrix
197
+
198
+ The repository includes an end-to-end matrix that exercises the subprocess path and runner adapters.
199
+
200
+ ```bash
201
+ ./scripts/e2e_matrix.sh
202
+ ```
203
+
204
+ That script runs:
205
+
206
+ - the full unit and integration suite
207
+ - the fixture-backed end-to-end tests for shell, OpenClaw, Claude Code, and Codex flows
208
+
209
+ ## Current shape
210
+
211
+ AfterAction is currently local-first:
212
+
213
+ - local SQLite storage
214
+ - filesystem artifacts
215
+ - GitHub context pulled through `gh`
216
+ - small built-in UI served from the CLI
217
+
218
+ That keeps the loop inspectable and easy to run in a normal repository without extra infrastructure.
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "afteragent"
7
+ version = "0.1.0"
8
+ description = "Capture agent runs, diagnose failure patterns, and generate workflow interventions."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ authors = [
13
+ {name = "Colin", email = "colinson@gmail.com"},
14
+ ]
15
+ keywords = ["agent", "debugging", "ci", "workflow", "diagnostics", "llm"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Software Development :: Testing",
24
+ "Topic :: Software Development :: Quality Assurance",
25
+ ]
26
+ dependencies = []
27
+
28
+ [project.scripts]
29
+ afteragent = "afteragent.cli:main"
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/txmed82/afteragent"
33
+ Repository = "https://github.com/txmed82/afteragent"
34
+ Issues = "https://github.com/txmed82/afteragent/issues"
35
+
36
+ [tool.setuptools]
37
+ package-dir = {"" = "src"}
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ """AfterAgent package."""