- TypeScript 90.4%
- JavaScript 7%
- Gherkin 2.6%
|
|
||
|---|---|---|
| .obsidian | ||
| context/features | ||
| docs | ||
| runs | ||
| src | ||
| test | ||
| .codex | ||
| .env.example | ||
| .eslintrc.cjs | ||
| .gitignore | ||
| .prettierrc.json | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
kobold
kobold is a CLI-first Planner -> Executor -> Evaluator runtime with structured observability.
Current iteration adds OpenBet-specific Jira planning with approval gating and AssertFlip-style fail-to-pass verification metadata.
Why this exists
This project follows a soft-routing approach:
- Planner decides actions dynamically.
- Executors stay deterministic and capability-scoped.
- Evaluator catches bad executions and controls retry/stop behavior.
The implementation is TypeScript/Node and uses provider-style planner adapters (including an OpenCode scaffold) while keeping loop control inside Kobold.
Quickstart
cd /space/repo/kobold
npm install
cp .env.example .env
npm run dev -- run --prompt "hello from kobold"
npm run dev -- run --prompt "read README.md" --feature "bootstrap"
CLI
kobold run --prompt "<request>" [--feature "<feature-name>"]
kobold plan --jira "<JIRA-KEY>" [--max-repos 5] [--assertflip-authoring auto|human_assisted|hybrid] [--assertflip-max-gen 3] [--assertflip-max-validate 3] [--assertflip-timeout-ms 30000]
kobold approve --plan-id "<plan-id>" --by "<name>" [--notes "<text>"]
kobold execute --plan-id "<plan-id>" [--assertflip-dry-run]
Commands:
run --prompt "<text>": runs one loop and writes a trace file.plan --jira "<key>": builds OpenBet context + dynamic AssertFlip plan and writes markdown/json artifacts underruns/plans/.approve --plan-id "<id>" --by "<name>": creates approval artifact required for execution.execute --plan-id "<id>": enforces approval gate, runs preflight, then executes through planner/executor/evaluator loop.- writes a resolution bundle under
runs/resolution/<planId>.json. - fails if repro/fix AssertFlip gates do not complete.
- writes a resolution bundle under
--feature "<name>"(optional onrun): appends a context-anchoring session hint entry tocontext/features/<name>.md.
Loop behavior (V1)
- Planner returns either:
toolaction (toolName,args,reason)finalaction (answer,reason)
- Executor runs deterministic tools from a registry.
- Evaluator applies lightweight rules:
- required arg checks
- success/error checks
- empty payload checks
- retry budget checks
- Runtime decides
continue,retry, orstop.
Observability
- JSON log events are emitted to stdout.
- Trace files are written to
runs/<timestamp>-<runId>.json. - Every event includes correlation metadata:
runIdstepId(for step-level events)
Captured trace events:
run_startedplanner_decisiontool_executedevaluator_decisionrun_completed
Included deterministic tools
echo_context: returns sanitized prompt context.read_local_file: reads UTF-8 files underKOBOLD_FILE_ALLOWLIST_ROOT.search_local_wiki: searches local Confluence snapshot (/space/obsidian-all/lq-confluence) first.query_jira: queries Jira via query-agents CLI.query_wiki: queries Confluence via query-agents CLI.query_bitbucket: queries Bitbucket via query-agents CLI.
Environment
See .env.example:
KOBOLD_PROVIDERKOBOLD_MODELKOBOLD_PLANNER_MODELKOBOLD_EVALUATOR_MODEKOBOLD_EVALUATOR_MODELKOBOLD_EVALUATOR_ESCALATION_MODELKOBOLD_EVALUATOR_LOW_CONFIDENCE_THRESHOLDKOBOLD_OPENCODE_BINKOBOLD_OPENCODE_TIMEOUT_MSKOBOLD_MAX_ITERATIONSKOBOLD_MAX_RETRIES_PER_STEPKOBOLD_FILE_ALLOWLIST_ROOT
Planner provider
KOBOLD_PROVIDER=mockuses the deterministic local planner.KOBOLD_PROVIDER=opencodeuses the OpenCode planner adapter scaffold and falls back safely if unavailable.KOBOLD_MODELis the general default model (usegithub-copilot/gpt-5-minifor most tasks).KOBOLD_PLANNER_MODELoverrides planner-only model selection (for examplegithub-copilot/gpt-5.3-codexfor higher-quality planning).KOBOLD_EVALUATOR_MODE=ruleskeeps deterministic evaluation only (default).KOBOLD_EVALUATOR_MODE=hybridenables LLM fallback for ambiguous evaluator outcomes; default evaluator model should staygithub-copilot/gpt-5-miniand can escalate toKOBOLD_EVALUATOR_ESCALATION_MODELfor low-confidence checks.
Context Anchoring
Kobold supports feature-level external memory:
- Template:
context/features/_template.md - Guide:
docs/context-anchoring.md
Use --feature during runs to append session-level anchoring hints and trace references.
OpenBet Ticket Planning
kobold plan --jira <KEY> builds a decision artifact with:
- Jira issue context and VM metadata.
- Multi-repo candidates discovered from local
/space/repo. - Local-first wiki evidence (
/space/obsidian-all/lq-confluence) with remote fallback. - AssertFlip section:
- candidate WDIO/Karate tests,
- dynamically generated passing/inverted tests in run workspaces,
- generation + validation loop budgets (
--assertflip-max-gen,--assertflip-max-validate,--assertflip-timeout-ms), - repro/fix acceptance criteria,
- optional human-assist prompts (
--assertflip-authoring human_assisted|hybrid).
Execution requires explicit approval via kobold approve.
Use kobold execute --plan-id <id> --assertflip-dry-run to verify planning/execution flow without strict gate enforcement.
Docs
docs/usage.md: setup, commands, planner provider modes, and troubleshootingdocs/architecture.md: loop architecture and data flowdocs/context-anchoring.md: feature-level external memory workflowdocs/adr/README.md: architecture decision records (ADRs) index and authoring guide
Tests
npm test
Coverage includes planner schema validation, evaluator rule behavior, and runtime success/failure paths with trace validation.
Next iteration
- Auto-materialize AssertFlip draft tests directly into target repos after approval.
- Stronger repo candidate scoring from Jira development links and Bitbucket metadata.
- Trace replay command (
kobold replay <run_id>).