-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing
kstrl is run as a formal project: the process rules below are not suggestions, they are the mechanism that keeps an AI-built codebase trustworthy. PRs that skip them will be asked to redo the work.
- H1 - No self-review. AI-generated code is never gated by AI self-review. Every PR is reviewed by a human (or an independent review pipeline the human triggers). If you used an agent to write the change, say so.
- H2 - Calibration is the truth signal for prompts. Any change to an adversarial prompt body (architect, engineer, reviewer, security, distiller) must re-run the calibration suite and record the detection delta against the saved baseline. A prompt edit without a calibration check is treated as untested.
-
H3 - Prompt versioning. Every adversarial prompt declares a
*_PROMPT_VERSIONsemver next to its body, andtests/test_prompt_versions.pysnapshots each prompt as a(hash, version)tuple. Body, version, and snapshot always move together in one diff; the test suite AST-walks the package and fails on any unenrolled*_PROMPTconstant. - H4 - State what was tested vs assumed. Every PR description and every "done" claim lists what was actually exercised versus what is assumed. "Smoke passed" without saying what was checked is presence-testing, not behavior-testing.
The current Dark Factory cycle (tracker prefix R8; see Roadmap for the ID scheme) adds a fifth rule: no assumed thresholds. Numeric gates (coverage floors, mutation scores, autonomy entry counts, EWMA parameters) are placeholders until replayed against historical run data, and the replay result is recorded in the tracker doc.
-
from __future__ import annotationsat the top of every file; type hints on all signatures;T | NoneoverOptional[T]. -
@dataclassfor data containers (frozen=Truewhen immutable);Protocolfor interfaces. - snake_case functions, PascalCase classes, UPPER_SNAKE constants; absolute imports grouped stdlib / third-party / local.
- No bare
except:; no mutable default arguments; nopickleon untrusted data. - Atomic writes use
tempfile.mkstemp+os.replace; every subprocess has a bounded timeout; every config dataclass hasfrom_env()andload(root_dir). - Match the surrounding code's comment density and idiom. Comments state constraints the code cannot show, nothing else.
uv run pytest tests/ -v
uv run mypy kstrl/ --strict
uv run ruff check kstrl/ tests/CI runs these plus a spine job; the fast test tier must be green. If you
touch an adversarial prompt, also run calibration (H2) - note that it uses
real LLM calls and is opt-in via KSTRL_RUN_CALIBRATION=1.
- Adversarial mindset: when editing role prompts or role code, ask whether the change makes the role more skeptical or more eager to please. Prefer skeptical.
- Halt over heroics: fail loudly; never silently degrade.
- Audit trail: no silent code paths - decisions write records (findings, events, journal entries).
- Enforcement reads artifacts: gates run on diffs, lockfiles, and tool output in the mechanical verifier - never on agent self-report.
- Phase numbers are sticky: new pipeline phases take fractional numbers; existing numbering never shifts.
-
Budget respect: never bypass
max_adversarial_callsor token budgets without explicit opt-in.
- Read Vision and Philosophy and the current tracker, docs/dark-factory-roadmap.md.
- The R8 milestone lists open items; tracking issue #156 shows the dependency-ordered waves. Wave-1 items (policy envelope, health trending, ladder, inbox) are the most self-contained entry points.
- Check the item's "User decisions required" dependencies in the tracker - some items are blocked on owner decisions and will say so.
- Comment on the issue before starting so work is not duplicated.
- One tracker item (or one coherent slice of an L-sized item) per PR.
- The PR updates the tracker doc's status in the same diff (audit trail).
- The description covers: what changed, what was tested vs assumed (H4), and any deviation from the tracker's design with rationale.
- Docs-only changes are exempt from calibration but not from review.
Be direct, cite evidence, and treat skepticism as a courtesy - the whole project is built on adversarial review. Critique designs, not people.
The wiki orients; the repo governs. Canonical references: README - ARCHITECTURE - docs/