Skip to content

knowledge-repo

Scan merged PRs from the last N days, extract knowledge relevant to AI agent context, and propose updates to context files (CLAUDE.md, AGENTS.md) as a git-apply-able patch. Runs a 7-phase pipeline: setup (forge detection, context file discovery), fetch (PR data via CLI), extract (parallel haiku agents per PR), synthesize (opus agent merges findings into proposed edits), review (adversarial opus agent checks quality), revise (conditional fix pass), and artifacts (patch file, run report). Non-interactive — designed for CI.

Plugin: knowledge-skills | User-invocable

Contract

Skill Contract canonical-skill-v1

Scan merged pull requests from the last N days, extract the knowledge that belongs in a repository's AI context and skill files, and propose the updates as a git-apply-able patch for a human to review.

Identity

Functions
orchestrate generate
Success
  • Runs the seven phases in order (setup, verify PR data, extract, synthesize, review, conditional revise, artifacts), taking the documented early exit at each gate.
  • Dispatches one extraction agent per PR in background waves of at most ten, polling for extraction files and continuing past per-wave timeouts.
  • Writes artifacts/proposed-updates.patch and an artifacts/run-report.json carrying forge, repo, date_range, PR and knowledge-item counts, changes_proposed, review_verdict, and patch_file.
  • Runs the revise phase only when the review verdict is REVISE, and skips it on PASS.

Optimization Targets

task_success judge review-agent.md @ ba45599

Invariants

Must Preserve
  • Resets the working tree with git checkout after capturing the patch, so the run leaves no tracked file modified.
  • Never creates a PR or MR; external tooling owns all forge interactions.
  • Stops with the documented early-exit run report instead of proceeding when there are no context files, no PRs, no knowledge items, or no changes.
  • Keeps the review agent context-isolated from the synthesis agent so the review sees only the diff and the raw extractions.
  • Stays non-interactive - the skill is designed to run unattended in CI.
Fixed Context
toolsBash, Read, Write, Agent, Glob
knowledgerepository_contentrepository_internal, task_inputtask_private, tool_outputtask_private

Traceability

Diagram

knowledge-repo diagram

Arguments

/knowledge-repo [--days N]
Argument Required Default Description
--days 7 How far back to scan merged PRs

Usage

/knowledge-repo
/knowledge-repo --days 14
/knowledge-repo --days 30