API Reference
rigger
Rigger — a declarative agent harness framework.
Public API re-exports. All internal modules use a leading underscore;
import from rigger directly for the stable surface.
Usage::
from rigger import Harness, Task, ClaudeCodeBackend
registry = _LazyRegistry()
module-attribute
Module-level registry singleton. Pre-populated with all built-in implementations.
ComponentConfig
dataclass
HarnessConfig
dataclass
Parsed harness.yaml configuration.
Source code in src/rigger/_config.py
RunConfig
dataclass
Loop control parameters from the run: YAML section.
Source code in src/rigger/_config.py
Callbacks
dataclass
Hook points for the canonical loop.
Each callback returns Action | None. Returning None is
equivalent to Action.CONTINUE.
Source code in src/rigger/_harness.py
Harness
Orchestration loop composing dimension plugins + AgentBackend.
Constructor wires the plugins; run() executes the canonical loop;
step methods are public for custom loops.
Source code in src/rigger/_harness.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | |
load_state()
Load state from StateStore if present, else from .harness/state.json.
select_tasks(max_count=1)
provision()
assign_task(task)
check_constraints()
dispatch(task)
async
verify(result)
persist(state)
Write .harness/state.json and call StateStore.save() if present.
harvest(result, project_root)
Post-process a dispatch result before verification.
Default implementation is passthrough. Override or replace for custom artifact collection, metric computation, or result enrichment.
Called by run() and run_once() between dispatch and verify.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
TaskResult
|
TaskResult from dispatch. |
required |
project_root
|
Path
|
The project directory. |
required |
Returns:
| Type | Description |
|---|---|
TaskResult
|
Possibly-modified TaskResult. |
Source code in src/rigger/_harness.py
scan_entropy()
Call each EntropyDetector.scan() and flatten results.
write_constraints(project_root=None, *, results=None)
Merge constraint metadata and write/delete .harness/constraints.json.
Public step method for custom loops. If results are not provided,
calls check_constraints() to obtain them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path | None
|
Target directory (defaults to |
None
|
results
|
list[VerifyResult] | None
|
Pre-computed constraint results. When |
None
|
Source code in src/rigger/_harness.py
dispatch_parallel(batch, epoch_state, callbacks=None, provision_results=None)
async
Dispatch multiple tasks to parallel agents in isolated workspaces.
Each task runs in its own workspace created by the WorkspaceManager.
Uses asyncio.gather(return_exceptions=True) so all agents are
independent — a failure in one does not cancel others.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch
|
list[Task]
|
Tasks to execute in parallel. |
required |
epoch_state
|
EpochState
|
Current epoch state (for branch naming). |
required |
callbacks
|
Callbacks | None
|
Optional hook points (on_task_complete checked per task). |
None
|
provision_results
|
list[ProvisionResult] | None
|
Pre-computed provision results to copy into worktrees. |
None
|
Returns:
| Type | Description |
|---|---|
list[TaskResult]
|
Tuple of (results, halt_requested). Results are in the same order |
bool
|
as the input batch. halt_requested is True if any callback returned HALT. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no workspace_manager is configured. |
Source code in src/rigger/_harness.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | |
run(max_epochs=1, max_retries=3, stop_when=all_tasks_done, callbacks=None, *, force_lock=False)
async
Execute the canonical epoch loop.
Single task per epoch with VerifyAction routing. Returns final
EpochState. Acquires .harness/harness.lock for the duration
of the run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_epochs
|
int
|
Maximum number of epochs to execute. |
1
|
max_retries
|
int
|
Maximum retries per task on RETRY action. |
3
|
stop_when
|
Callable[[EpochState], bool]
|
Predicate checked after each epoch; breaks if True. |
all_tasks_done
|
callbacks
|
Callbacks | None
|
Optional hook points for loop control. |
None
|
force_lock
|
bool
|
Override an existing lock file. |
False
|
Returns:
| Type | Description |
|---|---|
EpochState
|
Final EpochState after loop terminates. |
Raises:
| Type | Description |
|---|---|
HarnessAlreadyRunning
|
If another instance holds the lock. |
Source code in src/rigger/_harness.py
run_once(task, callbacks=None, *, force_lock=False)
async
Single-task event-driven mode. No persist/entropy — caller manages state.
Acquires .harness/harness.lock for the duration of the run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
Task
|
The task to execute. |
required |
callbacks
|
Callbacks | None
|
Optional hook points. |
None
|
force_lock
|
bool
|
Override an existing lock file. |
False
|
Returns:
| Type | Description |
|---|---|
TaskResult
|
TaskResult after dispatch and verification. |
Raises:
| Type | Description |
|---|---|
HarnessAlreadyRunning
|
If another instance holds the lock. |
Source code in src/rigger/_harness.py
run_sync(max_epochs=1, max_retries=3, stop_when=all_tasks_done, callbacks=None, *, force_lock=False)
Synchronous convenience wrapper around run().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_epochs
|
int
|
Maximum number of epochs. |
1
|
max_retries
|
int
|
Maximum retries per task on RETRY action. |
3
|
stop_when
|
Callable[[EpochState], bool]
|
Stop predicate. |
all_tasks_done
|
callbacks
|
Callbacks | None
|
Optional hook points. |
None
|
force_lock
|
bool
|
Override an existing lock file. |
False
|
Returns:
| Type | Description |
|---|---|
EpochState
|
Final EpochState. |
Raises:
| Type | Description |
|---|---|
HarnessAlreadyRunning
|
If another instance holds the lock. |
Source code in src/rigger/_harness.py
HarnessAlreadyRunning
LockInfo
dataclass
AgentBackend
Bases: Protocol
The opaque coding agent — the BLACK BOX.
execute() takes ONLY project_root (Task 1.4, F5). The agent navigates the filesystem using its own tools. Task assignment and context files are already written to disk by TaskSource and ContextSource.
SDK CONFIGURATION (Task 1.17): - Backend constructor owns static configuration (model, MCP servers, permissions, system prompt, setting_sources). - REQUIRED: setting_sources=["project"] must be set for filesystem- provisioned context (AGENTS.md, CLAUDE.md) to be loaded by the SDK. - Dynamic per-epoch configuration (tool restrictions, iteration limits) flows through .harness/constraints.json, which the backend reads inside execute().
LIFECYCLE (Task 5.1): - MCP server lifecycle is owned by the backend constructor. - Per-harness infrastructure uses Python context managers. - Per-worktree infrastructure uses WorkspaceManager decorators.
Source code in src/rigger/_protocols.py
execute(project_root)
async
Execute in a fresh context. The agent navigates the environment.
ASYNC (Task 1.15): The Claude Agents SDK is natively async. This call may take minutes to hours. The async contract frees the event loop for parallel dispatch, health checks, and other concurrent work.
The backend creates a fresh SDK client per call, reading the latest .harness/constraints.json for dynamic configuration.
Source code in src/rigger/_protocols.py
Constraint
Bases: Protocol
AC: Enforces architectural invariants.
Constraints run PRE-dispatch (CHECK_PRE) and POST-dispatch (CHECK_POST). Pre-dispatch constraint results with metadata are merged and written to .harness/constraints.json for the backend to read (Task 1.17).
Only Constraints produce metadata for .harness/constraints.json. Verifiers do NOT — they influence the NEXT epoch via StateStore, not the current epoch's backend configuration (Task 1.26 temporal model).
Source code in src/rigger/_protocols.py
ContextSource
Bases: Protocol
CP: Prepares one aspect of the agent's information environment.
A ContextSource discovers, verifies, or creates filesystem artifacts that provide context to the coding agent. The agent finds and reads these artifacts during execution; the ContextSource ensures they exist.
DELIVERY BOUNDARY (Task 1.18, formalized in Task 5.11): ContextSource.gather() provisions DISCOVERABLE content — artifacts that the agent MAY find and read through its own tools during execution. It does NOT provision GUARANTEED-IN-PROMPT content.
The guarantee of prompt inclusion is a delivery concern owned by: - AgentBackend: for always-loaded files (CLAUDE.md, AGENTS.md) via backend-specific mechanisms (e.g., setting_sources=["project"]) - TaskSource: for task specifications that may include embedded domain context (Task.description dual-use, Task 1.18 Section 5)
FILESYSTEM SCOPE (Task 5.11): gather() writes to project_root/ (or subdirectories thereof). It MUST NOT write to .harness/ — that directory is Rigger-managed and follows a versioned bilateral protocol (Task 5.3).
LIFECYCLE: This protocol has NO lifecycle hooks (Task 5.1 decision). Setup and teardown of infrastructure is handled by: - Python context managers for per-harness scope - WorkspaceManager decorators for per-worktree scope
Single-method protocol validated in Task 1.1.
Source code in src/rigger/_protocols.py
gather(project_root)
Ensure source files are ready and return what was prepared.
The returned files are DISCOVERABLE — the agent may find and read them via its own tools. There is no guarantee that any specific file will appear in the agent's prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
The project directory (main root or worktree). |
required |
Returns:
| Type | Description |
|---|---|
ProvisionResult
|
ProvisionResult with discovered files and capability metadata. |
Source code in src/rigger/_protocols.py
EntropyDetector
Bases: Protocol
EM: Detects drift, degradation, and entropy.
Source code in src/rigger/_protocols.py
StateStore
Bases: Protocol
SC: Persists and restores state across epochs.
Source code in src/rigger/_protocols.py
load(project_root)
TaskSource
Bases: Protocol
TD: Provides the next task(s) to execute.
Source code in src/rigger/_protocols.py
pending(project_root)
Verifier
Bases: Protocol
FL: Checks agent output against quality criteria.
Source code in src/rigger/_protocols.py
WorkspaceManager
Bases: Protocol
Creates and manages isolated execution environments for parallel agents.
Infrastructure protocol — NOT one of the 6 harness dimensions. Provides filesystem isolation so each parallel agent operates on its own project_root without interfering with other agents.
Implementations: - IndependentBranchManager: branch-per-task, push as PR (DEFAULT) - GitWorktreeManager: git worktrees with sequential merge back - IndependentDirManager: directory copies (non-git)
Source: Task 1.13 (parallel dispatch design), Task 5.6 (validation).
Source code in src/rigger/_protocols.py
create(main_root, task, branch_name)
Create an isolated workspace for one agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
main_root
|
Path
|
The main project root directory. |
required |
task
|
Task
|
The task to be executed in this workspace. |
required |
branch_name
|
str
|
Branch name for git-based managers (may be ignored by non-git implementations). |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the isolated workspace — becomes the agent's project_root. |
Source code in src/rigger/_protocols.py
merge(worktree, main_root)
Merge or publish changes from a workspace.
CONSTRAINT: merge() MUST NOT modify main_root beyond the merge/push operation itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
worktree
|
Path
|
Path to the isolated workspace. |
required |
main_root
|
Path
|
The main project root directory. |
required |
Returns:
| Type | Description |
|---|---|
MergeResult
|
MergeResult with success status and conflict information. |
Source code in src/rigger/_protocols.py
ContextProvisioner
dataclass
Aggregates multiple ContextSource instances into a single ProvisionResult.
Holds a flat list of ContextSource objects — no subclasses, no type hierarchy, no participation-mode distinction at the type level. Active provisioners and registration stubs are treated uniformly: call gather(), merge results.
Design decisions (Task 1.7): 1. Files are deduplicated by resolved path (preserve first-seen order). 2. Capabilities are concatenated in source order (no dedup). 3. Failing sources are logged and skipped (fail-open default). Use CriticalSource wrapper for fail-stop override. 4. Sources are called sequentially in list order.
Source code in src/rigger/_provisioner.py
provision(project_root)
Call gather() on each source, merge results into one ProvisionResult.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
The project directory. |
required |
Returns:
| Type | Description |
|---|---|
ProvisionResult
|
Aggregated ProvisionResult with deduplicated files and |
ProvisionResult
|
concatenated capabilities. |
Source code in src/rigger/_provisioner.py
CriticalSource
Wrapper that makes a ContextSource's failure abort provision().
When a CriticalSource's gather() fails, the exception propagates instead of being swallowed. Use this when a source's absence makes the agent's context dangerously incomplete.
The provisioner checks isinstance(source, CriticalSource) before catching exceptions. This is a type-level check, not a protocol method — the ContextSource protocol remains single-method.
Usage::
provisioner = ContextProvisioner(sources=[
CriticalSource(InitializerProgressSource()), # fail-stop
ExternalIssueTrackerSource("PROJ-42"), # fail-open
])
Source code in src/rigger/_provisioner.py
Registry
Maps (protocol, name) pairs to implementation classes.
Built-in implementations are registered at construction time.
Third-party plugins are discovered lazily from
importlib.metadata.entry_points(group="rigger.{protocol}").
Source code in src/rigger/_registry.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
register(protocol, name, cls)
Register a class under a protocol/name pair.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol
|
str
|
Protocol group name (e.g. |
required |
name
|
str
|
Config name (e.g. |
required |
cls
|
type
|
The implementation class. |
required |
Source code in src/rigger/_registry.py
get(protocol, name)
Look up a class by protocol and config name.
Plugins override built-ins (with a warning logged on first load).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol
|
str
|
Protocol group name. |
required |
name
|
str
|
Config name. |
required |
Returns:
| Type | Description |
|---|---|
type
|
The implementation class. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no implementation is registered for the given protocol/name combination. |
Source code in src/rigger/_registry.py
create(protocol, name, **kwargs)
Instantiate an implementation from config parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol
|
str
|
Protocol group name. |
required |
name
|
str
|
Config name. |
required |
**kwargs
|
Any
|
Constructor arguments forwarded to the class. |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
An instance of the looked-up class. |
Source code in src/rigger/_registry.py
available(protocol)
Return sorted list of available config names for a protocol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol
|
str
|
Protocol group name. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of registered config names. |
Source code in src/rigger/_registry.py
FilesystemEntropyTaskSource
Reads entropy tasks from partitioned files in .harness/entropy/.
On initialization, migrates legacy pending_tasks.json to
the partitioned format and cleans up orphaned temp files.
Partitions are read in sorted order (oldest first by filename
timestamp). mark_complete() removes tasks from their
partition, deleting empty partition files.
Source code in src/rigger/_schema.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | |
pending(project_root)
Return all pending entropy tasks across partitions, oldest first.
mark_complete(task_id, result=None)
Remove a completed task from its partition.
Scans partitions for the task_id. If removal leaves the partition empty, the file is deleted. Otherwise, the partition is atomically rewritten.
Source code in src/rigger/_schema.py
Action
EpochState
dataclass
Externalized state readable by the loop controller.
Serialized to .harness/state.json by the harness loop. epoch=0 is the initial state, semantically equivalent to a missing state.json file.
Source code in src/rigger/_types.py
MergeResult
dataclass
Outcome of merging/publishing worktree changes.
Used by WorkspaceManager.merge(). Captures success status, merged commits, conflict information, and diagnostic metadata.
Source code in src/rigger/_types.py
ProvisionResult
dataclass
What a ContextSource prepared for the agent.
Two field categories
files: Filesystem paths written or verified on disk. capabilities: Human-readable descriptions of non-filesystem provisions.
Source code in src/rigger/_types.py
Task
dataclass
A unit of work for an agent to execute.
Serialized to .harness/current_task.json by the harness loop. The backend reads this from disk — the harness does NOT pass it via function args.
Source code in src/rigger/_types.py
TaskResult
dataclass
Observable side effects of an agent's execution.
Constructed by AgentBackend.execute() or by the harness loop for error/halt scenarios. The status field is mutable — the canonical loop updates it after verification.
Source code in src/rigger/_types.py
VerifyAction
Bases: Enum
What the harness should do after verification.
Used by VerifyResult.action to communicate routing intent: ACCEPT: Checks passed; proceed to next epoch. RETRY: Checks failed; send feedback and re-dispatch. BLOCK: Hard gate; cannot proceed (constraint violation). ESCALATE: Retry budget exhausted; notify human operator.
Source code in src/rigger/_types.py
VerifyResult
dataclass
Outcome of verification or constraint check.
Used by Verifier.verify() and Constraint.check(). The post_init enforces the invariant: passed=True → ACCEPT, passed=False → non-ACCEPT.
Source code in src/rigger/_types.py
__post_init__()
Enforce passed/action consistency invariant.
Source code in src/rigger/_types.py
ClaudeCodeBackend
AgentBackend implementation for the Claude Agent SDK.
Wraps the Claude Agent SDK to execute a coding agent in a fresh context per epoch. Prompt construction, SDK configuration, and result parsing are entirely internal to this class.
The agent is a BLACK BOX. This backend:
- READS
.harness/files written by the Rigger loop - CONSTRUCTS prompt templates from
.harness/data - CONFIGURES the SDK client (setting_sources, tools, permissions)
- EXECUTES the agent via the SDK
- PARSES observable side effects into TaskResult
It MUST NOT:
- Write to
.harness/(Rigger-owned) - Model agent-internal decision-making
- Pass context via any channel other than filesystem + SDK config
Required convention: setting_sources=["project"] is hardcoded for
filesystem-provisioned context (AGENTS.md, CLAUDE.md) to be loaded
by the agent. (Task 5.4 D3, Task 5.9).
Source: Task 5.4, Task 5.9.
Source code in src/rigger/backends/claude_code.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | |
__init__(model='claude-sonnet-4-6', *, system_prompt=None, permission_mode='bypassPermissions', mcp_servers=None, allowed_tools=None, disallowed_tools=None, max_turns=None, hooks=None, sandbox=None, env=None, add_dirs=None, prompt_templates=None)
Initialize the ClaudeCodeBackend.
All parameters are STATIC backend configuration (Task 1.17 §4.1).
Dynamic per-epoch configuration flows through
.harness/constraints.json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str
|
Claude model to use. |
'claude-sonnet-4-6'
|
system_prompt
|
str | None
|
Optional system prompt override. Most harnesses should leave this None and use CLAUDE.md/AGENTS.md via setting_sources instead. |
None
|
permission_mode
|
str
|
Tool permission mode for automated execution. |
'bypassPermissions'
|
mcp_servers
|
dict[str, Any] | None
|
MCP server configurations. Static for MVP. |
None
|
allowed_tools
|
list[str] | None
|
Constructor-level tool allowlist (the FLOOR). |
None
|
disallowed_tools
|
list[str] | None
|
Constructor-level tool denylist. |
None
|
max_turns
|
int | None
|
Constructor-level turn limit. |
None
|
hooks
|
dict[str, Any] | None
|
SDK lifecycle hooks. |
None
|
sandbox
|
dict[str, Any] | None
|
Sandbox configuration. |
None
|
env
|
dict[str, str] | None
|
Environment variables for the agent subprocess. |
None
|
add_dirs
|
list[str | Path] | None
|
Additional directories the agent can access. |
None
|
prompt_templates
|
PromptTemplateSet | None
|
Custom prompt template set. Defaults to the built-in templates shipped with this backend. |
None
|
Source code in src/rigger/backends/claude_code.py
execute(project_root)
async
Execute a coding agent in a fresh context.
Implements the AgentBackend protocol. Sequence (Task 5.4 §1.2):
- Read .harness/ files (task, state, constraints)
- Determine prompt phase (initializer / coding / error_recovery)
- Build SDK options (merge constructor + constraints)
- Snapshot pre-execution git state
- Build prompt and execute agent
- Diff git state to detect changes
- Parse and return TaskResult
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
The project directory. |
required |
Returns:
| Type | Description |
|---|---|
TaskResult
|
TaskResult with observable side effects. |
Source code in src/rigger/backends/claude_code.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | |
BranchPolicyConstraint
Validates branch naming convention and blocks commits to protected branches.
Returns BLOCK if the current branch is protected, or if a
required_prefix is configured and the branch doesn't match.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protected_branches
|
list[str] | None
|
Branch names that must not receive direct commits
(default: |
None
|
required_prefix
|
str | None
|
If set, non-protected branches must start with this
prefix (e.g. |
None
|
Source code in src/rigger/constraints/branch_policy.py
check(project_root)
Check the current git branch against the policy.
Source code in src/rigger/constraints/branch_policy.py
ToolAllowlistConstraint
Emits allowed_tools and/or disallowed_tools metadata.
This constraint always passes — it is metadata-emitting, not blocking.
The emitted metadata flows through the merge algorithm (Task 1.26) into
.harness/constraints.json for the backend to read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
allowed
|
list[str] | None
|
Tool names/patterns the agent MAY use. Empty means no opinion. |
None
|
disallowed
|
list[str] | None
|
Tool names/patterns the agent MUST NOT use. Empty means no opinion. |
None
|
Source code in src/rigger/constraints/tool_allowlist.py
check(project_root)
Return tool restriction metadata. Always passes.
Source code in src/rigger/constraints/tool_allowlist.py
AgentsMdContextSource
Generates or updates an AGENTS.md file from a template.
The template supports variable substitution with {task},
{constraints}, and {context} placeholders. Unresolved
placeholders are left as-is.
The template argument may be either an inline string or a
path to a template file. If it starts with / or ends with
.md / .txt, it is treated as a file path; otherwise as
an inline template string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template
|
str
|
Inline template string or path to a template file. |
required |
output
|
str
|
Output filename relative to project root (default: |
'AGENTS.md'
|
variables
|
dict[str, str] | None
|
Optional dict of variable substitutions beyond the standard ones. |
None
|
Source code in src/rigger/context_sources/agents_md.py
gather(project_root)
Write AGENTS.md to project root from template, return its path.
Reads the template (from file or inline), applies variable
substitution, and writes the output file. Returns the path
in ProvisionResult.files.
Source code in src/rigger/context_sources/agents_md.py
FileTreeContextSource
Verifies a directory tree exists and reports its file paths as context.
Does NOT copy files — they are already in the project. This source
validates presence and returns discovered paths as a ProvisionResult.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str
|
Relative path from project root to the directory tree. |
required |
required
|
bool
|
If True (default), log a warning when the directory is missing. |
True
|
Source code in src/rigger/context_sources/file_tree.py
gather(project_root)
Return paths to all files under the configured root directory.
If the directory does not exist and required is True, logs a
warning and returns an empty result. Non-required missing directories
return silently.
Source code in src/rigger/context_sources/file_tree.py
McpCapabilityContextSource
Reports MCP tool/server availability as a capability description.
This is a registration stub — the MCP server is configured at SDK
client creation time. gather() writes a capabilities file and
returns a capability string for observability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
MCP server name (e.g. |
required |
description
|
str
|
Human-readable capability description. |
''
|
output
|
str
|
Output path relative to project root
(default: |
'.harness/capabilities.md'
|
Source code in src/rigger/context_sources/mcp_capability.py
gather(project_root)
Write capabilities file and return path + capability string.
Creates or appends to the capabilities file at the configured output path. Returns the file path and a capability description for observability.
Source code in src/rigger/context_sources/mcp_capability.py
StaticFilesContextSource
Copies pre-computed files from a configured path into the project.
The source may be a single file or a directory. When the source is a directory, all files within it are copied recursively to the destination, preserving the relative directory structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Absolute or relative path to the source file or directory. |
required |
destination
|
str
|
Relative path within the project root for output. |
required |
Source code in src/rigger/context_sources/static_files.py
gather(project_root)
Copy source files to destination under project root, return paths.
If the source does not exist, logs a warning and returns an empty result.
Source code in src/rigger/context_sources/static_files.py
DocStalenessEntropyDetector
Checks file modification dates against an age threshold.
Scans files matching the configured glob patterns and returns a
remediation Task for each file that hasn't been modified within
max_age_days.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
patterns
|
list[str]
|
Glob patterns to match (e.g. |
required |
max_age_days
|
int
|
Maximum age in days before a file is considered stale (default 30). |
30
|
Source code in src/rigger/entropy_detectors/doc_staleness.py
scan(project_root)
Find files exceeding the staleness threshold.
Source code in src/rigger/entropy_detectors/doc_staleness.py
ShellCommandEntropyDetector
Runs an arbitrary shell command and parses JSON stdout as tasks.
The command should output a JSON array of objects, each with at least
a description field. An optional priority field is stored in
task metadata.
Expected JSON format::
[{"description": "Fix stale docs", "priority": "high"}, ...]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Shell command to execute. |
required |
timeout
|
int
|
Maximum seconds to wait for the command (default 120). |
120
|
Source code in src/rigger/entropy_detectors/shell_command.py
scan(project_root)
Run the command and parse JSON output into tasks.
Source code in src/rigger/entropy_detectors/shell_command.py
HarnessDirStateStore
Persists EpochState via .harness/state.json.
Thin wrapper around rigger._schema.read_state() and
write_state(). This is functionally equivalent to the
default behavior when no StateStore is configured, but
exists as an explicit class for the declarative registry.
Source code in src/rigger/state_stores/harness_dir.py
load(project_root)
JsonFileStateStore
Persists EpochState to a user-specified JSON file.
The file path can be absolute or relative. Relative paths are resolved
against project_root. Writes are atomic (temp file + os.replace).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the JSON state file. |
required |
Source code in src/rigger/state_stores/json_file.py
load(project_root)
Load state from the JSON file, returning defaults if missing.
Source code in src/rigger/state_stores/json_file.py
save(project_root, state)
Atomically write state to the JSON file.
Source code in src/rigger/state_stores/json_file.py
AtomicIssueTaskSource
One issue = one task, no decomposition.
Fetches a single issue from GitHub or Linear and surfaces it as the
sole pending task. mark_complete closes or transitions the issue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
|
required |
issue_id
|
str
|
Issue identifier. For GitHub: |
required |
api_key_env
|
str
|
Environment variable containing the API token. |
''
|
repo
|
str
|
GitHub repo in |
''
|
Source code in src/rigger/task_sources/atomic_issue.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
pending(project_root)
Return the single issue as a Task, or empty if already done.
Source code in src/rigger/task_sources/atomic_issue.py
mark_complete(task_id, result)
Close the issue on the remote provider.
Source code in src/rigger/task_sources/atomic_issue.py
FileListTaskSource
Reads a JSON file with task objects; marks complete by updating status.
The JSON file must contain an array of objects, each with at least
id and description fields. An optional status field tracks
completion (defaults to "pending").
Example JSON::
[
{"id": "t1", "description": "Add login page", "status": "pending"},
{"id": "t2", "description": "Add tests", "status": "done"}
]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the JSON file (relative to project_root or absolute). |
required |
Source code in src/rigger/task_sources/file_list.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
pending(project_root)
Return tasks with status != "done", in array order.
Source code in src/rigger/task_sources/file_list.py
mark_complete(task_id, result)
Update the task's status to "done" in the JSON file.
Uses atomic write (write to temp file, then rename) to avoid partial writes on crash.
Source code in src/rigger/task_sources/file_list.py
JsonStoriesTaskSource
Reads a PRD-style JSON file with stories, one per cycle.
The JSON file must contain an object with a key (default "stories")
that maps to an array of story objects. Each story needs at least
id and description fields. An optional status field
tracks completion (defaults to "pending").
Example JSON::
{
"stories": [
{"id": "s1", "description": "User can sign up", "status": "pending"},
{"id": "s2", "description": "User can log in"}
]
}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the JSON file (relative to project_root or absolute). |
required |
key
|
str
|
JSON key containing the stories array. |
'stories'
|
Source code in src/rigger/task_sources/json_stories.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
pending(project_root)
Return incomplete stories in order, one per cycle.
Source code in src/rigger/task_sources/json_stories.py
mark_complete(task_id, result)
Mark the story as completed in the JSON file.
Uses atomic write (write to temp file, then rename).
Source code in src/rigger/task_sources/json_stories.py
LinearTaskSource
Queries Linear API for issues matching filters, ordered by priority.
Uses httpx for API calls (no Linear SDK dependency). The API key is read from an environment variable at call time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team
|
str
|
Linear team key (e.g., |
required |
project
|
str | None
|
Optional project name filter. |
None
|
labels
|
list[str] | None
|
Optional label name filter. |
None
|
api_key_env
|
str
|
Environment variable containing the Linear API key. |
'LINEAR_API_KEY'
|
Source code in src/rigger/task_sources/linear.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
pending(project_root)
Return Linear issues ordered by priority (urgent first).
Source code in src/rigger/task_sources/linear.py
mark_complete(task_id, result)
Transition issue to the team's 'Done' state.
Source code in src/rigger/task_sources/linear.py
CiStatusVerifier
Checks GitHub Actions / CI pipeline status via gh CLI.
Polls CI status for the current (or configured) branch. All checks
passed maps to ACCEPT, failed maps to action_on_fail, pending
triggers a polling loop with configurable backoff.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
branch
|
str | None
|
Branch to check (default: infer from current HEAD). |
None
|
timeout
|
int
|
Maximum seconds to poll (default 600). |
600
|
poll_interval
|
int
|
Seconds between polls (default 30). |
30
|
action_on_fail
|
str
|
VerifyAction when CI fails (default RETRY). |
'retry'
|
Source code in src/rigger/verifiers/ci_status.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
verify(project_root, result)
Poll CI status until terminal state or timeout.
Source code in src/rigger/verifiers/ci_status.py
LintVerifier
Runs a linter command; zero errors means ACCEPT, errors means RETRY.
Captures stdout/stderr and reports error count in VerifyResult.details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
list[str]
|
Linter command to run (as a list of args). |
required |
timeout
|
int
|
Maximum seconds to wait (default 120). |
120
|
action_on_fail
|
str
|
VerifyAction when linting fails (default RETRY). |
'retry'
|
Source code in src/rigger/verifiers/lint.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
verify(project_root, result)
Run the linter and return a VerifyResult based on exit code.
Source code in src/rigger/verifiers/lint.py
RatchetVerifier
Runs a pipeline of commands in sequence; ACCEPT only when all pass.
Each step is a {command, name} pair. Stops at the first failure
and returns RETRY with the failure output. ACCEPT only when every
step succeeds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
steps
|
list[dict[str, Any]]
|
List of step dicts, each with |
required |
timeout
|
int
|
Maximum seconds per step (default 600). |
600
|
Source code in src/rigger/verifiers/ratchet.py
verify(project_root, result)
Run each step in sequence; RETRY on first failure, ACCEPT on all-green.
Source code in src/rigger/verifiers/ratchet.py
TestSuiteVerifier
Runs a shell command (pytest, npm test, etc.); pass/fail from exit code.
Exit code 0 maps to ACCEPT. Non-zero maps to action_on_fail
(default RETRY). Captures stdout/stderr in VerifyResult.details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
list[str]
|
Shell command to run (as a list of args). |
required |
timeout
|
int
|
Maximum seconds to wait for the command (default 300). |
300
|
action_on_fail
|
str
|
VerifyAction when the command fails (default RETRY). |
'retry'
|
Source code in src/rigger/verifiers/test_suite.py
verify(project_root, result)
Run the test command and return a VerifyResult based on exit code.
Source code in src/rigger/verifiers/test_suite.py
GitWorktreeManager
Workspace isolation via git worktrees with sequential merge.
Each agent works on its own branch in an isolated worktree.
On completion, the branch is merged back into the main root
via git merge --no-ff.
WARNING: Sequential merge creates PRIORITY-COUPLING. Tasks merged first always succeed; later tasks bear merge conflict risk.
Worktrees are created under <parent>/.rigger-worktrees/<branch_name>.
Minimum git version: 2.17 (for git worktree remove).
Source code in src/rigger/workspace/git_worktree.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
create(main_root, task, branch_name)
Create a git worktree with a new branch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
main_root
|
Path
|
The main project root (must be a git repo with at least one commit). |
required |
task
|
Task
|
The task to execute (used for logging context). |
required |
branch_name
|
str
|
Branch name for the new worktree. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created worktree directory. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the repo has no commits. |
CalledProcessError
|
If worktree creation fails. |
Source code in src/rigger/workspace/git_worktree.py
merge(worktree, main_root)
Merge worktree branch into main_root via git merge --no-ff.
On conflict, aborts the merge and returns conflict details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
worktree
|
Path
|
Path to the worktree to merge from. |
required |
main_root
|
Path
|
The main project root to merge into. |
required |
Returns:
| Type | Description |
|---|---|
MergeResult
|
MergeResult with success status and any conflict information. |
Source code in src/rigger/workspace/git_worktree.py
cleanup(worktree)
Remove worktree and its branch. Idempotent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
worktree
|
Path
|
Path to the worktree to remove. |
required |
Source code in src/rigger/workspace/git_worktree.py
IndependentBranchManager
Default WorkspaceManager: branch-per-task, push as PR.
Each agent works on its own branch in an isolated worktree. On completion, the branch is pushed to the remote. No local merge into main_root. PRs are merged by human review or CI.
Matches: C2 (OpenAI), C6 (Spotify), C14 (Composio), C15 (Open SWE). This is the corpus-dominant pattern (4/6 parallel sources).
Worktrees are created under <parent>/.rigger-worktrees/<branch_name>.
Minimum git version: 2.17 (for git worktree remove).
Source code in src/rigger/workspace/independent_branch.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
__init__(*, remote='origin', create_pr=True, cleanup_branch=False)
Initialize the manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
remote
|
str
|
Git remote name for pushing branches. |
'origin'
|
create_pr
|
bool
|
Whether to create a GitHub PR after pushing via
|
True
|
cleanup_branch
|
bool
|
Whether to delete the local branch on cleanup. Default False since branches are the deliverable (PRs). |
False
|
Source code in src/rigger/workspace/independent_branch.py
create(main_root, task, branch_name)
Create a git worktree with a new branch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
main_root
|
Path
|
The main project root (must be a git repo with at least one commit). |
required |
task
|
Task
|
The task to execute (used for logging context). |
required |
branch_name
|
str
|
Branch name for the new worktree. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created worktree directory. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the repo has no commits. |
CalledProcessError
|
If worktree creation fails. |
Source code in src/rigger/workspace/independent_branch.py
merge(worktree, main_root)
Push branch to remote. No local merge.
Pushes the worktree's branch to the configured remote. Optionally
creates a GitHub PR via gh pr create. PR creation failure is
non-fatal since the branch is already pushed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
worktree
|
Path
|
Path to the worktree to push from. |
required |
main_root
|
Path
|
The main project root (unused — no local merge). |
required |
Returns:
| Type | Description |
|---|---|
MergeResult
|
MergeResult with success status and diagnostic metadata. |
Source code in src/rigger/workspace/independent_branch.py
cleanup(worktree)
Remove worktree and optionally its branch. Idempotent.
By default, preserves the branch since it's the deliverable
(pushed as a PR). Set cleanup_branch=True to also delete it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
worktree
|
Path
|
Path to the worktree to remove. |
required |
Source code in src/rigger/workspace/independent_branch.py
IndependentDirManager
Workspace isolation via directory copies.
Each agent works on a full copy of the project in a temp directory. On completion, the copy is merged back by overwriting the main root. No git operations — works with any project.
Use this when git worktrees are unavailable or undesired (e.g., non-git projects, CI environments without git, or when branch management overhead is unwanted).
Source code in src/rigger/workspace/independent.py
__init__(*, prefix='rigger-')
Initialize the manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Prefix for temporary directory names. |
'rigger-'
|
create(main_root, task, branch_name)
Copy the project to a temporary directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
main_root
|
Path
|
The main project root to copy. |
required |
task
|
Task
|
The task to execute (used for logging context). |
required |
branch_name
|
str
|
Ignored — present for protocol compatibility. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the temporary copy. |
Source code in src/rigger/workspace/independent.py
merge(worktree, main_root)
Copy workspace contents back to the main root.
Overwrites files in main_root with those from the workspace. Does not delete files in main_root that don't exist in the workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
worktree
|
Path
|
Path to the workspace copy. |
required |
main_root
|
Path
|
The main project root to update. |
required |
Returns:
| Type | Description |
|---|---|
MergeResult
|
MergeResult with success=True on completion. |
Source code in src/rigger/workspace/independent.py
cleanup(worktree)
Remove the temporary workspace directory. Idempotent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
worktree
|
Path
|
Path to the workspace to remove. |
required |
Source code in src/rigger/workspace/independent.py
build_harness(config, project_root=None)
Build a fully-wired Harness from a HarnessConfig.
Uses the global registry to instantiate all components by their
type config name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
HarnessConfig
|
Parsed YAML configuration. |
required |
project_root
|
Path | None
|
Project root directory. Defaults to config.config_dir. |
None
|
Returns:
| Type | Description |
|---|---|
Harness
|
A configured |
Raises:
| Type | Description |
|---|---|
KeyError
|
If a component type is not found in the registry. |
TypeError
|
If constructor parameters are invalid. |
Source code in src/rigger/_config.py
get_stop_predicate(name)
Map a stop_when config string to a callable predicate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
One of |
required |
Returns:
| Type | Description |
|---|---|
Callable[[EpochState], bool]
|
A predicate compatible with |
Raises:
| Type | Description |
|---|---|
ValueError
|
If name is not a recognized value. |
Source code in src/rigger/_config.py
load_config(path)
Parse a harness.yaml file into a HarnessConfig.
Performs environment variable interpolation on all string values and validates the top-level structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
Path to the YAML config file. |
required |
Returns:
| Type | Description |
|---|---|
HarnessConfig
|
Parsed and validated configuration. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the config file does not exist. |
ValueError
|
If the YAML structure is invalid. |
Source code in src/rigger/_config.py
all_tasks_done(state)
acquire_lock(project_root, *, force=False)
Create .harness/harness.lock, preventing concurrent runs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
Root of the project containing |
required |
force
|
bool
|
Override an existing lock (logs a warning). |
False
|
Returns:
| Type | Description |
|---|---|
LockInfo
|
The |
Raises:
| Type | Description |
|---|---|
HarnessAlreadyRunning
|
If a live lock is held and force is False. |
Source code in src/rigger/_lock.py
harness_lock(project_root, *, force=False)
Context manager that acquires the lock on entry and releases on exit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
Root of the project containing |
required |
force
|
bool
|
Override an existing lock. |
False
|
Yields:
| Type | Description |
|---|---|
LockInfo
|
The |
Raises:
| Type | Description |
|---|---|
HarnessAlreadyRunning
|
If a live lock is held and force is False. |
Source code in src/rigger/_lock.py
release_lock(project_root, lock_info)
Remove .harness/harness.lock if it matches lock_info.
Only deletes the lock if the on-disk instance_id matches
the one we hold, preventing accidental removal of another
instance's lock.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
Root of the project containing |
required |
lock_info
|
LockInfo
|
The |
required |
Source code in src/rigger/_lock.py
merge_metadata(results)
Merge metadata from multiple constraint results into a single config.
Deterministic: same inputs always produce same output regardless of constraint evaluation order. Achieved by commutative set operations for lists, commutative min() for scalars, and sorted output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
list[VerifyResult]
|
VerifyResult instances from Constraint.check() calls. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Merged metadata dict ready for .harness/constraints.json. |
Source code in src/rigger/_merge.py
write_entropy_tasks(project_root, tasks)
Write entropy tasks to a partitioned file in .harness/entropy/.
Creates .harness/entropy/tasks_{timestamp}_{uuid}.json with
atomic write semantics. Each file is an independent partition
that eliminates shared-mutable-file race conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
Root of the project. |
required |
tasks
|
list[Task]
|
Non-empty list of entropy tasks to write. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created partition file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If tasks list is empty. |