Note: We are not accepting contributions at this moment. Feel free to post an issue if you have feedback or suggestions.
Prerequisites
- SWI-Prolog >= 9.0 on
PATH(orKIBI_SWIPLpointing at it). A source checkout does not carry the bundled runtime that published packages ship, so install it yourself (seedocs/install.md) - Bun (latest)
- Git
Installation
bun installpackages/
core/ # Prolog KB core (kb.pl, schema/*.pl)
cli/ # Node.js CLI (commands, extractors, Prolog wrapper)
mcp/ # MCP server (stdio, JSON-RPC)
vscode/ # VS Code extension (TreeView)
tests/
integration/ # End-to-end tests
benchmarks/ # Performance benchmarks
These are internal working documents, not user-facing product docs:
- Brand guide — visual identity for the logo, HTML report, and badge
Unit Tests (TypeScript/CLI)
bun run test # Project test pipeline (unit + packed local e2e)
bun run test:unit # All unit tests (packages/*)
bun test packages/cli/ # CLI tests only
bun test packages/mcp/ # MCP tests onlyIntegration Tests
bash ./scripts/run-integration-tests.shProlog Tests (plunit)
swipl -g "load_test_files([]),run_tests" -t halt packages/core/tests/kb.plt
swipl -g "load_test_files([]),run_tests" -t halt packages/core/tests/schema.pltTo try unreleased changes in a separate consumer repository, pack the workspace into local tarballs and install those instead of the npm releases. You need Bun for the build and pack steps.
- Build every package from the Kibi checkout:
bun run build
- Pack the publishable packages into one directory (each package's
prepackrebuilds it, so the tarballs carry freshdist/output):bun run pack:all -- --destination /tmp/kibi-tarballs
- In the consumer repository, depend on the tarballs and override the transitive Kibi packages so they resolve to the same local builds instead of npm. With npm:
Then run
{ "devDependencies": { "kibi-cli": "file:/tmp/kibi-tarballs/kibi-cli-<version>.tgz", "kibi-mcp": "file:/tmp/kibi-tarballs/kibi-mcp-<version>.tgz" }, "overrides": { "kibi-core": "file:/tmp/kibi-tarballs/kibi-core-<version>.tgz", "kibi-runtime": "file:/tmp/kibi-tarballs/kibi-runtime-<version>.tgz", "kibi-plugin-sdk": "file:/tmp/kibi-tarballs/kibi-plugin-sdk-<version>.tgz", "kibi-plugin-builtin": "file:/tmp/kibi-tarballs/kibi-plugin-builtin-<version>.tgz", "kibi-swipl": "file:/tmp/kibi-tarballs/kibi-swipl-<version>.tgz" } }npm installand checknpx --no-install kibi --version. Add agent-host packages (kibi-opencode,kibi-codex, ...) the same way when you need them.
The SWI-Prolog platform packages (kibi-swipl-linux-x64-gnu, kibi-swipl-darwin-arm64, ...) are not packed: their binaries are only populated at release time. The local kibi-swipl tarball pins them to exact versions, which the consumer installs from npm, so the pinned platform version must already be published.
Run performance benchmarks:
bun run tests/benchmarks/sync.bench.ts
bun run tests/benchmarks/query.bench.ts
bun run tests/benchmarks/mcp-latency.bench.ts- Formatting and linting use Biome.
- Run lint:
bun run check - Run format:
bun run format
To simulate CI steps:
- Install SWI-Prolog (via apt-get or package manager). CI itself runs the pipeline-built bundle for most jobs and a system install for
ci-integration; seedocs/swipl-build.md - Install Bun
- Run
bun install - Run
bun run test - Run integration tests and benchmarks as above
Use the following prefixes:
feat(scope): description— New featurefix(scope): description— Bug fixdocs(scope): description— Documentation changestest(scope): description— Test changeschore(scope): description— Build/config changes
- All tests pass (
bun run test) - Code passes linting (
bun run check) - Integration tests pass (
bash ./scripts/run-integration-tests.sh) - Documentation updated if needed
- Tests added for new features
- Commit messages follow conventions
When documenting issues or workarounds in the KB:
- Use
factwithfact_kind: observationormetafor bug records and workaround notes (non-blocking lane) - Use
flagonly for actual runtime/config gates (not for bug records) - Strict facts (subject, property_value) drive contradiction checks.
domain-contradictionsapplies only to strict lane.strict-fact-shapeis a canonical blocking check. Schema 7 migration encodes legacy polarity-only property values as typed boolean facts. - Use
flagonly for actual runtime/config gates (not for bug records) - See Entity Schema and AGENTS.md for the canonical entity-choice guidance
Clear, practical, and ready for contributors.
To help maintain traceability between code and requirements, all new or modified code symbols (functions, classes, modules) must be linked to at least one documented requirement before commit.
When you add or change a function, class, or module, include a comment with the requirement ID(s) it implements. Example:
export function myFunc() { } // implements REQ-cli-gcFor multiple requirements:
export class MyClass { } // implements REQ-cli-gc, REQ-cli-checkThis applies to TypeScript (.ts, .tsx) and JavaScript (.js, .jsx) files by default.
If you ran kibi init, a pre-commit hook will automatically check your staged changes. The hook enforces two hard gates:
-
Symbol traceability: New or modified symbols must be linked to a requirement via
// implements REQ-<area>-<behavior>directives. If any staged symbol lacks a requirement link, the commit is blocked. -
Kibi impact evidence for behavior changes: Behavior-changing source edits must include staged Kibi impact evidence — either updated KB entity markdown under
.kb/(requirements, scenarios, tests, facts, ADRs, flags, events) or a refreshed.kb/symbols.yamlwhen symbol coordinates change. Test-only edits (tests/,*.test.*,*.spec.*) and docs-only edits (.md) are exempt.
If kibi check --staged reports kibi_impact_evidence_missing or symbols_manifest_stale, resolve by:
- Querying Kibi via MCP before behavior changes
- Staging relevant KB entity docs or symbol manifest changes
- Running
kibi check --stagedto verify
The hook also blocks commits when .kb/symbols.yaml has unstaged changes. Stage and commit the refreshed manifest with the code or documentation change that caused it.
You can test your staged changes manually with:
npx kibi check --stagedFor more details, see the "Staged Symbol Traceability" section in the README.
If you ran kibi init, a pre-commit hook will automatically check your staged changes for missing requirement links. If any new or modified symbols are not linked to a requirement, your commit will be blocked with an error message. To proceed, add the appropriate implements REQ-<area>-<behavior> directive to your code.
The hook also blocks commits when .kb/symbols.yaml has unstaged changes. Stage and commit the refreshed manifest with the code or documentation change that caused it.
You can test your staged changes manually with:
npx kibi check --stagedFor more details, see the "Staged Symbol Traceability" section in the README.