infer_history
Analyze a repository's git commit history to extract intents and decisions, bootstrapping or extending structured development knowledge with automatic resume.
Instructions
Analyze a repository's git commit history and produce structured development knowledge (intents and decisions) for the repo.
When to use:
To bootstrap a repository that has no recorded intents/decisions yet.
To extend coverage for new commits since the last run (resumes automatically when no
commitsvalue is provided).
Inputs of note:
estimateOnly(default true): returns a token/cost estimate without running. Call withestimateOnly: truefirst to preview cost, then re-call withestimateOnly: falseto run.commits(optional): how many recent commits to analyze. Omit to resume from where the last run stopped (or fall back to a sensible default on first run).commitRange(optional): git revspec selecting a specific window —"sha1..sha2","branch1..branch2","sha1^!"for a single commit. Mutually exclusive withcommits. Useful for recovering from dropped batches or backfilling specific PRs / branches without re-running the full history.contextIssues: include PR/MR descriptions and issue discussions when an authenticated forge CLI (ghorglab) is available; auto-skipped otherwise.allowCommitSplitting: enable when commit history is messy and a single commit may cover unrelated changes.model,maxStories: Anthropic model and per-run cap.force(default false): override the re-run guard (see Behavior).
Behavior:
A run is asynchronous — returns immediately with a started/pending status; progress is reported separately.
Results are persisted as intents and decisions for the repo on completion.
If interrupted, re-running resumes from where it left off.
Re-run guard: a clean incremental resume runs automatically. But if the repo already has intents and the run cannot cleanly resume (missing/unreachable cursor), or HEAD is not on the default branch, the call STOPS and returns
needsDecisioninstead of running — re-running blind there risks duplicate intents. Present the reason to the user and, if they confirm, re-call withforce: true. Run on the default branch (main/master) whenever possible; inferring a feature branch is whatforceis for.GitHub and GitLab are supported; the forge is detected from the remote origin.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Override the re-run guard. When the repo already has intents and infer_history cannot cleanly resume (missing/unreachable cursor), or when HEAD is not on the default branch, the run is stopped and a confirmation is requested. Set `force: true` to proceed anyway, accepting the duplicate-intent risk. Exact-commit duplicates are still skipped automatically; overlapping re-groupings are not. A forced run on a non-default branch additionally does NOT advance the resume cursor. Does not override a hard failure such as the desktop app being unreachable. | |
| model | No | Anthropic model to use (default: claude-sonnet-4-20250514) | |
| commits | No | Number of recent commits to analyze. If omitted, the server resumes from the last commit infer_history processed for this repo (or falls back to 50 on first run). Mutually exclusive with `commitRange`. | |
| repoPath | Yes | Local path to the repository root | |
| maxStories | No | Maximum number of stories to analyze in this run (0 = unlimited). | |
| commitRange | No | Optional git revspec to process a specific commit range instead of the N most recent (e.g. "sha1..sha2", "branch1..branch2", "sha1^!" for a single commit). Useful for recovering from dropped batches or targeted backfills. Mutually exclusive with `commits`. | |
| estimateOnly | No | If true (default), only estimate token cost without running the pipeline. Set to false to run the full pipeline. | |
| contextIssues | No | Include context issues from commit date range (requires gh/glab CLI) | |
| allowCommitSplitting | No | Allow splitting a single commit into multiple stories when it contains unrelated changes (recommended for repos with messy commit history) |