Refinery patrol: Add banners and wisp-based execution (gt-qz2l)

- Add step banners with emojis for each patrol step
- Add startup banner for Refinery initialization
- Add patrol summary banner at end of cycle
- Document wisp-based execution pattern (spawn/squash)
- Add Propulsion Principle for startup protocol
- Update refinery.md.tmpl template
- Update prompts/roles/refinery.md
- Update gastown refinery CLAUDE.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-23 19:38:52 -08:00
parent e3b9abb79b
commit a827b56260
7 changed files with 2972 additions and 2338 deletions

View File

@@ -0,0 +1,35 @@
formula: rule-of-five
type: expansion
description: >
Jeffrey Emanuel's discovery: LLM agents produce best work through 4-5
iterative refinements. Breadth-first exploration, then editorial passes.
version: 1
template:
- id: "{target}.draft"
description: >
Initial attempt at: {target.description}. Don't aim for perfection.
Get the shape right. Breadth over depth.
- id: "{target}.refine-1"
description: >
First refinement pass. Focus: CORRECTNESS. Fix errors, bugs, mistakes.
Is the logic sound?
needs: ["{target}.draft"]
- id: "{target}.refine-2"
description: >
Second refinement pass. Focus: CLARITY. Can someone else understand
this? Simplify. Remove jargon.
needs: ["{target}.refine-1"]
- id: "{target}.refine-3"
description: >
Third refinement pass. Focus: EDGE CASES. What could go wrong?
What's missing? Handle the unusual.
needs: ["{target}.refine-2"]
- id: "{target}.refine-4"
description: >
Final polish. Focus: EXCELLENCE. This is the last pass. Make it shine.
Is this something you'd be proud to ship?
needs: ["{target}.refine-3"]

View File

@@ -0,0 +1,31 @@
formula: security-audit
type: aspect
description: >
Cross-cutting security concern. Applies security scanning before and
after implementation steps.
version: 1
pointcuts:
- glob: "*.implement"
- glob: "*.submit"
advice:
around:
before:
- id: security-prescan
description: >
Pre-implementation security check. Review for secrets/credentials
in scope. Check dependencies for known vulnerabilities.
args:
target: "{step.id}"
after:
- id: security-postscan
description: >
Post-implementation security scan. Scan new code for vulnerabilities
(SAST). Check for hardcoded secrets. Review for OWASP Top 10 issues.
args:
target: "{step.id}"
output:
approved: boolean
findings: list
- gate:
condition: "security-postscan.output.approved == true"
message: Security approval required before proceeding

View File

@@ -0,0 +1,45 @@
formula: shiny-enterprise
extends: shiny
description: >
Enterprise-grade engineering workflow. Shiny + Rule of Five + Security +
Performance Testing + Review Loop.
version: 1
compose:
- expand:
target: implement
with: rule-of-five
- aspect:
pointcut: "implement.*"
with: security-audit
- gate:
before: submit
condition: "security-postscan.approved == true"
message: Cannot submit without security approval
- branch:
from: implement.refine-4
steps:
- id: perf-test
description: Run performance benchmarks
- id: load-test
description: Run load/stress tests
- id: chaos-test
description: Run chaos engineering tests
join: review
- loop:
step: review
until: "review.output.approved == true"
max: 3
on-max: escalate
- advice:
target: "*"
before:
id: log-start
description: "Log: Starting {step.id}"
after:
id: log-end
description: "Log: Completed {step.id}"

View File

@@ -0,0 +1,39 @@
formula: shiny
description: >
Engineer in a Box - the canonical right way. Design before you code.
Review before you ship. Test before you submit.
version: 1
vars:
feature: "{{feature}}"
assignee: "{{assignee}}"
steps:
- id: design
description: >
Think carefully about architecture before writing code. Consider:
How does this fit into the existing system? What are the edge cases?
What could go wrong? Is there a simpler approach?
- id: implement
description: >
Write the code for {{feature}}. Follow the design. Keep it simple.
Don't gold-plate.
needs: [design]
- id: review
description: >
Review the implementation. Check for: Does it match the design?
Are there obvious bugs? Is it readable and maintainable?
Are there security concerns?
needs: [implement]
- id: test
description: >
Write and run tests. Unit tests for new code, integration tests
if needed, run the full test suite, fix any regressions.
needs: [review]
- id: submit
description: >
Submit for merge. Final check: git status, git diff. Commit with
clear message. Push and create PR.
needs: [test]

View File

@@ -0,0 +1,101 @@
# Towers of Hanoi Formula
#
# Demonstrates that molecule algebra solves the "million step workflow" problem.
# LLMs fail on long sequences because errors accumulate (99.9%^1000 ≈ 37% success).
# MAKER used voting to reduce error. We use mechanical structure instead.
#
# Key insight: The move sequence is deterministic. Only execution needs AI.
# And each step is trivial: "move disk X from peg Y to peg Z".
#
# For n disks: 2^n - 1 moves
# 20 disks = 1,048,575 moves (the "million step" problem)
#
# The iterative algorithm (no recursion needed):
# For move k (1-indexed):
# - disk = largest power of 2 dividing k (disk 1 is smallest)
# - direction = computed from disk parity and move number
#
# This formula uses for-each to generate all moves at cook time.
formula: towers-of-hanoi
description: >
Solve Towers of Hanoi for {disks} disks. Generates 2^{disks} - 1 steps,
each a trivial move operation. Demonstrates mechanical structure generation
for arbitrarily long workflows.
version: 1
vars:
disks: "{{disks}}"
source_peg: "A"
target_peg: "C"
auxiliary_peg: "B"
# The magic: for-each over computed move sequence
# Each move is deterministic, computed from move number
generate:
# This is pseudo-syntax for the runtime expansion we'd need
for-each:
var: move_num
range: "1..2^{disks}" # 1 to 2^n - 1
step:
id: "move-{move_num}"
description: >
Move {computed_disk} from {computed_source} to {computed_target}.
This is move {move_num} of {total_moves}.
Simply execute the move - no decision needed.
needs:
- "move-{move_num - 1}" # Sequential dependency
compute:
# Disk to move: position of lowest set bit in move_num
disk: "lowest_set_bit({move_num})"
# Peg calculations based on disk parity and move number
source: "peg_for_disk({disk}, {move_num}, 'source')"
target: "peg_for_disk({disk}, {move_num}, 'target')"
# Alternatively, simpler recursive template for smaller N:
# (This would need the recursive expansion operator)
steps:
- id: setup
description: >
Verify initial state: {disks} disks stacked on peg {source_peg}.
All disks in order (largest on bottom).
- id: solve
description: >
Execute all {total_moves} moves to transfer tower from
{source_peg} to {target_peg}.
needs: [setup]
# This step would be expanded by the generate block above
- id: verify
description: >
Verify final state: all {disks} disks now on peg {target_peg}.
Tower intact, all moves were legal.
needs: [solve]
# For the prototype, let's show a 3-disk example (7 moves):
example_3_disk:
# Move sequence for 3 disks: A→C, A→B, C→B, A→C, B→A, B→C, A→C
steps:
- id: move-1
description: "Move disk 1 from A to C"
- id: move-2
description: "Move disk 2 from A to B"
needs: [move-1]
- id: move-3
description: "Move disk 1 from C to B"
needs: [move-2]
- id: move-4
description: "Move disk 3 from A to C"
needs: [move-3]
- id: move-5
description: "Move disk 1 from B to A"
needs: [move-4]
- id: move-6
description: "Move disk 2 from B to C"
needs: [move-5]
- id: move-7
description: "Move disk 1 from A to C"
needs: [move-6]