Metadata-Version: 2.4
Name: sikula
Version: 0.4.0
Summary: Stateful AI agent pipeline that turns task descriptions into review-ready branches
Author-email: Petr Lexa <contact@sikula.ai>
License-Expression: AGPL-3.0-only
Project-URL: Homepage, https://sikula.ai
Project-URL: Repository, https://github.com/sikula-ai/sikula
Project-URL: Issues, https://github.com/sikula-ai/sikula/issues
Keywords: ai,llm,coding-agent,code-review,developer-tools,automation
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
License-File: THIRD_PARTY_NOTICES.md
Requires-Dist: markdown-it-py<5,>=4.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: pytest-xdist>=3.6; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Dynamic: license-file

# Sikula

[![PyPI version](https://img.shields.io/pypi/v/sikula)](https://pypi.org/project/sikula/) [![Python versions](https://img.shields.io/pypi/pyversions/sikula)](https://pypi.org/project/sikula/) [![CI](https://github.com/sikula-ai/sikula/actions/workflows/ci.yml/badge.svg)](https://github.com/sikula-ai/sikula/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/sikula-ai/sikula/graph/badge.svg)](https://codecov.io/gh/sikula-ai/sikula) [![License: AGPL-3.0-only](https://img.shields.io/badge/License-AGPL--3.0--only-blue.svg)](LICENSE)

Sikula is a local AI software delivery pipeline for turning task descriptions into reviewed, tested git branches.

It helps turn product intent into an implementation contract, runs that contract through a gated agentic delivery pipeline, and records the run in an auditable state file you can inspect to understand the result and improve the next run.

## Why Sikula

Most AI coding tools optimize for producing a diff. Sikula optimizes for the delivery path around that diff: is the task clear, did the change stay in scope, did independent agents review it, did validation pass, and can a human audit what happened?

```text
Product task description
  -> implementation contract
  -> gated agentic delivery pipeline
  -> PR-ready branch + state file
  -> better next run
```

- **Before coding**, a product task description can be checked and improved into an implementation contract with scope, acceptance criteria, risks, tests, and validation.
- **During the run**, separate agents implement, review, security-review, write tests, and fix build/test/check failures. Each agent can use the LLM provider, model, and timeout that fits its job.
- **After completion**, Sikula leaves a normal git branch plus an auditable state file. That record helps improve future implementation contracts, project guidelines, and delivery decisions.

Default runs use git worktree isolation, so the task happens on a dedicated branch and worktree instead of modifying your main checkout directly.

## Need Help?

If you want help integrating Sikula into your codebase, do not hesitate to reach out through [sikula.ai](https://sikula.ai).

## Compatibility

### Supported Stacks

| Stack | Build tool |
|---|---|
| Android / Gradle | `gradle-android` |
| JVM backend / Gradle | `gradle-jvm` |
| JVM backend / Maven | `maven` |
| Node.js / TypeScript / JavaScript, including npm, pnpm, Yarn, and Bun | `node` |
| iOS / Xcode | `xcodebuild` |
| Python | `python` |
| Rust / Cargo | `cargo` |

The orchestration loop is platform-neutral. Stack-specific behavior lives in `BuildTool` subclasses under `tools/`. When build validation is enabled, changes to build configuration are synchronized before the next enabled review or build, so reviewers see regenerated outputs. See [build sync configuration](docs/configuration.md#build-sync-and-generated-outputs), including custom Gradle lockfile regeneration.

### LLM Providers

Sikula has built-in CLI integrations for Codex, Claude, Gemini, OpenCode, and Antigravity. See [Providers](docs/providers.md) for authentication, model configuration, per-agent overrides, and data-boundary notes.

## Demo

This demo shows Sikula taking a task through analysis, implementation, independent review, test repair, and final validation on the JVM/Gradle Countries backend example.

![Sikula terminal demo showing analysis, implementation, independent review, test fix loop, and final branch status](docs/assets/sikula-demo.gif)

## Get Started

Prerequisites: Python 3.10+, `git`, `pipx`, a git repository for the target
project, and one authenticated LLM CLI provider. Delivery assembly that must
merge independent unit commits requires Git 2.38+.

### Install Sikula

Use the latest release:

```bash
pipx install sikula
```

Or use the latest development version from source:

```bash
git clone https://github.com/sikula-ai/sikula
cd sikula/
pipx install --editable .
```

Check the invoked runtime with `sikula --version`. For automation, use
`sikula version --json`: it returns one `sikula.cli.v1` object with
`sikula_version`, `command: "sikula version"`, `status: "done"`, and
`next_action: "none"`. It works without project configuration or provider setup
and does not write state. Unavailable or invalid version metadata produces a
nonzero exit and a sanitized stderr diagnostic, with no JSON success output.

### Set Up Your Project

Generated configs use Codex by default. Claude, Gemini, OpenCode, and Antigravity are supported too; see [Providers](docs/providers.md).

```bash
codex login

cd my-project/

# Basic setup — detects build tool, language, platform, package manager, source paths
sikula init

# With LLM-generated guidelines — reads the codebase and writes .sikula/guidelines.md
sikula init --provider codex --model gpt-5.5 --guidelines

# You can also add generated guidelines later; existing config is preserved
sikula init --guidelines

# Review TODOs, then commit config and generated guidelines before the first isolated run
git add .sikula/
git commit -m "Add Sikula project setup"

# Write a task
mkdir -p .sikula/tasks
$EDITOR .sikula/tasks/my-task.md
```

For other providers, generated guidelines, `--no-isolate`, and contract preparation, see [First Run](docs/first-run.md).

After setup, choose the workflow that fits what you want to do.

## Ways To Use Sikula

**Prepare and check an implementation contract**

```bash
# Inspect a task to see if it is ready for implementation
sikula contract check .sikula/tasks/my-task.md

# Let Sikula refine a rough product task into a cleaner task description
sikula task refine .sikula/tasks/my-task.md \
  --auto \
  --output .sikula/tasks/my-task.refined.md

# Prepare a project-aware implementation contract from the task
sikula contract prepare .sikula/tasks/my-task.refined.md \
  --auto \
  --output .sikula/contracts/my-task.contract.md
```

Use this when you want to clarify a product task description into a formal implementation contract before any agents start changing code. `task refine` is an optional step to normalize a rough request, and `contract prepare` adds project-aware delivery constraints.

These commands also support interactive modes (`--interactive`) and answers-file injection for strict control. See [Writing Sikula Tasks](docs/writing-tasks.md) for full details on advanced contract workflows.

**Run a task into a branch**

```bash
sikula run .sikula/contracts/my-task.contract.md --require-contract-ready
sikula status
sikula summary <task-id> > pr-body.md
git diff <base-branch>...sikula/<task-stem>-<task-id>
```

Run the prepared contract through implementation, configured validation and
independent review. The readiness gate stops incomplete contracts before agents
start. See [Writing Sikula Tasks](docs/writing-tasks.md) for contract requirements.

After a completed isolated task or delivered review-fix with a publishable
commit, `sikula summary <task-id>` prints deterministic PR-ready Markdown to stdout. The projection
contains bounded contract identity, validation and review outcomes,
project-relative files touched during the run, recovered-activity counts, and
residual-risk counts. The touched-file list is cumulative and can include paths
whose changes were later reverted. It does not copy task text, prompts,
provider output, review prose, diagnostics, or absolute paths from local task
state. Delivery-unit and report-only review states are rejected because they
are not publishable implementation results.
PR-ready output requires a safe recorded branch, a full result commit, and no preserved worktree.
No-change and `--no-isolate` runs are intentionally rejected because they do
not provide a standalone commit to publish.

**Deliver a larger request**

Use a delivery plan when work needs several dependent implementation tasks.
Sikula prepares small units, runs them one at a time in isolated worktrees,
then assembles their commits into one delivery branch without changing your
checkout.

```bash
# Optional: ask whether this request needs a plan or a single task
sikula delivery assess .sikula/tasks/my-task.refined.md

# Prepare, inspect and commit the generated plan and unit contracts
sikula delivery prepare .sikula/tasks/my-task.refined.md
sikula delivery check .sikula/delivery/my-task/plan.yaml
git add .sikula/tasks/my-task.refined.md .sikula/delivery/my-task/
git commit -m "Prepare delivery plan"

# Preview execution, then run up to three units
sikula delivery run .sikula/delivery/my-task/plan.yaml --dry-run
sikula delivery run .sikula/delivery/my-task/plan.yaml --max-units 3
sikula delivery status .sikula/delivery/my-task/plan.yaml

# Continue and finalize when the plan passes its final gate
sikula delivery run .sikula/delivery/my-task/plan.yaml
```

Preparation preserves source requirements, constraints and assigned assets.
It can choose intermediate checkpoints or a hierarchy of groups; you do not
need to place them manually. Preparation writes plan and unit files without
starting implementation. Review those files before committing them.

Checkpoints verify a completed group before dependent units proceed. The
**final gate** checks integration on the assembled candidate; every delivery
plan must pass it before finalization. Eligible findings can trigger bounded
automatic repair followed by fresh verification. Text and JSON output show
checkpoint and final-gate status.

Rerun `delivery run` to continue after a unit limit or a resumable interruption.
An eligible failed child requires an explicit `--reset-failed`; this does not bypass security
or scope stops, missing evidence, or exhausted checkpoint/final-gate repair
budgets. Inspect `delivery status` for the next action. Oversized units can be
split through a checked amendment; some blockers require a follow-up plan or
external work.

Hierarchy keeps individual review requests bounded, but source, plan and execution
limits still apply. Large plans can take substantial time and need operator
intervention. Synthetic capacity tests verify coordination and recovery, not
real-model judgment or unattended reliability.

See [Delivery Plans](docs/delivery-plans.md) for preparation, amendments, recovery,
limits and JSON output, and [Delivery Recovery Acceptance](docs/delivery-autonomy-acceptance.md)
for the tested recovery paths.

**Review an existing branch**

```bash
sikula review \
  --branch feature/login \
  --base-branch main \
  --description-file pr.md
```

Use this when code already exists and you want an independent review/security gate before merge. See [Reviewing Branches](docs/review.md) for report-only mode, `--fix`, security review, and CI usage.

When you are already on the branch you want Sikula to fix, use current-branch
fix mode:

```bash
sikula review \
  --fix \
  --current-branch \
  --base-branch main \
  --description-file pr.md
```

This keeps write-capable agent work in an isolated Sikula worktree, then
fast-forwards the originally current branch only after review, validation, and
delivery safety checks pass.

## Common First-Run Issues

- **`pipx: command not found`** - install `pipx` from <https://pipx.pypa.io/stable/installation/>.
- **Config, guidelines, or rules missing in the worktree** - commit `.sikula/config.yaml`, any generated `.sikula/guidelines.md`, and any `extra_rules` files used by enabled phases before the first isolated run. These prompt-context paths must be files in the worktree start ref. A delivery child assembled from another commit also requires that commit to contain the same config loaded for the run. For `sikula review`, make sure the reviewed branch contains its configured guidelines/rules files.
- **Provider is not authenticated** - run `codex login` or see [Providers](docs/providers.md) for Claude, Gemini, OpenCode, and Antigravity.
- **Task is too vague** - run `sikula contract check .sikula/tasks/my-task.md` and see [Writing Sikula Tasks](docs/writing-tasks.md).
- **Run failed after creating a worktree** - inspect `sikula show <task-id>` and `.sikula/worktrees/<task-id>/`; use `sikula run --task-id <task-id> --reset-failed` only when the summary identifies an ordinary retryable failure. Terminal delivery boundary stops print their required amendment, external-follow-up, or child-replacement action instead.

## What You Get

- A dedicated branch named `sikula/<task-stem>-<task-id>`.
- A final commit when the task completes successfully.
- Independent review and security review records.
- Tests written or updated within configured test paths.
- Build/test/check validation records and recovered diagnostics.
- Content-free LLM invocation and available usage aggregates by task and agent.
- A task state file inspectable with `sikula show <task-id>`.
- Privacy-safe PR-ready Markdown from `sikula summary <task-id>` after a
  completed isolated task or review-fix with a publishable commit.

## Example Projects

Use these projects to inspect working Sikula configs, task files, and validation pipelines across supported stacks.

For a standalone frontend demo, see [sikula-example-web-project](https://github.com/sikula-ai/sikula-example-web-project): a small Bun, Vite, React, and TypeScript repository with its own Sikula config, task file, guidelines, validation pipeline, and auditable run state.

The Rust example includes commented `extra_rules` files you can enable to see project-specific planner, reviewer, security reviewer, and test writer rules in action.
The React example demonstrates how to provide physical delivery assets in a task description (see `add-search-by-name.md`).

| Example | Stack |
|---|---|
| `example/android/countries/` | Kotlin, Android, Jetpack Compose |
| `example/ios/countries/` | Swift, iOS, SwiftUI |
| `example/jvm/countries-gradle/` | Kotlin, Spring Boot, Gradle |
| `example/jvm/countries-maven/` | Kotlin, Spring Boot, Maven |
| `example/node/countries-react/` | TypeScript, React, Vite |
| `example/node/countries-bun-fullstack/` | TypeScript, Bun full-stack |
| `example/rust/countries/` | Rust CLI |

Example:

```bash
cd example/node/countries-react
sikula run .sikula/tasks/add-search-by-name.md
```

## Documentation

The main README is the documentation entry point. Deeper guides live under `docs/`:

| Need | Read |
|---|---|
| First install, setup, and run | [First Run](docs/first-run.md) |
| Writing good task files | [Writing Sikula Tasks](docs/writing-tasks.md) |
| Checking large-work delivery plans | [Delivery Plans](docs/delivery-plans.md) |
| Gated delivery pipeline and state model | [Pipeline And State](docs/pipeline.md) |
| Project configuration, guidelines, and agent-specific rules | [Configuration](docs/configuration.md) |
| Provider setup and model config | [Providers](docs/providers.md) |
| Worktree isolation, sandboxing, and privacy | [Sandbox](docs/sandbox.md) |
| Reviewing existing branches | [Reviewing Branches](docs/review.md) |
| Internal architecture and state model | [ARCHITECTURE.md](ARCHITECTURE.md) |
| Project website | [sikula.ai](https://sikula.ai) |

## Safety, Privacy, And Auditability

Sikula runs locally in your repository and uses git worktrees by default. The LLM provider you configure determines what task, prompt, source, and diff context may be sent outside your machine.

Task state is useful for debugging and audit, but it can contain prompts, source excerpts, build logs, provider output, and sensitive project context. Review and redact `sikula show <task-id>` output before sharing it publicly.

`sikula summary <task-id>` is the bounded public handoff projection. It reads
state without modifying it and omits raw audit text and unsafe path metadata.

See [Sandbox](docs/sandbox.md), [SECURITY.md](SECURITY.md), and [PRIVACY.md](PRIVACY.md).

## Contributing

Sikula is a maintainer-led project. Feedback, bug reports, task-result reports, documentation fixes, and small corrections are especially helpful.

For code changes beyond small fixes, please open an issue or discussion before starting so we can align on scope and keep the project focused.

Pull request contributions require the [CLA](CLA.md). See [CONTRIBUTING.md](CONTRIBUTING.md) for contributor setup and development guidelines.

## Security

Please do not report vulnerabilities through public issues. Use GitHub private vulnerability reporting, or email `contact@sikula.ai` if the private flow is unavailable. See [SECURITY.md](SECURITY.md).

## License

Sikula is licensed under [AGPL-3.0-only](LICENSE).
See [NOTICE](NOTICE) for copyright and attribution information.
