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

Record every task as a run in .factory/runs/ so the factory can be measured: class, size, model tier, beats completed, evidence, review rounds, human corrections, and token cost. Use when starting any task in a repo that has a .factory/ directory, at the end of each beat, when a human corrects or approves your work, when you finish or get blocked, and when asked how the factory is doing ("factory report", "how many PRs", "what did that cost").

Use this Skill: https://skilld.dev/gh/aditya-deokar/software-factory/run-ledger

Nothing lands on disk. Nothing to clean up.

Fork this Skill

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

SKILL.md

≈115 tokens for metadata: the name and description. ≈1.5k when used: this file. ≈1.2k more on demand in 1 file.

Description uses 5.8% 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 ≈460 characters, or 5.8%.

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.

Run ledger

A factory you cannot measure is a factory you cannot improve. The ledger is one JSON file per task under .factory/runs/, committed with the PR that did the work. The outer loop (skill-feedback-loop, model-routing) reads these files; nothing else produces the numbers.

Skip this skill only in a repo with no .factory/ directory. Suggest factory-setup there instead of creating the directory yourself.

Find the script

$SKILL_DIR is the folder this SKILL.md lives in. Resolve it once; a bare ./scripts/ resolves against the user's repo and fails.

SKILL_DIR="$(dirname "$(find skills .claude/skills .agents/skills ~/.claude/skills ~/.agents/skills ~/.claude/plugins \
  -name SKILL.md -path '*run-ledger*' 2>/dev/null | head -1)")"
LEDGER="$SKILL_DIR/scripts/ledger.mjs"

PowerShell:

$LEDGER = (Get-ChildItem -Recurse -Filter ledger.mjs -Path skills,.claude\skills,.agents\skills,$HOME\.claude\skills,$HOME\.claude\plugins -ErrorAction SilentlyContinue | Select-Object -First 1).FullName

Every command below is node "$LEDGER" .... current stands for the open run on the current branch, so after start you rarely need the id.

When to write

Moment Command
Task starts, after isolating start --class bugfix --size small --title "..." --source github:issue/123 --tier balanced --model <id> --rule <rule>
Triage decided beat current triage --set decision=implement
Aim set beat current aim --set rung=2 --set rungs=3 --add types=depth --set judge="..." --add follow_ups=github:issue/141
Spec approved beat current spec --set path=specs/login.md --set approved=true
Evidence captured beat current prove --add evidence=recording --set before_captured=true
PR open, review done beat current ship --set pr=45 --set review_rounds=2 --set final_score=5/5
A human corrected you touch current --beat build --kind correction --ref <comment URL>
A human approved a gate touch current --beat spec --kind approval --ref <URL>
Your part is done finish current --outcome shipped
You are blocked finish current --outcome blocked
Post-merge check ran release-monitoring sets monitor, then finish <id> --outcome merged

--set overwrites a field, --add appends to a list, and values are coerced (2 is a number, true a boolean). The script validates every write against the schema and refuses an invalid record rather than saving a bad one.

start takes the tier, model, and rule from model-routing. If the repo has no routing, leave them out.

Picking class and size

Class: bugfix, feature, refactor, docs, ci-fix, migration, perf, chore. Use triage for a run that only triaged, loop for an outer-loop run, and eval for a routing eval.

Size, by the diff you expect to ship:

  • small: one concern, a few files, no new interfaces. Most bugfixes.
  • medium: several files or one new interface. A typical feature.
  • large: cross-cutting, a migration, or anything that needed a spec.

Pick before you start and do not revise it to match what happened. The gap between the guess and the result is what routing learns from.

What counts as a human touch

Record one every time a person had to step in. These are the factory's defects, and hiding them makes the numbers lie.

Kind Example
correction "That's still broken." A review comment asking for a change. "Don't touch that file."
approval Spec approved, merge approved
rejection Spec or PR rejected outright
clarification You asked, they answered, and the answer changed the work
manual-fix The human edited the code themselves

Only people count. A comment from a review bot (Greptile, Copilot, CodeRabbit) is not a human touch; it is already counted in ship.review_rounds. Recording bot findings as touches inflates the number the outer loop acts on.

Link the comment or message in --ref whenever there is one. A touch with a link can be checked; a touch without one is a guess.

In the PR body

Add one line so reviewers and the outer loop can join the PR to its record:

Run: `2026-10-02-fix-login-redirect-3f2a` (.factory/runs/2026-10-02-fix-login-redirect-3f2a.json)

Commit the run file on the task branch. It merges with the change it describes.

Report

node "$LEDGER" report --since 14d          # markdown table
node "$LEDGER" report --since all --json   # for scripts

The report gives runs by outcome, class, and tier; median review rounds; human touches per shipped run; corrections by beat; how often evidence and the before state were captured; median tokens per shipped run; and how often memory was used. Paste it as evidence when someone asks whether the factory is working, instead of describing it.

report exits 2 when there is no runs/ directory. That means there is no data to report on, which is different from a clean report.

Tokens

finish sums token usage from local transcripts for this repo between started_at and now. Claude Code and Codex are supported. Running finish again (for example when a shipped PR later merges) keeps the first count. Pass --no-tokens to skip the scan.

Cost stays null when no transcript is found. Never fill it in by hand with an estimate. A number that looks measured but is not is worse than a blank.

Do not do these

  • Do not backfill a run after the fact from memory. Start the record when the work starts. A reconstructed record is a guess.
  • Do not leave a run open. Every run ends shipped, merged, closed, blocked, or abandoned. An open run is invisible to the report.
  • Do not skip touches because they are embarrassing. The outer loop needs them to find which skill failed.
  • Do not edit run files by hand except to fix a mistake, and then run factory-setup's check-factory.mjs on the directory.

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.

No alerts29d3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill tracks task progress and resource usage by recording data into local JSON files in the project's .factory/ directory. It calculates token costs by reading local transcripts from Claude Code and Codex, operating entirely within the local file system with no network access or external dependencies.

  • Socket29d

    No alerts

  • Snyk29d

    Risk: LOW · No issues

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 last month
What it can do
Runs commands
metadata
{
  "author": "software-factory",
  "version": "1.2"
}
All 1 allowed tools
Bash(node:*) Bash(git:*)
Other metadata
compatibility
Node.js 18+, no dependencies. Works on Linux, macOS, and Windows. Token cost is read from local Claude Code (~/.claude/projects) and Codex (~/.codex/sessions) transcripts when they exist; other harnesses record cost as unknown, never zero.

README badge

README badge for aditya-deokar/software-factory/run-ledger