| Ticket Hash: | cf1f55134a161fc133afecc3e018459d632fe4eb | ||
| Title: | Explore: constrained Crystal DSL + grammar-constrained generation as the weak-model interface (gpcr direction) | ||
| Status: | Active | Type: | Feature_Request |
| Severity: | Normal | Priority: | High |
| Subsystem: | Resolution: | ||
| Last Modified: |
2026-09-20 14:43:54 51.7 days ago |
Created: |
2026-07-08 01:06:26 126.3 days ago |
| Version Found In: | |||
| Description: | ||||
| Maintainer direction 2026-07-07: investigate a small, highly-readable Crystal-flavored DSL as the intersection between humans and low-complexity models (gemma4/qwen-class). Avenues, ordered by evidence strength from our own Native-Runner Study: (1) GRAMMAR-CONSTRAINED OUTPUT — Ollama structured outputs / GBNF-style grammars make invalid tool-JSON structurally impossible (202 invalid-JSON events in the corpus; 3 run-fatal); define the tool-call + edit grammar formally and pass it as the output schema. (2) SYMBOL-ANCHORED EDIT DSL — replace line/text-match edits with intent-level ops (replace_method, insert_after_def, add_require) resolved via the LSP/find_symbol machinery; external evidence: edit-format choice alone moves weak-model pass rates by tens of points (aider diff-format experiments); our apply_patch 53% error rate is the local confirmation. Crystal macros can compile the DSL so errors surface as compile errors the loop already feeds back. (3) PROMPT-AS-PROGRAM OPTIMIZATION — DSPy-style: treat the system prompt + few-shots as parameters optimized against the A/B battery pass-rate as the metric; runs unattended on the local GPU. (4) EVOLUTIONARY/GP LOOP — FunSearch/AlphaEvolve pattern: weak model proposes a POPULATION of candidate patches in the DSL, the verify gate is the objective fitness function, selection+retry replaces single-shot correctness; works precisely because our verification is cheap and objective. Deliverable of this ticket: a short design memo (wiki) choosing the grammar surface + edit-op set, plus battery tasks t5/t6 that measure DSL-edits vs apply_patch on the same fixes. Sequence: after M4 LSP unit 2 (symbol resolution is the dependency). | ||||
| User Comments: | ||||
added on 2026-07-08 01:16:48:
The exploration now has a home repo: gp-crystal.fossil is hosted and onboarded (project-code 3b2f3eff8f7c59f9, login group joined, chat runner bound, daemon fan-out picked it up). Its README already sketches the GPCR DSL: block-first intermediate representation bridging GP/MicroBlocks and Crystal, blocks/primitives/libraries as data (JSON block specs), GPCR.library/GPCR.primitive Crystal-hosted DSL. This is exactly avenue 2 (symbol-anchored/constrained DSL as the human↔weak-model intersection): blocks-as-data means a weak model emits structured JSON against a fixed block vocabulary instead of free-form Crystal, and grammar-constrained generation (avenue 1) can enforce the block spec schema directly. Prototype work for this ticket should land in the gp-crystal repo, not ollama. Housekeeping note: the repo was created from a template that copied semantic-ui's peer-source provenance record; the stray record has been deleted (native repo, no upstream). added on 2026-08-28 03:08:30: Fresh evidence (2026-08-28, task a978a52793, codex-crystal-gemma4) — live confirmation of avenues 1/2/4. The model FABRICATED a method (ChatCGI::ActivityReport.aggregate — doesn't exist) → compile error, then death-spiraled (steps 58-61: empty responses content_chars=0, thinking 6.6k→10k chars and rising, no tool call, to task-failure). Exactly what grammar-constrained output (avenue 1) and the symbol-anchored edit DSL (avenue 2) prevent at the source; and what population+objective-verify (avenue 4) prevents from spiraling. Coordinator reprioritization: avenue 1 (grammar-constrained tool-call/edit output — NO dependency, highest evidence: 202 invalid-JSON events) is the DIRECT near-term fix and can start now. The empty-response/thinking-spiral circuit-breaker (ollama 6c2c22268e) is the cheap INTERIM seatbelt, subordinate to this — not the strategy. Avenue 2 (symbol-anchored DSL) and the GPCR block-DSL remain the visionary intersection, gated on LSP symbol resolution (LSP unit 2, 0b8d03b94ee). Prototype homes per the ticket: DSL/blocks in gp-crystal; grammar on the tool-call/edit JSON is a runner change on the ollama side. | ||||