Index of every page on this site: llms.txt
All skills
Run it yourself

The factory's outer loop. Reads where people keep correcting agents (local transcripts, the run ledger, human review comments on merged PRs), finds the skill that owns each repeated failure, and opens one small, evidence-backed PR to improve it for a human to review. Use when the weekly loop runs, when asked to "improve the skills", "run the loop", or "why do agents keep doing X", when a friction report shows a climbing pattern, or when a memory has been used often enough to graduate into a skill.

Use this Skill: https://skilld.dev/gh/aditya-deokar/software-factory/skill-feedback-loop

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈131 tokens for metadata: the name and description. ≈1.3k when used: this file. ≈2.6k more on demand in 4 files.

Description uses 6.6% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈524 characters, or 6.6%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Skill feedback loop

Skills go stale. People correct agents in review comments and chat, and unless something reads those corrections, the same mistake repeats forever. This loop is the observer: it watches how the inner-loop skills perform and proposes the smallest change that would have prevented the repeated correction. A human reviews every proposal. The loop never merges.

It runs as its own task, with its own worktree and its own run record (--class loop).

Find the scripts

SKILL_DIR="$(dirname "$(find skills .claude/skills .agents/skills ~/.claude/skills ~/.agents/skills ~/.claude/plugins \
  -name SKILL.md -path '*skill-feedback-loop*' 2>/dev/null | head -1)")"

1. Collect signals

node "$SKILL_DIR/scripts/collect-signals.mjs"            # all sources, writes .factory/.cache/signals-<date>.json
node "$SKILL_DIR/scripts/friction-report.mjs" --since 14d   # just the transcript counts, with sample quotes

Four sources, each optional:

Source What it shows Needs
Friction patterns How often people typed each known correction, now vs the window before Local transcripts
Run ledger Corrections by beat, review rounds by class, runs shipped without evidence .factory/runs/
Review comments Human comments on merged PRs, grouped by skill or area gh
Memory Memories used often enough to graduate .factory/memory/

A missing source is reported as unavailable, never as zero. Transcripts stay local: the signals file is written to the gitignored .factory/.cache/.

2. Pick one thing

The script ranks candidates and prints Next:. A friction key qualifies when all of these hold:

  • It reached loop.min_occurrences (default 2) this window. One incident is an anecdote.
  • It is new or climbing compared with the previous window.
  • Its owner has no open proposal, and no proposal merged within loop.cooldown_windows windows. A change needs time to show whether it worked.
  • There is budget: fewer than loop.max_open_prs proposals are open.

If Next: says nothing qualifies, stop. Record the run as closed and report the table. A quiet week is a result.

Before trusting a count, read its samples. Regexes misfire. If a sample is not really that correction, the fix is to the pattern (with a new miss example), not to the skill.

3. Diagnose before writing

Read the owning skill in full, then answer in writing:

  1. Does the skill already say the right thing? If yes, more text will not help. A rule that has already been broken twice needs a mechanism: a script the agent runs, a check in check-factory.mjs or the linter, or a hook. Propose that, and delete the prose it replaces in the same PR.
  2. Is the trigger the problem? If the skill never loaded when it should have, change the description, and only the description. See skill-authoring.
  3. Is it missing a case? Add the case, in the skill's existing voice, at the point in the procedure where the agent would need it.

4. Write the proposal

Copy references/proposal-template.md to .factory/proposals/<date>-<key>.md. It records the signal, diagnosis, change, the number it should move (with the baseline), and the rollback. Trim sample quotes to what shows the pattern. They land in git.

Then make the change and open the PR through the normal ship beat:

gh label create factory:skill-loop --color 5319E7 2>/dev/null || true
gh pr create --label factory:skill-loop --title "<skill>: <what changes>" --body-file <proposal file>

Run the linter (node scripts/lint-skills.mjs in a skills repo) and check-factory.mjs before opening it.

5. Stop, then follow up next time

After opening the PR, stop. A human merges it or closes it. Set the proposal status to match (merged, closed) when that happens.

On every later run, collect-signals compares each merged proposal's key with its baseline. If the number did not drop within two windows, it flags the proposal. Open a revert PR and say so plainly. A change that did not help is still clutter the agent has to read.

Rules the loop must keep

  • One skill per PR. Two changes in one PR make it impossible to tell which one moved the number.
  • No key, no rule. Every added instruction cites a friction key. If the failure has no key, add a pattern to .factory/friction-patterns.json first (with match and miss examples), so the change can be measured. Set metadata.signals on the skill to the keys it owns.
  • Never edit a vendored skill's body. code-review-loop, code-review-loop-large, visual-diff, and prose-cleanup stay as upstream shipped them. When one of them owns the failure, propose an AGENTS.md note or a wrapper instead.
  • Never merge, never push to a PR you did not open, and never open a second proposal for a skill that already has one open.
  • Graduation removes the memory. When a memory moves into a skill, delete the memory file and rerun memory.mjs index in the same PR.

Recording the run

node "$LEDGER" start --class loop --size small --title "skill loop <date>"
node "$LEDGER" finish current --outcome shipped     # or closed when nothing qualified

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning29d3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    This skill implements a feedback loop that identifies recurring agent failures by analyzing local chat transcripts and GitHub pull request comments. It generates pull requests with proposed skill improvements for human review. The skill presents an indirect prompt injection surface due to its ingestion of untrusted transcripts and external comments, and it accesses sensitive local chat history, though these risks are mitigated by a mandatory human-in-the-loop review process.

  • Socket29d

    No alerts

  • Snyk29d

    Risk: MEDIUM · 1 issue

Signed by skilld at 546bbff. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 months ago
What it can do
Runs commands
metadata
{
  "author": "software-factory",
  "version": "1.0"
}
All 1 allowed tools
Bash(node:*) Bash(git:*) Bash(gh pr *) Bash(gh api *) Bash(gh label *)
Other metadata
compatibility
Node.js 18+, no dependencies. Transcript signals need local Claude Code or Codex transcripts (unavailable in CI; the loop runs on the other signals). Review-comment signals and opening the PR need an authenticated gh CLI.

README badge

README badge for aditya-deokar/software-factory/skill-feedback-loop