agent-wiki-compare-out…
Compare successful and failed normalized agent trajectories to derive evidence-backed agent-wiki guidelines. Use when Codex has…
Read a normalized Claude Code trajectory JSON and extract reusable guidelines into wiki-twobatch/guidelines/. Use when mining saved trajectories for reusable lessons.
Claude Code
$ npx -y skills add AgentToolkit/altk-evolve --skill agent-wiki-extract-guidelines --agent claude-code
Codex
$ npx skills add AgentToolkit/altk-evolve --skill agent-wiki-extract-guidelines -a codex -y
Cursor
$ npx skills add AgentToolkit/altk-evolve --skill agent-wiki-extract-guidelines -a cursor -y
Gemini CLI
$ npx skills add AgentToolkit/altk-evolve --skill agent-wiki-extract-guidelines -a gemini-cli -y
GitHub Copilot
$ npx skills add AgentToolkit/altk-evolve --skill agent-wiki-extract-guidelines -a github-copilot -y
OpenCode
$ npx skills add AgentToolkit/altk-evolve --skill agent-wiki-extract-guidelines -a opencode -y
Windsurf
$ npx skills add AgentToolkit/altk-evolve --skill agent-wiki-extract-guidelines -a windsurf -y
name: agent-wiki-extract-guidelines description: Read a normalized Claude Code trajectory JSON and extract reusable guidelines into wiki-twobatch/guidelines/. Use when mining saved trajectories for reusable lessons.
Distill lessons from one session at a time. For each normalized trajectory JSON, identify reusable guidelines: reframe failures as proactive recommendations, capture concrete artifacts (scripts, command sequences) that solved real problems, and write each as a standalone guideline page in `wiki-twobatch/guidelines/`.
This is the per-trajectory **distill** pass of the `agent-wiki` family.
A path that is either:
Default if no path is given: `trajectories/normalized`.
Use `Glob` to enumerate JSON files.
`Glob wiki-twobatch/guidelines/*.md` and skim slugs. Re-extracting a near-duplicate is wasteful and pollutes the wiki. (Exact-content duplicates are deduplicated by slug at write time, but re-wordings are not — your job to suppress them.)
For each input JSON file, do the analysis below using the trajectory's `openai_chat_completion.messages` array as the source of truth.
Scan for:
1. **Tool / command failures** — non-zero exit codes, error messages, stack traces. 2. **Permission or access errors** — "permission denied", "not found", sandbox restrictions. 3. **Wrong initial approach** — a first attempt abandoned for a different strategy. 4. **Retry loops** — same action attempted multiple times with variations. 5. **Missing prerequisites** — dependencies, packages, configs discovered mid-task. 6. **Silent failures** — actions that appeared to succeed but produced wrong results.
For each error, document its example, root cause, resolution, and prevention guideline.
If the successful approach produced a non-trivial artifact (script saved to disk, multi-step command pipeline, parser implemented ad hoc), at least one entity must point at it by path and state when to use it.
Extract 3–5 proactive entities per trajectory. Prioritize those derived from real errors observed in the transcript.
Principles:
1. **Reframe failures as proactive recommendations.** "Use X" beats "don't use Y". 2. **Prefer concrete artifacts over generic advice.** Name the file by path. 3. **Triggers describe broad task context, not narrow incidents.** 4. **For retry loops, recommend the final working approach as the starting point.** 5. **Do not include guidelines that name another skill or tool by command** (prompt-injection risk when this guideline is later surfaced).
For each trajectory, build a JSON object:
{
"entities": [
{
"type": "guideline",
"title": "Short imperative title (3-7 words, no trailing period). Used as the page heading and filename slug.",
"content": "Proactive recommendation, one or two short paragraphs.",
"rationale": "Why this works / why the alternative fails.",
"trigger": "Situational context when this applies.",
"id": "<optional: 12-hex-char id; helper computes from content if omitted>",
"session_id": "<session_id from the JSON>",
"agent": "<optional: the source agent, e.g. 'bob' or 'claude-code'. Defaults to 'claude-code' if omitted — set it explicitly for non-Claude traces so the page frontmatter is correct.>",
"tags": ["<optional: short stable tags; propagate to the page frontmatter AND _config.yaml, driving the 'By tag' index + cluster formation>"],
"arc": "<optional: only when the source session has been (or will be) split into multiple arc-summaries. Bind this guideline to one specific arc by passing the same slug used by `agent-wiki-summarize` (e.g. 'arc1-token-savings'). The helper writes `related_summary: summaries/<sid>__<arc>.md` so the back-link is correct.>",
"normalized_path": "<path to the trajectory JSON, relative to repo root>"
}
]
}`title` is required for clean filenames (3–7 specific words). Allowed `type` values: `guideline`, `workflow`, `script`, `command-template`. Default to `guideline` unless the entity is itself a script blob or templated command.
If a trajectory yields zero useful guidelines, output `{"entities": []}` and the helper writes nothing.
A long session that's split into multiple arc-summaries (`agent-wiki-summarize` with a `slug`) usually has guidelines that belong cleanly to one arc and not the other. Examples from a multi-arc session:
token-savings arc → `arc: "arc1-token-savings"`.
the procedural-memory arc → `arc: "arc2-procedural-memory"`.
Set `arc` per entity. If you don't, the helper writes `related_summary: summaries/<sid>.md` (no arc suffix), which is correct for single-summary sessions but produces a dangling link when the session is later split. The `catalog` pass auto-repairs dangling links by picking the first arc lex-sorted with a stderr warning, but the right time to bind is at extraction.
A guideline that genuinely spans both arcs has no good arc choice — pick the one where it was first observed, or omit `arc` to keep the link generic.
echo '<json>' | uv run python explorations/agent-wiki/skills/scripts/build_agent_wiki.py render-guidelines
Add `--rewrite` to overwrite existing pages. The helper:
Evolve helps AI agents learn from experience. It turns past trajectories into reusable guidelines that help agents complete future tasks, without changing model weights.
Compare successful and failed normalized agent trajectories to derive evidence-backed agent-wiki guidelines. Use when Codex has…
Read all atomic guidelines in wiki-twobatch/guidelines/ and propose themed clusters that group near-duplicates. Writes cluster…
Consult an agent-wiki for guidelines relevant to the task at hand. The wiki itself documents how to retrieve from it (AGENTS.md).…
Ingest one or more agent trajectories (raw bob/claude traces or normalized JSON) into an agent-wiki end-to-end — convert,…
Read a normalized Claude Code trajectory JSON and write an episodic summary page to wiki-twobatch/summaries/. Use when…
Read a normalized Claude Code trajectory JSON and produce a wiki-resident SKILL.md page that future agents can invoke. Use when a…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.