trace-to-skill 0.1.26

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.
Files changed (68) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +456 -0
  3. package/dist/src/agentsLint.d.ts +15 -0
  4. package/dist/src/agentsLint.js +156 -0
  5. package/dist/src/agentsLint.js.map +1 -0
  6. package/dist/src/analyze.d.ts +3 -0
  7. package/dist/src/analyze.js +53 -0
  8. package/dist/src/analyze.js.map +1 -0
  9. package/dist/src/benchmark.d.ts +27 -0
  10. package/dist/src/benchmark.js +109 -0
  11. package/dist/src/benchmark.js.map +1 -0
  12. package/dist/src/cli.d.ts +2 -0
  13. package/dist/src/cli.js +281 -0
  14. package/dist/src/cli.js.map +1 -0
  15. package/dist/src/doctor.d.ts +18 -0
  16. package/dist/src/doctor.js +300 -0
  17. package/dist/src/doctor.js.map +1 -0
  18. package/dist/src/eval.d.ts +19 -0
  19. package/dist/src/eval.js +48 -0
  20. package/dist/src/eval.js.map +1 -0
  21. package/dist/src/github.d.ts +11 -0
  22. package/dist/src/github.js +66 -0
  23. package/dist/src/github.js.map +1 -0
  24. package/dist/src/githubContext.d.ts +6 -0
  25. package/dist/src/githubContext.js +60 -0
  26. package/dist/src/githubContext.js.map +1 -0
  27. package/dist/src/index.d.ts +11 -0
  28. package/dist/src/index.js +11 -0
  29. package/dist/src/index.js.map +1 -0
  30. package/dist/src/init.d.ts +16 -0
  31. package/dist/src/init.js +186 -0
  32. package/dist/src/init.js.map +1 -0
  33. package/dist/src/parsers.d.ts +2 -0
  34. package/dist/src/parsers.js +138 -0
  35. package/dist/src/parsers.js.map +1 -0
  36. package/dist/src/report.d.ts +11 -0
  37. package/dist/src/report.js +273 -0
  38. package/dist/src/report.js.map +1 -0
  39. package/dist/src/rules.d.ts +2 -0
  40. package/dist/src/rules.js +400 -0
  41. package/dist/src/rules.js.map +1 -0
  42. package/dist/src/scorecard.d.ts +25 -0
  43. package/dist/src/scorecard.js +75 -0
  44. package/dist/src/scorecard.js.map +1 -0
  45. package/dist/src/types.d.ts +31 -0
  46. package/dist/src/types.js +2 -0
  47. package/dist/src/types.js.map +1 -0
  48. package/docs/ADOPTION_GUIDE.md +97 -0
  49. package/docs/AGENTS_LINT.md +30 -0
  50. package/docs/BENCHMARK.md +21 -0
  51. package/docs/FAILURE_TAXONOMY.md +57 -0
  52. package/docs/SCORECARD.md +51 -0
  53. package/examples/codex-failed-run.md +17 -0
  54. package/fixtures/codex-session.jsonl +4 -0
  55. package/fixtures/failed-run.md +28 -0
  56. package/fixtures/github-pr-event.json +6 -0
  57. package/fixtures/github-prompt-injection-event.json +9 -0
  58. package/fixtures/instruction-drift/AGENTS.md +5 -0
  59. package/fixtures/instruction-drift/CLAUDE.md +6 -0
  60. package/fixtures/mcp-risk.json +22 -0
  61. package/fixtures/prompt-injection.md +7 -0
  62. package/fixtures/safe-run.md +12 -0
  63. package/package.json +55 -0
  64. package/schemas/agents-lint-result.schema.json +67 -0
  65. package/schemas/analysis-result.schema.json +134 -0
  66. package/schemas/doctor-result.schema.json +81 -0
  67. package/schemas/scorecard-result.schema.json +102 -0
  68. package/skills/codex-readiness-auditor/SKILL.md +61 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Ogün
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,456 @@
1
+ # trace-to-skill
2
+
3
+ [![CI](https://github.com/grnbtqdbyx-create/trace-to-skill/actions/workflows/ci.yml/badge.svg)](https://github.com/grnbtqdbyx-create/trace-to-skill/actions/workflows/ci.yml)
4
+ [![Codex Readiness](https://github.com/grnbtqdbyx-create/trace-to-skill/actions/workflows/codex-readiness.yml/badge.svg)](https://github.com/grnbtqdbyx-create/trace-to-skill/actions/workflows/codex-readiness.yml)
5
+ [![Release](https://img.shields.io/github/v/release/grnbtqdbyx-create/trace-to-skill)](https://github.com/grnbtqdbyx-create/trace-to-skill/releases)
6
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
7
+ [![Node](https://img.shields.io/badge/node-%3E%3D20-339933.svg)](package.json)
8
+
9
+ Turn failed AI coding-agent runs into reusable `AGENTS.md` rules, `SKILL.md` files, and eval evidence.
10
+
11
+ ```bash
12
+ npx github:grnbtqdbyx-create/trace-to-skill doctor .
13
+ npx github:grnbtqdbyx-create/trace-to-skill lint-agents .
14
+ npx github:grnbtqdbyx-create/trace-to-skill analyze ./runs
15
+ npx github:grnbtqdbyx-create/trace-to-skill init --comment --sarif
16
+ npx github:grnbtqdbyx-create/trace-to-skill suggest ./runs --target agents-md
17
+ npx github:grnbtqdbyx-create/trace-to-skill eval ./runs --threshold 80
18
+ npx github:grnbtqdbyx-create/trace-to-skill benchmark
19
+ npx github:grnbtqdbyx-create/trace-to-skill scorecard .
20
+ npx github:grnbtqdbyx-create/trace-to-skill scorecard-comment . --dry-run
21
+ npx github:grnbtqdbyx-create/trace-to-skill guard-github-event "$GITHUB_EVENT_PATH"
22
+ npx github:grnbtqdbyx-create/trace-to-skill comment ./runs --dry-run
23
+ npx github:grnbtqdbyx-create/trace-to-skill compare --before ./runs/before --after ./runs/after
24
+ ```
25
+
26
+ AI coding agents are getting good enough to change real repositories, but they still repeat the same workflow mistakes: claiming success without tests, ignoring repo instructions, over-editing, inventing files, leaking secrets into traces, or enabling risky MCP tools.
27
+
28
+ `trace-to-skill` closes that loop:
29
+
30
+ ```text
31
+ failed agent run -> failure class -> reusable rule/skill -> eval gate -> keep or revise
32
+ ```
33
+
34
+ It is built for maintainers using Codex, Claude Code, Cursor, Copilot coding agent, Gemini CLI, OpenCode, or MCP-enabled workflows.
35
+
36
+ ## Why This Exists
37
+
38
+ Open-source maintainers do not need more AI-generated noise. They need agents that learn from concrete failures and produce reviewable evidence.
39
+
40
+ `trace-to-skill` helps teams answer:
41
+
42
+ - Is this repository ready for Codex-driven OSS maintenance?
43
+ - Why did this Codex or Claude run fail?
44
+ - Was the failure caused by missing repo instructions?
45
+ - Should this become an `AGENTS.md` rule?
46
+ - Should this become a reusable `SKILL.md` workflow?
47
+ - Did the proposed rule actually improve the next run?
48
+ - Can this be reported in a PR without leaking secrets?
49
+
50
+ ## Example Output
51
+
52
+ ```text
53
+ Agent workflow failed: score 25/100, critical findings 1.
54
+ ```
55
+
56
+ Markdown report:
57
+
58
+ ```md
59
+ # Agent Learning Report
60
+
61
+ Score: 25/100
62
+
63
+ ## Findings
64
+
65
+ ### Agent claimed completion without verifiable proof
66
+ Severity: high
67
+ Evidence:
68
+ - fixtures/failed-run.md:7 Done. The parser is fixed and all set.
69
+
70
+ Suggested rule:
71
+ > Before claiming completion, run the relevant validation command or clearly state the exact validation that could not be run and why.
72
+ ```
73
+
74
+ Generated `AGENTS.md` snippet:
75
+
76
+ ```md
77
+ # Agent Rules Generated From Failed Runs
78
+
79
+ - Every code-changing task must end with a named validation command and its result, even when the command fails.
80
+ - Before editing or referencing a path, verify it exists with a file search command such as rg --files.
81
+ ```
82
+
83
+ ## What It Detects
84
+
85
+ `doctor` checks repo-level readiness:
86
+
87
+ | Check | Why maintainers care |
88
+ | --- | --- |
89
+ | `AGENTS.md` | Codex needs clear repository instructions |
90
+ | CI workflow | Agent changes need visible validation |
91
+ | Validation scripts | Completion claims need repeatable proof |
92
+ | License | OSS adoption and review need clear terms |
93
+ | Maintainer docs | Contributors and agent PRs need process |
94
+ | Distribution | Users should be able to try the project in one command |
95
+ | Agent learning loop | Failed runs should become evidence, not folklore |
96
+
97
+ Trace analysis detects run-level failures:
98
+
99
+ | Finding | Why maintainers care |
100
+ | --- | --- |
101
+ | Premature completion | Agent says "done" without proof |
102
+ | Tests not run | Review load moves back to maintainers |
103
+ | Test/build failure | Completion should be blocked |
104
+ | Hallucinated file | Agent invented a path or module |
105
+ | Instruction drift | `AGENTS.md`, `CLAUDE.md`, and tool-specific files conflict |
106
+ | Over-editing | Diff is broader than the task needs |
107
+ | Unsafe command | Destructive shell or remote script execution |
108
+ | Secret exposure | Tokens/API keys in traces or PR comments |
109
+ | Hidden Unicode | Invisible instruction or code-review manipulation |
110
+ | Prompt injection | Untrusted issue, PR, log, or web text asks the agent to ignore policy or leak secrets |
111
+ | MCP risk | Tool permissions and trust boundaries are unclear |
112
+
113
+ ## Installation
114
+
115
+ The GitHub release is available now:
116
+
117
+ ```bash
118
+ npx github:grnbtqdbyx-create/trace-to-skill analyze ./runs
119
+ ```
120
+
121
+ After npm publication:
122
+
123
+ ```bash
124
+ npm install -D trace-to-skill
125
+ ```
126
+
127
+ or:
128
+
129
+ ```bash
130
+ npx trace-to-skill analyze ./runs
131
+ ```
132
+
133
+ Requires Node.js 20+.
134
+
135
+ ## CLI
136
+
137
+ Check whether a repository is ready for Codex automation:
138
+
139
+ ```bash
140
+ trace-to-skill doctor .
141
+ trace-to-skill doctor . --threshold 85
142
+ trace-to-skill doctor . --format json
143
+ trace-to-skill doctor . --format comment
144
+ ```
145
+
146
+ Lint `AGENTS.md`, tool-specific agent instruction files, and MCP config risk:
147
+
148
+ ```bash
149
+ trace-to-skill lint-agents .
150
+ trace-to-skill lint-agents . --format json
151
+ ```
152
+
153
+ This focused linter checks whether `AGENTS.md` exists as the canonical instruction source, whether validation commands are discoverable, whether `AGENTS.md` / `CLAUDE.md` / Cursor / Copilot guidance conflicts, and whether MCP configs expose risky capabilities or secrets.
154
+
155
+ Scaffold a repo:
156
+
157
+ ```bash
158
+ trace-to-skill init --comment --sarif
159
+ ```
160
+
161
+ `init` writes `.github/workflows/codex-readiness.yml`, `.github/workflows/agent-learning.yml`, `runs/README.md`, and `runs/.gitkeep`. The generated workflows use the published GitHub Action, expose score/report outputs, and will not overwrite existing files unless `--force` is passed.
162
+
163
+ Analyze traces:
164
+
165
+ ```bash
166
+ trace-to-skill analyze ./runs --format markdown --output agent-learning-report.md
167
+ trace-to-skill analyze ./runs --format json
168
+ trace-to-skill analyze ./runs --format sarif --output trace-to-skill.sarif
169
+ ```
170
+
171
+ Generate reusable rules:
172
+
173
+ ```bash
174
+ trace-to-skill suggest ./runs --target agents-md --output AGENTS.generated.md
175
+ trace-to-skill suggest ./runs --target skill --output skills/verification-before-completion/SKILL.md
176
+ ```
177
+
178
+ Use as an eval gate:
179
+
180
+ ```bash
181
+ trace-to-skill eval ./runs --threshold 80
182
+ ```
183
+
184
+ The eval command exits non-zero when the score is below the threshold or critical findings exist.
185
+
186
+ Run the built-in fixture benchmark:
187
+
188
+ ```bash
189
+ trace-to-skill benchmark
190
+ trace-to-skill benchmark --format json
191
+ ```
192
+
193
+ See the current public scorecard in [docs/BENCHMARK.md](docs/BENCHMARK.md).
194
+
195
+ Generate a combined Codex readiness and benchmark scorecard:
196
+
197
+ ```bash
198
+ trace-to-skill scorecard .
199
+ trace-to-skill scorecard . --format json
200
+ ```
201
+
202
+ See this repository's current public scorecard in [docs/SCORECARD.md](docs/SCORECARD.md).
203
+
204
+ Post or update a pull request comment with the combined scorecard:
205
+
206
+ ```bash
207
+ trace-to-skill scorecard-comment . --threshold 85 --token "$GITHUB_TOKEN"
208
+ ```
209
+
210
+ Guard untrusted GitHub event text before an agent acts on it:
211
+
212
+ ```bash
213
+ trace-to-skill guard-github-event "$GITHUB_EVENT_PATH"
214
+ trace-to-skill guard-github-event fixtures/github-prompt-injection-event.json --format json
215
+ ```
216
+
217
+ This extracts PR titles/bodies, issue bodies, review comments, discussion text, check-run output, and commit messages from a GitHub event payload, then scans that text for prompt injection, leaked secrets, unsafe command requests, and weak evidence patterns.
218
+
219
+ Post or update a GitHub pull request comment:
220
+
221
+ ```bash
222
+ trace-to-skill comment ./runs --token "$GITHUB_TOKEN"
223
+ ```
224
+
225
+ Post or update a GitHub pull request comment with the Codex readiness doctor:
226
+
227
+ ```bash
228
+ trace-to-skill doctor-comment . --threshold 85 --token "$GITHUB_TOKEN"
229
+ ```
230
+
231
+ Compare an agent run before and after a generated rule or skill:
232
+
233
+ ```bash
234
+ trace-to-skill compare --before ./runs/before --after ./runs/after
235
+ ```
236
+
237
+ ## Supported Inputs
238
+
239
+ `trace-to-skill` scans directories or individual files:
240
+
241
+ - `.md`
242
+ - `.txt`
243
+ - `.log`
244
+ - `.json`
245
+ - `.jsonl`
246
+
247
+ JSONL traces are normalized by extracting common fields such as `message`, `content`, `text`, `output`, and `error`. Codex-style JSONL traces with `response_item`, `function_call`, `function_call_output`, and `event_msg` payloads are normalized into readable evidence lines.
248
+
249
+ MCP configs with `mcpServers` are parsed for capability hints such as filesystem, shell, browser, network, database, container, and secret-bearing environment variables.
250
+
251
+ Instruction files such as `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.cursor/rules`, and `.github/copilot-instructions.md` are checked for obvious contradictions in validation commands, test requirements, and destructive-command approval rules.
252
+
253
+ ## JSON Schemas
254
+
255
+ Stable machine-readable contracts are published with the npm package and release tarball:
256
+
257
+ - [`schemas/analysis-result.schema.json`](schemas/analysis-result.schema.json) describes `trace-to-skill analyze --format json`.
258
+ - [`schemas/agents-lint-result.schema.json`](schemas/agents-lint-result.schema.json) describes `trace-to-skill lint-agents --format json`.
259
+ - [`schemas/doctor-result.schema.json`](schemas/doctor-result.schema.json) describes `trace-to-skill doctor --format json`.
260
+ - [`schemas/scorecard-result.schema.json`](schemas/scorecard-result.schema.json) describes `trace-to-skill scorecard --format json`.
261
+
262
+ These schemas let downstream Codex workflows, dashboards, and CI bots consume reports without scraping Markdown.
263
+
264
+ ## Adoption Guide
265
+
266
+ For a copy-paste maintainer rollout, see [docs/ADOPTION_GUIDE.md](docs/ADOPTION_GUIDE.md). It includes the first PR shape, privacy checklist, and a short pull request template for adding Codex readiness checks without handing policy changes to an agent.
267
+
268
+ ## GitHub Action
269
+
270
+ Run the Codex readiness doctor as a GitHub Action:
271
+
272
+ ```yaml
273
+ name: Codex Readiness
274
+
275
+ on:
276
+ pull_request:
277
+ workflow_dispatch:
278
+
279
+ jobs:
280
+ codex-readiness:
281
+ runs-on: ubuntu-latest
282
+ permissions:
283
+ contents: read
284
+ pull-requests: write
285
+ issues: write
286
+ steps:
287
+ - uses: actions/checkout@v5
288
+ - uses: grnbtqdbyx-create/trace-to-skill@v0.1.26
289
+ with:
290
+ mode: all
291
+ doctor-threshold: "85"
292
+ doctor-comment: "true"
293
+ scorecard-comment: "true"
294
+ job-summary: "true"
295
+ github-token: ${{ github.token }}
296
+ ```
297
+
298
+ Add this to `.github/workflows/agent-learning.yml` for trace analysis:
299
+
300
+ ```yaml
301
+ name: Agent Learning Report
302
+
303
+ on:
304
+ pull_request:
305
+ workflow_dispatch:
306
+
307
+ jobs:
308
+ agent-learning:
309
+ runs-on: ubuntu-latest
310
+ permissions:
311
+ contents: read
312
+ pull-requests: write
313
+ issues: write
314
+ steps:
315
+ - uses: actions/checkout@v5
316
+ - uses: actions/setup-node@v5
317
+ with:
318
+ node-version: 20
319
+ - run: npx github:grnbtqdbyx-create/trace-to-skill analyze ./runs --output agent-learning-report.md
320
+ - run: npx github:grnbtqdbyx-create/trace-to-skill comment ./runs --token "${{ github.token }}"
321
+ - run: npx github:grnbtqdbyx-create/trace-to-skill eval ./runs --threshold 80
322
+ ```
323
+
324
+ Code scanning / SARIF upload:
325
+
326
+ ```yaml
327
+ - run: npx github:grnbtqdbyx-create/trace-to-skill analyze ./runs --format sarif --output trace-to-skill.sarif
328
+ - uses: github/codeql-action/upload-sarif@v4
329
+ with:
330
+ sarif_file: trace-to-skill.sarif
331
+ ```
332
+
333
+ Composite action usage:
334
+
335
+ ```yaml
336
+ - id: trace-to-skill
337
+ uses: grnbtqdbyx-create/trace-to-skill@v0.1.26
338
+ with:
339
+ mode: all
340
+ doctor-threshold: "85"
341
+ doctor-comment: "true"
342
+ scorecard-comment: "true"
343
+ job-summary: "true"
344
+ traces: ./runs
345
+ threshold: "80"
346
+ comment: "true"
347
+ github-token: ${{ github.token }}
348
+ - run: echo "Codex readiness score is ${{ steps.trace-to-skill.outputs.doctor-score }}"
349
+ ```
350
+
351
+ Action outputs:
352
+
353
+ | Output | Description |
354
+ | --- | --- |
355
+ | `doctor-score` | Codex readiness score from 0 to 100 |
356
+ | `doctor-status` | `ready` or `needs-attention` |
357
+ | `doctor-summary` | Human-readable doctor summary |
358
+ | `doctor-report` | Markdown report path |
359
+ | `doctor-json` | JSON report path |
360
+ | `agent-report` | Agent learning report path |
361
+ | `agents-lint-score` | AGENTS.md linter score from 0 to 100 |
362
+ | `agents-lint-status` | `pass`, `warn`, or `fail` |
363
+ | `agents-lint-report` | Markdown AGENTS.md linter report path |
364
+ | `agents-lint-json` | JSON AGENTS.md linter report path |
365
+ | `context-score` | Untrusted GitHub event context score from 0 to 100 |
366
+ | `context-status` | `pass` or `fail` |
367
+ | `context-report` | Markdown GitHub context guard report path |
368
+ | `context-json` | JSON GitHub context guard report path |
369
+ | `benchmark-status` | Built-in fixture benchmark status, `pass` or `fail` |
370
+ | `benchmark-cases` | Number of benchmark cases executed |
371
+ | `benchmark-report` | Markdown benchmark report path |
372
+ | `benchmark-json` | JSON benchmark report path |
373
+ | `scorecard-status` | Combined scorecard status, `pass` or `fail` |
374
+ | `scorecard-report` | Markdown scorecard report path |
375
+ | `scorecard-json` | JSON scorecard report path |
376
+
377
+ By default, generated reports are also appended to the GitHub Actions Job Summary. Set `job-summary: "false"` to disable that UI output.
378
+
379
+ Tagged Action releases build and run the CLI from `$GITHUB_ACTION_PATH`, so a workflow pinned to `@v0.1.26` executes that release's checked-out source instead of pulling the default branch at runtime.
380
+
381
+ ## Codex Skill
382
+
383
+ This repository also ships a Codex-native skill for maintainers who want the agent itself to run a repeatable readiness audit:
384
+
385
+ ```bash
386
+ python3 ~/.codex/skills/.system/skill-installer/scripts/install-skill-from-github.py \
387
+ --repo grnbtqdbyx-create/trace-to-skill \
388
+ --path skills/codex-readiness-auditor \
389
+ --name codex-readiness-auditor
390
+ ```
391
+
392
+ The skill tells Codex to run the scorecard, treat issue/PR text as untrusted data, avoid committing generated policy without maintainer review, and report exact validation evidence.
393
+
394
+ ## OpenAI / Codex Use Case
395
+
396
+ This project is designed to support open-source maintainers who use Codex for:
397
+
398
+ - pull request review
399
+ - issue triage
400
+ - release workflow automation
401
+ - security review
402
+ - repository-specific agent skills
403
+ - maintainer handoff reports
404
+
405
+ The goal is not to let agents autonomously rewrite project policy. The goal is to turn repeated, evidence-backed agent failures into small, reviewable improvements that maintainers can accept or reject.
406
+
407
+ ## Roadmap
408
+
409
+ - Codex session JSONL adapters
410
+ - Claude Code transcript adapters
411
+ - `AGENTS.md` contradiction detector
412
+ - MCP config parser with explicit capability scoring
413
+ - GitHub PR comment mode
414
+ - before/after eval runner
415
+ - SARIF output for GitHub code scanning
416
+ - `trace-to-skill doctor` for Codex readiness scoring
417
+ - GitHub Action doctor mode with score threshold
418
+ - Doctor PR summary comments
419
+ - Marketplace-ready action branding and self-dogfooding workflow
420
+ - Composite Action outputs for downstream workflow steps
421
+ - Job Summary output for generated reports
422
+ - `trace-to-skill init` for Codex readiness and agent-learning workflow setup
423
+ - Published JSON schemas for deterministic CLI report contracts
424
+ - `trace-to-skill benchmark` for public fixture scorecards
425
+ - GitHub Action `benchmark` and `all` modes
426
+ - `trace-to-skill scorecard` for combined reviewer proof
427
+ - Scorecard JSON schema and Action outputs
428
+ - Tag-pinned GitHub Action runtime via `$GITHUB_ACTION_PATH`
429
+ - Scorecard PR comments with update-in-place marker
430
+ - public benchmark of common agent failure classes
431
+
432
+ See [docs/ROADMAP.md](docs/ROADMAP.md).
433
+
434
+ ## Design Principles
435
+
436
+ - Evidence first: every suggestion must point to trace lines.
437
+ - Maintainer control: generated rules are suggestions, not automatic policy changes.
438
+ - No secret leakage: reports redact common token patterns.
439
+ - Model agnostic: useful for Codex, Claude Code, Cursor, Copilot, Gemini CLI, and other coding agents.
440
+ - Small surface area: no runtime dependencies in the CLI.
441
+
442
+ ## Contributing
443
+
444
+ Contributions are welcome, especially:
445
+
446
+ - real-world anonymized failed agent traces
447
+ - new failure detectors
448
+ - adapters for Codex, Claude Code, Cursor, Copilot, and Gemini CLI
449
+ - eval fixtures proving a rule improves behavior
450
+ - docs for maintainer workflows
451
+
452
+ Read [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
453
+
454
+ ## License
455
+
456
+ Apache-2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,15 @@
1
+ import { type DoctorCheck } from "./doctor.js";
2
+ import type { Finding } from "./types.js";
3
+ export interface AgentsLintResult {
4
+ generatedAt: string;
5
+ root: string;
6
+ status: "pass" | "warn" | "fail";
7
+ score: number;
8
+ instructionFiles: string[];
9
+ mcpConfigs: string[];
10
+ checks: DoctorCheck[];
11
+ findings: Finding[];
12
+ summary: string;
13
+ }
14
+ export declare function lintAgents(target?: string): Promise<AgentsLintResult>;
15
+ export declare function renderAgentsLintMarkdown(result: AgentsLintResult): string;