Forge friction

From griffinwork40/agent-framework · View interactive version

Forge friction is an AI agent skill from the GitHub repository griffinwork40/agent-framework. Surface recurring friction from session telemetry, classify as operational vs shape-gap, and generate targeted skills for shape-gap themes only. Use when the user runs /forge-friction.

How to use this skill

Skill file

Run the friction analyzer to get a summary of recent friction patterns:

python3 "${PLUGIN_ROOT}/scripts/friction/analyzer.py"

If no friction sessions exist, tell the user there are no friction patterns in the lookback window.

If friction data exists, review the output. It contains friction categories ranked by confidence, then frequency, each with recent examples showing friction_detail (what went wrong) and goal (what the user was trying to do).

Tool-error categories carry a failure-class suffix. :timeout, :truncated, and :slow are high-confidence — real, specific friction a skill can address — and rank first. :plain is the low-confidence residue: a fast non-zero exit the trace cannot distinguish from a benign result (a grep no-match, a test that exits 1). It ranks last and should be treated with skepticism. :unclassified comes from agent-afk session facets, which count tool errors without a failure class; treat it exactly like :plain. Facets also supply each example's goal, joined to witness traces through the session ledger's traceLabel.

Dry-run mode

If $ARGUMENTS contains --dry-run: after the analyzer runs, identify, filter, and classify themes using the criteria in "Your job" below, but instead of presenting them interactively, output two sections:

Operational (recommendations only — not skill candidates):

| Category | Count | Recommendation |

|---|---|---|

| ... | N | PreToolUse hook / config change / budget adjustment / ... |

Shape-gap (forge candidates):

| Category | Count | Example friction_detail |

|---|---|---|

| ... | N | "truncated quote 1"; "truncated quote 2" |

One row per theme. Truncate each friction_detail to ~80 chars. Up to 3 examples per row (semicolon-separated in the cell). If neither table has any rows, print "No themes in lookback window." If only one table is empty, omit that table's header and add a (none) row placeholder instead.

After the table (or "no themes" line), print:

dry-run: no /forge invocation, no telemetry written

Stop. Do NOT proceed to the y/n prompts, /forge dispatch, or telemetry write described in "Your job" — those are skipped entirely in dry-run.

Auto mode

If $ARGUMENTS contains --auto: skip all y/n prompts and auto-approve all qualifying themes. For each theme classified as shape-gap in Step 2, immediately run /forge with the theme as a seed. Chain the invocations sequentially, then log telemetry for each generated skill. --auto respects --dry-run (if both flags are present, dry-run takes precedence and no /forge invocation or telemetry occurs).

Your job

Read through the friction categories and their examples. For each category with 3+ sessions, analyze the friction_detail strings to identify recurring themes — specific, repeated failure modes.

Step 1 — Filter

Not all friction is actionable. Filter for themes where:

<!-- Note: two earlier filter bullets — "A skill could change the agent's default behavior" and "The fix is a workflow shape change" — were consolidated into Step 2 Classify (shape-gap indicators), where they fit more naturally as classification criteria rather than pre-filters. -->

Step 2 — Classify

For each theme that passes the filter, classify it as operational or shape-gap:

Operational — infrastructure/tooling misbehavior, not a missing workflow. Indicators:

Shape-gap — a recurring workflow pattern agents perform without skill coverage. Indicators:

Step 3 — Route

Operational themes: For each, emit a one-line recommendation — the right fix category (PreToolUse hook, config change, budget adjustment, existing skill routing fix, or infrastructure improvement). Do NOT propose /forge for operational themes — they are not skill candidates.

Shape-gap themes: These are the forge candidates. Route them through the interactive or auto flow below.

If --auto is present in $ARGUMENTS:

If --auto is not present (interactive mode):

  1. Operational themes first: list each with its one-line recommendation (same Category | Count | Recommendation columns as dry-run). No y/n prompt — these are informational.
  1. Shape-gap themes next: for each, summarize it in one line with the count, then quote 2-3 representative friction_detail examples. Ask: "Generate a skill for this? (y/n)"
  1. If the user says yes:
  1. If the user says no, skip it and move on.

Telemetry (logged after each skill generation, same in both auto and interactive modes).

Create the telemetry directory if needed and append one JSONL line to the SAME file /forge writes to — resolve the path identically so both records land together regardless of environment:

mkdir -p "${AFK_FRAMEWORK_DIR:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}/agent-framework}"
printf '%s\n' '{"timestamp": "<ISO8601>", "source": "friction", "gap": "<THEME_SUMMARY>", "theme": "<THEME_SUMMARY>", "friction_category": "<CATEGORY>", "session_count": <COUNT>, "generated_skill": "<SKILL_NAME>", "qualify_result": "<APPROVE|SALVAGE|REJECT>", "iterations": <ITERATIONS_FROM_FORGE>, "target_scope": "<user|plugin:NAME>"}' >> "${AFK_FRAMEWORK_DIR:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}/agent-framework}/forge-telemetry.jsonl"

Substitute the bracketed values, emit compact one-line JSON, and append it with the shell redirect above (or the file-write tool). Do NOT use python3 -c — the AFK interpreter guard blocks interpreter -c/-e eval, which silently drops the record. Field notes:

You can also drill into a specific category:

python3 "${PLUGIN_ROOT}/scripts/friction/analyzer.py" --category wrong_approach

Or adjust the lookback window:

python3 "${PLUGIN_ROOT}/scripts/friction/analyzer.py" --days 60

After processing, summarize: how many themes found, how many classified operational (with recommendations listed), how many classified shape-gap, how many approved for forge, how many skills generated.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.