ContextForge is a local-first repository-to-agent context layer that scans a repository, compiles a task source into a task pack, and exports compact briefs for Codex, Claude Code, and Cursor.
- solo builders using coding agents
- open source maintainers
- small engineering teams that want repeatable local context prep
Coding agents waste time when they start without the right files, constraints, validation commands, or task framing. ContextForge turns that missing setup into local, reviewable artifacts that can be regenerated and checked into the repo.
initorscaninspects the repository and writes context artifacts under.contextforge/.compileturns a markdown task or GitHub issue source into a structured task pack.exportrenders that task pack into an agent-specific brief.lintchecks generated guidance for stale references and weak validation setup.
| Target | Command | Default output | Notes |
|---|---|---|---|
| Codex | contextforge export codex |
.github/codex/prompts/<slug>.md |
Compact prompt file for Codex workflows. |
| Claude Code | contextforge export claude |
.contextforge/exports/claude/<slug>.md |
Task brief only. No CLAUDE.md or .claude/* memory files are auto-written. |
| Cursor | contextforge export cursor |
.contextforge/exports/cursor/<slug>.md |
Task brief only by default. Optional .mdc rule suggestions are only written when --rule-output is passed. |
ContextForge targets Node.js 20 and newer. CI validates the CLI on Node 20 and Node 22.
npm ci
npm run build
node dist/cli/index.js init
node dist/cli/index.js compile --input examples/issue-add-command.md
node dist/cli/index.js export codex --input .contextforge/task-packs/add-lint-command.jsonThat gives you:
- repository context under
.contextforge/ - a compiled task pack under
.contextforge/task-packs/ - a Codex prompt under
.github/codex/prompts/
- Open
examples/demo/for small checked-in task-pack and export examples. - Use
examples/issue-add-command.mdfor the local markdown compile flow. - Use
examples/github-issue-sources.mdfor GitHub issue input examples. - Use
examples/claude-export-usage.mdandexamples/cursor-export-usage.mdfor agent-specific export examples. - Internal milestone Codex prompts are archived under
docs/archive/bootstrap/codex-prompts/..github/codex/prompts/is kept for the active workflow prompt and real generated Codex outputs.
Refresh curated demo assets with:
npm run demo:refreshOnce the public package is published, install it as @xiwuqi/contextforge. The CLI command remains contextforge.
Local development install:
npm ci
npm run build
npm linkIf you do not want to link the CLI globally, use node dist/cli/index.js.
Packaged local tarball smoke test:
npm run smoke:packPublishability dry-run without publishing:
npm run publish:dry-runFull release-candidate validation:
npm run release:checkVersioned release handoff bundle:
npm run release:artifactsThis writes a versioned bundle under .contextforge/releases/<version>/ with the tarball, package file list, release notes, checksums, and a short summary for manual release handoff or workflow dispatch review.
Maintainers can then trigger the manual GitHub Actions release workflow once the version, changelog, repository permissions, and npm publishing setup are ready. It does not run on push.
contextforge init [--write-agents] [--json]
contextforge scan [--json] [--max-depth 6]
contextforge compile (--input <file> | --github-issue <url|owner/repo#number> | --github-issue-json <path>) [--title <title>] [--json]
contextforge export codex --input <task-pack.json> [--output <file>]
contextforge export claude --input <task-pack.json> [--output <file>]
contextforge export cursor --input <task-pack.json> [--output <file>] [--rule-output <file>]
contextforge lint [--json] [--strict]contextforge compile requires exactly one source flag:
--input <file>for local markdown tasks--github-issue <url|owner/repo#number>for live GitHub issue fetching--github-issue-json <path>for offline issue JSON compilation
- generate code for you or replace the coding agent
- run a hosted SaaS or database
- depend on a browser UI or browser automation
- require an API key for the core workflow
- auto-release on push, silently publish, or bypass maintainer review
- auto-write
CLAUDE.md,.claude/*,.cursor/rules/*, or legacy.cursorrules - replace agent judgment with a heavy RAG stack or model training pipeline
docs/maintainers/release-checklist.mddocs/maintainers/first-public-release.mddocs/maintainers/first-public-release-checklist.mddocs/maintainers/manual-release-handoff.mddocs/maintainers/npm-publish-guide.mddocs/maintainers/public-metadata-checklist.mddocs/maintainers/release-automation.mddocs/maintainers/feedback-triage.md
- Open a GitHub issue with the built-in bug report, feature request, or workflow feedback template.
- Use
CONTRIBUTING.mdfor local setup, validation expectations, and scope discipline before opening a pull request. - Use
SECURITY.mdfor security-sensitive reports. Do not post exploit details in a public issue.
npm ci
npm run build
npm run test
npm run lint
npm run smoke:pack
npm run eval:fixtures
npm run publish:dry-run
npm run release:check
npm run release:artifacts
npm run demo:refresh
npm run format