Thank you for your interest in contributing to Loki Mode. This guide covers everything you need to get started.
- Bun 1.3+ (
brew install oven-sh/bun/bunorcurl -fsSL https://bun.sh/install | bash) -- powers the TypeScript runner underloki-ts/ - Bash 4+ (macOS ships 3.x; install via
brew install bashor use Bun-route commands which are bash-version-agnostic) - Node.js 18+ (npm tooling, dashboard frontend)
- Python 3.12 (dashboard backend, memory system, MCP server). Python 3.14 is NOT compatible with
chromadb-- use 3.12 explicitly. - jq (
brew install jqorapt-get install jq) - Git
git clone https://github.com/asklokesh/loki-mode.git
cd loki-mode
# loki-ts (TypeScript runner; Bun)
cd loki-ts && bun install && cd ..
# Dashboard frontend (npm)
cd dashboard-ui && npm install && cd ..
# Dashboard backend + memory system (Python; optional unless touching those areas)
pip install -r dashboard/requirements.txtLoki Mode runs on two routes that share the same .loki/ state contract:
- Bun route (
bin/lokishim ->loki-ts/dist/loki.js): handles 8 read-only commands (version,status,stats,doctor,provider show/list,memory list/index) plus the runner loop onfeat/bun-migrationafter v7.4.x. ~3-5x faster than bash on these commands. - Bash route (
autonomy/loki): handles every other command. The shim falls through silently when bun is not on PATH so npm-without-Bun installs keep working.
LOKI_LEGACY_BASH=1 forces the bash route for every command. See docs/architecture/ADR-001-runtime-migration.md.
cd loki-ts
bun run typecheck # tsc --noEmit, strict
bun test # full unit + parity + integration suite
bun test --coverage # coverage report (lcov + text summary)The full suite is ~550 tests / ~45 seconds and must be green before submitting.
# Bun route (default if bun is on PATH)
bash tests/test-cli-commands.sh
# Bash route (LOKI_LEGACY_BASH=1 forces fallthrough)
LOKI_LEGACY_BASH=1 bash tests/test-cli-commands.shBoth routes must report 14/14 passed. Add new CLI tests to tests/test-cli-commands.sh when you add a new top-level command.
bash -n autonomy/run.sh
bash -n autonomy/loki
python3.12 -m pytest -qloki dashboard start # boots on http://127.0.0.1:57374
cd dashboard-ui && npx playwright testIf you are porting a bash command to the Bun route:
- Implement under
loki-ts/src/commands/<name>.tsmirroring an existing command (e.g.version.ts,status.ts). - Wire it into the dispatcher at
loki-ts/src/cli.ts. - Add the route token to
bin/loki:80(the case statement). - Add a parity entry to
.github/workflows/bun-parity.ymlmatrix (<label>|<args>|<text|json>). - Add a unit test under
loki-ts/tests/commands/<name>.test.ts. - Verify both routes produce the same output (the parity matrix enforces this on every PR).
loki-ts/tests/fixtures/build_prompt/ contains 60 sha256-checked fixtures covering different runner contexts. To add a new one:
- Create
fixture-N/withenv.sh(env vars),prd.md, optional.loki/scratch state, andmanifest.txt. - Run the bash baseline to produce
expected.txt:bash loki-ts/tests/fixtures/build_prompt/run-bash.sh fixture-N
- Compute
expected.sha256and add an entry toindex.json. - Confirm
bun test loki-ts/tests/parity/build_prompt.test.tsincludes your new fixture and passes on macOS + Linux.
If your fixture depends on filesystem traversal order (e.g. listing files in a directory), make sure both bash and TS sort deterministically -- the v7.4.9 magic-specs sort fix is the canonical example.
- Fork the repository and create a feature branch from
main. - Install the local pre-push hook (one-time):
./scripts/install-hooks.sh. This pointscore.hooksPathat.githooks/, which runsbash -nandpytestbefore every push. Bypass once withPRE_PUSH_SKIP=1 git pushif you genuinely need to. - Make your changes following the code style guidelines below.
- Run all tests -- shell syntax validation, unit tests, and E2E tests where applicable.
- Submit a PR against
mainwith a clear description of your changes.
PRs are reviewed for correctness, code style, and test coverage. Please keep PRs focused on a single concern when possible.
- All CI checks must pass: Tests (Python 3.10-3.13), Shell tests, Helm lint, Loki Quality Gate, Dashboard build verification, CLA. These are the gating checks.
- The
claude-reviewcheck is skipped on fork PRs by design. GitHub does not expose secrets or OIDC tokens to fork-triggered workflows, so the AI review action cannot run. This is not a failure on your part. Maintainers see the same review on the internal mirror. - Version bumps are not your responsibility. The maintainer bumps the 14 version locations as part of the release commit. Do not include version bumps in your PR; they will create merge conflicts with the release flow.
- A maintainer may re-implement your fix in their own commit rather than merging your PR directly. This is done to keep release cadence and version-bump rules consistent across one author -- it is not a rejection of your work. Whenever this happens, you are explicitly credited in the CHANGELOG entry for that release. Past examples: PR #151, #152, #153 -> v6.77.1.
A PR will be closed (with a friendly comment) if any of the following are true:
- The fix is incorrect or addresses a bug that does not exist on
main. - The change introduces unrelated edits or scope creep beyond the stated purpose.
- The author cannot describe how they verified the fix (CLAUDE.md requires the verification be reproducible).
- The contribution duplicates a fix already in flight or already shipped.
In all other cases, the maintainer either merges the PR directly or rolls the change into a release commit and credits you.
- No emojis. Not in code, comments, commit messages, documentation, or UI text. This is a hard rule with zero exceptions.
- Follow existing patterns. Look at surrounding code and match the style.
- Shell scripts must pass
bash -nsyntax validation. - Comments should be minimal and meaningful -- explain why, not what.
- Commit messages should be concise and use conventional prefixes:
fix:,update:,release:,refactor:,docs:,test:.
SKILL.md # Core skill definition
autonomy/ # Runtime and CLI (run.sh, loki)
providers/ # Multi-provider support (Claude, Codex, Gemini)
skills/ # On-demand skill modules
references/ # Detailed documentation
memory/ # Memory system (Python)
dashboard/ # Dashboard backend (FastAPI)
dashboard-ui/ # Dashboard frontend (web components)
events/ # Event bus (Python, TypeScript, Bash)
tests/ # Test suites
benchmarks/ # SWE-bench and HumanEval benchmarks
For full architectural details, see CLAUDE.md.
Use the issue templates for bug reports and feature requests.
By contributing, you agree that your contributions will be licensed under the Business Source License 1.1 (BUSL-1.1) and that you accept the terms of the Contributor License Agreement. See LICENSE-CHANGE-NOTICE.md for context on the March 2026 license change and the planned conversion to Apache 2.0 in 2030.