Skip to main content

A simple coding harness with planner-implementor-validator orchestration

Project description

kunchi

A Simple Coding Harness (Python)

Multi-agent orchestration: planner → implementor → sequential validators, with output contracts and retry loops.

Quick start

pip install kunchi
# or for development:
pip install -e ".[dev]"
pytest
python3 -m kunchi.examples.demo "Build a demo feature"

The demo uses fake agents (no external CLIs) to exercise the full harness flow.

CLI (recommended for real repos)

pip install -e ".[dev]"
cd /path/to/your/repo
kunchi init --template cursor    # writes .kunchi/profile.yaml
export CURSOR_API_KEY=...        # for cursor template
kunchi run "Your goal"
kunchi run "Your goal" --monitor   # compact progress lines on stderr
kunchi run "Your goal" --trace      # verbose debug trace on stdout
kunchi plans
kunchi resume PLAN_ID

Use kunchi init --template fake to try the flow without Cursor. See docs/ROADMAP.md.

See docs/MANUAL_TESTING.md for manual smoke tests. Development progress and a good enough to start checklist are in docs/ROADMAP.md. Runnable scripts are in src/kunchi/examples/manual/:

python3 -m kunchi.examples.manual.harness_fake
python3 -m kunchi.examples.manual.cli_runner
python3 -m kunchi.examples.manual.cli_agent_fake_binary

hello()

kunchi exports a small public hello() helper (see src/kunchi/hello.py). It returns the string "hello".

from kunchi import hello

hello()  # "hello"

Agent backends

Fake agents (default) — no external dependencies:

from kunchi import Harness, default_harness_config

harness = Harness(default_harness_config())

Cursor CLI — requires the agent binary on PATH; tasks require summary + git_commit and run ruff / pytest shell validators before Cursor review:

from kunchi.harness import Harness, default_cursor_harness_config

harness = Harness(default_cursor_harness_config(workspace_path="/path/to/repo"))

Profiles bundle fixed output contracts and validators; register custom ones or load from a dict:

from kunchi.harness import harness_config_from_profile
from kunchi.profiles import ProfileRegistry, load_profile

harness = Harness(harness_config_from_profile("cursor", "/path/to/repo"))

# Dynamic / file-based (same shape a planner could emit later):
from pathlib import Path

from kunchi.harness import harness_config_from_profile_file
from kunchi.profiles import ProfileRegistry, load_profile, load_profile_file

harness = Harness(harness_config_from_profile("cursor", "/path/to/repo"))

profile = load_profile_file(Path("my-profile.json"))
registry = ProfileRegistry.default()
registry.register(profile)
harness = Harness(harness_config_from_profile(profile.name, ".", registry=registry))

# Or in one step:
harness = Harness(harness_config_from_profile_file("my-profile.yaml", "/path/to/repo"))

Or configure agents explicitly:

from kunchi import Harness, HarnessConfig
from kunchi.models.agent import AgentRole, AgentSpec
from kunchi.models.context import WorkspaceConfig

config = HarnessConfig(
    planner=AgentSpec(id="planner", role=AgentRole.PLANNER, config={"cli": "cursor"}),
    workspace=WorkspaceConfig(path="."),
    default_validators=[
        AgentSpec(id="lint", role=AgentRole.VALIDATOR, config={"cli": "shell", "command": "ruff check ."}),
    ],
)
harness = Harness(config)

Extending integrations

External system adapters live under src/kunchi/providers/:

  • Agent clients (providers/agents/) — implement AgentClient and register in AgentClientRegistry (Cursor is built in)
  • VCS backends (providers/vcs/) — implement VCSBackend and register in VCSRegistry (git is built in; hg is stubbed)

See docs/DESIGN.md sections 9 and 17 for details.

Persist plan state to disk (resume / inspect after a run):

from kunchi import Harness, default_harness_config
from kunchi.state import FilePlanStore

harness = Harness(default_harness_config(), plan_store=FilePlanStore(".kunchi/plans"))
report = await harness.run("Build feature")

# After an interrupt or partial run, continue from persisted state:
report = await harness.resume(report.plan_id)

# List saved plans:
summaries = await harness.list_plans()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kunchi-0.1.0.tar.gz (69.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kunchi-0.1.0-py3-none-any.whl (74.5 kB view details)

Uploaded Python 3

File details

Details for the file kunchi-0.1.0.tar.gz.

File metadata

  • Download URL: kunchi-0.1.0.tar.gz
  • Upload date:
  • Size: 69.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kunchi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 00a2fa0d71a9b331a1e416ac8483134bd70068aeb14a6c8e248ab60056303771
MD5 01c81f4e0ddd8ed764e5db3094919539
BLAKE2b-256 5a1a1ab6a5d0fe47be0fe8b1ee01ee96781b94a90d016c311edd3b184863ec56

See more details on using hashes here.

File details

Details for the file kunchi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kunchi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 74.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kunchi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d975f3f94edd10d6012c81375fc773e55768c68f102cc6d2b00cec60933c22c1
MD5 62405c4aea9ad4443faefe15b8b65352
BLAKE2b-256 330d228b7909e993776364ae77f4e62b22707bfa5e1d17106b22df84c284eeb1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page