원클릭으로
dev-tools
Developer tools for The Fold - protocols (extensible dispatch), protocol bundles, refactoring toolkit (rename, move, dead code), and template DSL. Use when defining new protocols, refactoring code, or generating S-expressions.
메뉴
Developer tools for The Fold - protocols (extensible dispatch), protocol bundles, refactoring toolkit (rename, move, dead code), and template DSL. Use when defining new protocols, refactoring code, or generating S-expressions.
API quick-reference for key lattice subsystems (FP, Game Theory, SAT, Optics, Statistics, CLP). Use when you need function signatures, module contents, or usage examples for a specific subsystem. Invoke when working with game theory, constraint solving, optics, parsers, or other advanced lattice features.
Search and navigate The Fold's skill lattice using meta-tooling. Use for finding functions, exploring dependencies, type-aware queries, and cross-reference analysis. Invoke when searching for capabilities, exploring the codebase structure, or finding how functions relate.
Troubleshooting guide for The Fold - daemon issues, session corruption, file locations, and common problems. Use when ./fold isn't working, the daemon won't start, or you need to find system files.
Invoke Google's Gemini AI via CLI in headless mode for AI-powered analysis, code generation, and reasoning tasks. Use when you need a second opinion, the user mentions Gemini, needs Google AI capabilities, or requests multi-modal analysis beyond Claude's scope.
Manage issues with The Fold's CAS-native BBS (Bulletin Board System). Use for creating, updating, searching, and tracking issues. Invoke when the user wants to create tickets, find work, check issue status, or manage dependencies.
Reference for The Fold's typed comments and doc forms system. Use when adding type annotations, documentation, todos, or other metadata to Scheme code. Covers (doc ...) syntax, standard tags, search commands, and type checker integration.
| name | dev-tools |
| description | Developer tools for The Fold - protocols (extensible dispatch), protocol bundles, refactoring toolkit (rename, move, dead code), and template DSL. Use when defining new protocols, refactoring code, or generating S-expressions. |
| allowed-tools | Bash(./fold:*), Read, Edit, Write, Grep, Glob |
Power-user tools for protocol definition, refactoring, and code generation.
Extensible type dispatch for the Open/Closed Principle (lattice/fp/protocol.ss).
Objects must be tagged lists: (list 'type-tag ...). Dispatch is O(1) via hashtable.
(load "lattice/fp/protocol.ss")
;; Define a protocol (generic operation)
(define-protocol (draw obj ctx) "Draw object to context")
;; Register implementations per type tag
(implement-protocol! 'draw 'circle
(lambda (c ctx) (draw-circle (circle-center c) ctx)))
(implement-protocol! 'draw 'rectangle
(lambda (r ctx) (draw-rect (rect-pos r) ctx)))
;; Use (automatic dispatch via type tag)
(draw my-circle canvas) ; calls circle implementation
| Function | Purpose |
|---|---|
define-protocol | Create a new protocol with signature and docstring |
implement-protocol! | Register implementation for a type tag |
protocol-implementations | List all implementations of a protocol |
protocol? | Check if a symbol names a protocol |
Reduce boilerplate when implementing multiple related protocols (lattice/fp/protocol-bundle.ss).
(load "lattice/fp/protocol-bundle.ss")
;; Define a bundle of related protocol pairs (getter, setter)
(define-protocol-bundle body-ops
((body-pos body-set-pos) "pos")
((body-vel body-set-vel) "vel")
((body-mass body-set-mass) "mass"))
;; Derive implementations using naming convention: <prefix>-<field>, <prefix>-with-<field>
(derive-bundle! body-ops 'rigid-body-2d rigid-body)
;; With overrides for slots that don't follow the convention
(derive-bundle! body-ops 'particle particle
("mass" (lambda (p) 1.0) (lambda (p m) p))) ; Particles have implicit mass
;; Explicit implementation when convention doesn't apply
(implement-bundle! body-ops 'custom-body
("pos" custom-get-pos custom-set-pos)
("vel" custom-get-vel custom-set-vel)
("mass" custom-get-mass custom-set-mass))
(bundle-types bundle) ; List types implementing this bundle
(bundle-protocols bundle) ; List protocols in this bundle
(list-bundles) ; List all defined bundles
Unified interface for codebase refactoring (boundary/tools/refactor-toolkit.ss).
(load "boundary/tools/refactor-toolkit.ss")
;; Help and discovery
(refactor 'help) ; Show all operations
;; Preview rename (shows all affected files)
(refactor 'rename 'old-name 'new-name)
;; Apply staged changes
(refactor 'apply)
;; Preview move (shows source/target changes)
(refactor 'move 'symbol "target-file.ss")
;; Apply staged move
(refactor-move-apply!)
;; Scan entire codebase
(refactor 'dead-code)
;; Scan specific path
(refactor 'dead-code "lattice/fp")
;; Show callers and callees
(refactor 'deps 'symbol)
(refactor 'status) ; Show pending changes
(refactor 'undo) ; Undo last operation
(refactor 'clear) ; Discard pending changes
| Alias | Full Command |
|---|---|
rr | (refactor 'rename ...) |
rm | (refactor 'move ...) |
rd | (refactor 'deps ...) |
rdc | (refactor 'dead-code ...) |
Grammar-driven code construction for building S-expressions without tracking parentheses.
Files:
lattice/dsl/template/template.ss (core)boundary/tools/template-session.ss (session)boundary/tools/template-parser.ss (parser)(load "boundary/tools/template-parser.ss")
;; Build quicksort - template with holes, then fill them
(tp-batch "
define (qs lst) $body
--- $body := if $cond $then $else
--- $cond := null? lst
--- $then := '()
--- $else := append (qs (filter $pred (cdr lst))) (cons (car lst) (qs (filter $pred2 (cdr lst))))
--- $pred := lambda (x) (< x (car lst))
--- $pred2 := lambda (x) (>= x (car lst))
")
| Concept | Description |
|---|---|
Holes ($name) | Non-terminals that get filled incrementally |
| Implicit parens | Multi-token statements get automatic outer () |
| Batch separator | --- chains definitions/fills in sequence |
(load "boundary/tools/template-session.ss")
;; Start a template session
(tp-start)
;; Define template with holes
(tp "define (factorial n) $body")
;; Fill holes incrementally
(tp-fill '$body "if (= n 0) 1 (* n (factorial (- n 1)))")
;; Get result
(tp-result) ; => (define (factorial n) (if (= n 0) 1 (* n (factorial (- n 1)))))