Loop API 參考 (Loop & Workflow)
boring.loop
Boring Loop State Machine V10.26
A refactored, state-pattern-based agent loop with clear separation of concerns.
Module Structure: - base.py: LoopState ABC and utilities - context.py: LoopContext shared state - states/: Individual state implementations - agent.py: StatefulAgentLoop context class
V10.26 Reorganization: - shadow_mode: Human-in-the-loop protection (moved from root) - workflow_manager: Workflow package management (moved from root) - workflow_evolver: Dynamic workflow evolution (moved from root) - background_agent: Async task execution (moved from root) - transactions: Git-based snapshot/rollback (moved from root)
StatefulAgentLoop
State-pattern-based autonomous agent loop (V10.23 Enhanced).
This class is the Context in the State Pattern - it holds the current state and shared data, delegating logic to states.
V10.23 Features: - Automatic session context syncing with intelligence modules - Memory compaction to prevent context bloat - Error/task/file access recording for pattern learning
Usage
loop = StatefulAgentLoop(model_name="gemini-2.0-flash") loop.run()
Source code in src/boring/loop/agent.py
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 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 | |
__init__(model_name=settings.DEFAULT_MODEL, use_cli=False, verbose=False, prompt_file=None, context_file=None, verification_level='STANDARD', interactive=False)
Initialize the agent loop with configuration.
Source code in src/boring/loop/agent.py
run()
Execute the main loop using state machine.
Source code in src/boring/loop/agent.py
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 | |
BackgroundTask
dataclass
Represents a background task.
Source code in src/boring/loop/background_agent.py
BackgroundTaskRunner
Manages background task execution using thread pool.
Features: - Non-blocking task submission - Status tracking - Result retrieval
Source code in src/boring/loop/background_agent.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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
submit(func, *args, name='Background task', **kwargs)
Submit a task for background execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable
|
Function to execute |
required |
name
|
str
|
Task name for display |
'Background task'
|
*args
|
Any
|
Arguments to pass to func |
()
|
**kwargs
|
Any
|
Keyword arguments to pass to func |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
task_id for tracking |
Source code in src/boring/loop/background_agent.py
get_status(task_id)
Get status of a task.
Source code in src/boring/loop/background_agent.py
get_result(task_id, timeout=None)
Wait for and get result of a task.
Source code in src/boring/loop/background_agent.py
list_tasks(status_filter=None)
List all tasks, optionally filtered by status.
Source code in src/boring/loop/background_agent.py
cancel(task_id)
Attempt to cancel a pending task.
Source code in src/boring/loop/background_agent.py
LoopState
Bases: ABC
Abstract base class for all loop states.
Each state encapsulates: 1. The logic to execute (handle) 2. The decision of what state comes next (next_state)
Usage
state = ThinkingState() state.handle(context) # Execute logic next_state = state.next_state(context) # Get transition
Source code in src/boring/loop/base.py
name
abstractmethod
property
Human-readable state name for logging/telemetry.
handle(context)
abstractmethod
Execute the state's logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
LoopContext
|
Shared mutable context containing all loop state |
required |
Returns:
| Type | Description |
|---|---|
StateResult
|
StateResult indicating outcome for transition logic |
Source code in src/boring/loop/base.py
next_state(context, result)
abstractmethod
Determine the next state based on context and execution result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
LoopContext
|
Current loop context |
required |
result
|
StateResult
|
Result from handle() execution |
required |
Returns:
| Type | Description |
|---|---|
Optional[LoopState]
|
Next state instance, or None to exit the loop |
Source code in src/boring/loop/base.py
on_enter(context)
LoopContext
dataclass
Shared mutable context passed between all states (V10.23 Enhanced).
This replaces the scattered instance variables in the old AgentLoop, providing a clean, explicit container for loop state.
V10.23 features: - Sliding window for error/task history - Memory usage tracking - Task context for RAG integration
Source code in src/boring/loop/context.py
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 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 | |
start_loop()
Reset per-loop state at beginning of each iteration.
Source code in src/boring/loop/context.py
start_state()
get_state_duration()
get_loop_duration()
increment_loop()
increment_retry()
can_retry()
should_continue()
mark_exit(reason)
record_error(error_type, error_msg, file_path='')
V10.23: Record an error with sliding window management.
Keeps only the most recent MAX_ERROR_HISTORY errors.
Source code in src/boring/loop/context.py
record_task(task_description, status='completed')
V10.23: Record a completed task with sliding window management.
Source code in src/boring/loop/context.py
record_file_access(file_path)
V10.23: Record file access for RAG context.
Source code in src/boring/loop/context.py
set_task_context(task_type, keywords=None)
V10.23: Set the current task context for RAG integration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_type
|
str
|
One of "debugging", "feature", "refactoring", "testing", "general" |
required |
keywords
|
list[str] | None
|
Keywords extracted from the current task |
None
|
Source code in src/boring/loop/context.py
get_recent_focus_files(limit=5)
V10.23: Get recently accessed files for RAG focus.
Source code in src/boring/loop/context.py
get_error_summary()
V10.23: Get summary of recent errors by type.
get_session_context_for_rag()
V10.23: Get session context formatted for RAG retriever.
Source code in src/boring/loop/context.py
estimate_memory_usage()
V10.23: Estimate memory usage of context data.
Source code in src/boring/loop/context.py
compact_if_needed(threshold_kb=1024)
V10.23: Compact history if memory exceeds threshold.
Returns:
| Type | Description |
|---|---|
bool
|
True if compaction was performed |
Source code in src/boring/loop/context.py
get_context_summary()
V10.23: Get a human-readable summary of context state.
Source code in src/boring/loop/context.py
AgentLoop
The main autonomous agent loop. Manages the lifecycle of Generate -> Backup -> Patch -> Verify -> Self-Correct.
V3.0 Features: - Memory System: Persistent state across loops - Advanced Verification: Linting + Testing - Extensions Support: context7, criticalthink
Source code in src/boring/loop/legacy.py
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 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 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | |
run(max_duration=None)
Start the main loop.
Source code in src/boring/loop/legacy.py
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 | |
OperationSeverity
Bases: Enum
Severity levels for operations.
Source code in src/boring/loop/shadow_mode.py
PendingOperation
dataclass
An operation awaiting human approval.
Source code in src/boring/loop/shadow_mode.py
ShadowModeGuard
Intercepts and validates operations before execution.
Modes (per user decision - ENABLED is default): - DISABLED: All operations auto-approved - ENABLED: Only HIGH/CRITICAL ops require approval - STRICT: ALL file modifications require approval
Design principles: - Read operations NEVER blocked (avoid alert fatigue) - Only side-effect operations need approval - Quick approve/reject via callback or queue
Source code in src/boring/loop/shadow_mode.py
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 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 | |
mode
property
writable
Get current protection mode.
__init__(project_root, mode=ShadowModeLevel.ENABLED, approval_callback=None, pending_file=None)
Initialize Shadow Mode guard.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
Project root directory |
required |
mode
|
ShadowModeLevel
|
Protection level (default ENABLED) |
ENABLED
|
approval_callback
|
ApprovalCallback | None
|
Sync callback for approval (returns bool) |
None
|
pending_file
|
Path | None
|
Path to save pending operations queue |
None
|
Source code in src/boring/loop/shadow_mode.py
check_operation(operation)
Check if an operation should be blocked for approval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
dict[str, Any]
|
Dict with 'name' and 'args' |
required |
Returns:
| Type | Description |
|---|---|
PendingOperation | None
|
PendingOperation if blocked, None if auto-approved |
Source code in src/boring/loop/shadow_mode.py
verify_system_integrity()
Check for silent modifications to protected files. V12.4 Security Feature.
Source code in src/boring/loop/shadow_mode.py
request_approval(pending)
Request approval for a pending operation.
Returns:
| Type | Description |
|---|---|
bool
|
True if approved, False if rejected/pending |
Source code in src/boring/loop/shadow_mode.py
approve_operation(operation_id, note=None)
Approve a pending operation by ID.
Returns:
| Type | Description |
|---|---|
bool
|
True if found and approved |
Source code in src/boring/loop/shadow_mode.py
reject_operation(operation_id, note=None)
Reject a pending operation by ID.
Returns:
| Type | Description |
|---|---|
bool
|
True if found and rejected |
Source code in src/boring/loop/shadow_mode.py
get_pending_operations()
clear_pending()
Clear all pending operations. Returns count cleared.
is_operation_approved(operation_id)
Check if an operation has been approved.
Returns:
| Type | Description |
|---|---|
bool | None
|
True if approved, False if rejected, None if pending |
Source code in src/boring/loop/shadow_mode.py
ShadowModeLevel
Bases: Enum
Shadow mode protection levels.
Source code in src/boring/loop/shadow_mode.py
TransactionManager
Manages atomic transactions using Git snapshots.
Provides: - start() - Create a checkpoint before making changes - commit() - Confirm changes and clear checkpoint - rollback() - Revert to checkpoint
Source code in src/boring/loop/transactions.py
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 | |
start(description='Boring transaction')
Start a new transaction by creating a Git checkpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
description
|
str
|
Description of the transaction |
'Boring transaction'
|
Returns:
| Type | Description |
|---|---|
dict
|
Transaction state as dict |
Source code in src/boring/loop/transactions.py
commit()
Commit the transaction, keeping all changes.
Returns:
| Type | Description |
|---|---|
dict
|
Result as dict |
Source code in src/boring/loop/transactions.py
rollback()
Rollback to the checkpoint, discarding all changes since start().
V11.0 Enhancements: - Pre-execution file lock detection - Exponential backoff retry for Windows file locking - Graceful recovery on disk write failures
Returns:
| Type | Description |
|---|---|
dict
|
Result as dict |
Source code in src/boring/loop/transactions.py
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 | |
status()
Get current transaction status.
Source code in src/boring/loop/transactions.py
TransactionState
dataclass
State of a transaction.
Source code in src/boring/loop/transactions.py
ProjectContext
dataclass
Captured state of a project for context-aware evolution.
Source code in src/boring/loop/workflow_evolver.py
ProjectContextDetector
Analyzes codebase to detect project context.
Source code in src/boring/loop/workflow_evolver.py
detect()
Run detection heuristics.
Source code in src/boring/loop/workflow_evolver.py
WorkflowEvolver
Manages workflow evolution, history, and dreaming.
Source code in src/boring/loop/workflow_evolver.py
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 | |
evolve_workflow(name, content, reason)
Modify an existing workflow with backup and history.
Source code in src/boring/loop/workflow_evolver.py
reset_workflow(name)
Restore a workflow from its backup.
Source code in src/boring/loop/workflow_evolver.py
backup_all_workflows()
Create backups for all md files in workflows dir.
Source code in src/boring/loop/workflow_evolver.py
get_workflow_status(name)
Check if a workflow is evolved and return hashes.
Source code in src/boring/loop/workflow_evolver.py
dream_next_steps()
Sage Mode: Propose future roadmaps based on project state.
Source code in src/boring/loop/workflow_evolver.py
learn_from_session()
WorkflowManager
Manages the lifecycle of Boring Workflows: - Discovery (Local) - Exporting (Packaging) - Installing (Importing)
Source code in src/boring/loop/workflow_manager.py
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 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 | |
list_local_workflows()
List all available .md workflows in the project.
export_workflow(name, author='user')
Package a local workflow into a .bwf.json file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Workflow name (without .md or .json) |
required |
author
|
str
|
Author name |
'user'
|
Returns:
| Type | Description |
|---|---|
tuple[Path | None, str]
|
(Path to created file, Message) |
Source code in src/boring/loop/workflow_manager.py
install_workflow(source)
Install a workflow from a local file path or a URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
File path (e.g., 'my-flow.bwf.json') or URL |
required |
Returns:
| Type | Description |
|---|---|
tuple[bool, str]
|
(Success boolean, Message) |
Source code in src/boring/loop/workflow_manager.py
publish_workflow(name, token, public=True)
Publish a workflow to GitHub Gist (The "Serverless Registry").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Workflow name |
required |
token
|
str
|
GitHub Personal Access Token |
required |
public
|
bool
|
Whether to make the Gist public |
True
|
Returns:
| Type | Description |
|---|---|
tuple[bool, str]
|
(Success, Message/URL) |
Source code in src/boring/loop/workflow_manager.py
WorkflowMetadata
dataclass
Metadata for a workflow package.
Source code in src/boring/loop/workflow_manager.py
WorkflowPackage
dataclass
Represents a portable workflow package (.bwf.json). Include metadata and the actual markdown content.
Source code in src/boring/loop/workflow_manager.py
to_json()
from_json(json_str)
classmethod
Deserialize from JSON string with validation.
Source code in src/boring/loop/workflow_manager.py
create_shadow_guard(project_root, mode='ENABLED', interactive=False)
Create a Shadow Mode guard with sensible defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
Project root directory |
required |
mode
|
str
|
"DISABLED", "ENABLED", or "STRICT" |
'ENABLED'
|
interactive
|
bool
|
If True, use console UI for approval |
False
|
Returns:
| Type | Description |
|---|---|
ShadowModeGuard
|
Configured ShadowModeGuard |