# Will Chen - Full Content > I’m Will Chen, founder of [Idyllic Labs](https://idylliclabs.com). ## About I design programming tools and new ways to work with AI. At Idyllic, I’m exploring persistent agents you can extend with components (/writing/buildlog-01-building-the-grokbot-i-want-to-use) and manage through chat and live controls. I use ai-organs (/writing/ai-organs), a digital exoskeleton for my work and life. It lets agents search years of my notes and conversations to help with research and writing. I founded Terran One, where we built languages (/writing/cwscript), debuggers (/writing/cw-simulate), and virtual machines (/writing/cosmwasm-vm-js) for CosmWasm blockchains. Before that, I led developer experience at Terra, where I worked on growth, tooling, and the SDKs (/writing/terra-sdks). I write about language design (/writing/cwscript), AI interfaces (/writing/building-idyllic-prior-iterations), and the craft of making complex systems understandable (/writing/cw-simulate) and useful. ## Current Work (updated 2026-08-27) I run my life on ai-organs, a personal system an agent operates for me, and I'm building busibody, a fleet of small businesses that agents run the same way. I'm writing both up in enough detail to be useful. ## Projects ### Active - Idyllic Labs: where we build the primitives these systems are made of (https://idylliclabs.com) - Elements of Agentic System Design: Decomposing intelligent behavior into code primitives (https://github.com/idyllic-labs/elements-of-agentic-system-design) ### Personal - busibody: a fleet of small businesses, each run by an agent (Idyllic Labs) - Mechanistic Mindset: a wiki on computational self-engineering (https://mechanisticmindset.com) - ai-organs: the personal system I run my life on; small tools composed by an agent ### Background - Head of DevX @ Terra - Terran One WASM Research Lab (founder) - Compilers, smart contracts, developer tools ## Links - Website: https://www.wcdc.io - Writing: https://www.wcdc.io/writing - RSS Feed: https://www.wcdc.io/feed.xml - GitHub: https://github.com/ouiliame - Twitter: https://x.com/stablechen - LinkedIn: https://www.linkedin.com/in/will-chen-3a71ba16b/ ## Contact - Twitter DM: https://x.com/stablechen - Email: william@idylliclabs.com --- # Writing --- ## Idyllic buildlog: Typed conversations URL: https://www.wcdc.io/writing/buildlog-02-typed-conversations Date: 2026-09-26 Description: This week's experiments with Ghostwriter and the other systems I want to run in Idyllic. In [Restarting Idyllic](https://www.wcdc.io/writing/buildlog-01-building-the-grokbot-i-want-to-use), I described the kind of agent I want to use: a software system I can talk to, with components beside the conversation that let me inspect and control its work. This week I've been working through how those systems would actually fit into the app. The main design to come out of that work is a persistent conversation for each article, lesson or other thing we're working on, with workflows operating inside it. ## A canonical test environment My [September 14 system note](https://www.wcdc.io/writing/system-snapshot-2026-09-14) described the arrangement I'm trying to build around writing, businesses, learning and the rest of my life. I started mapping those activities into a shared Idyllic workspace so I could work through what each agent would need. The prototype now brings together Ghostwriter, a Korean teacher, Coursework, Project Upskill, 20cuts, Job Search and a software factory for Idyllic. They are at different stages: persistent chat works, while many of the newer component views still show sample information. I'm using them to decide what the systems should do before filling in all their behavior. This is also becoming the canonical end-to-end testing environment. The workspace is defined in code, so a script can recreate the agents and their sample material from a known starting point. An ordinary restart retains the work; an explicit reset starts the experiment over. My daily instance keeps separate data. That lets me develop a scenario through the actual app and then make it repeatable. In Ghostwriter, for example, the scenario can start with source material, produce a draft, receive feedback and retain a revision after a restart. Predictable model responses help test whether the application saves and routes the work correctly. Trying it with a real model and reading the result answers different questions about how well the agent follows the process. ## Prototyping Ghostwriter Ghostwriter gave me the first detailed case because I already know where working with writing agents gets frustrating. Several pieces can be in progress at once. A critique can send one back to research, while another is waiting for me to review a draft. The system needs to preserve the decisions we've made about each piece as different workers contribute. I worked through those situations in the existing form factor: agents on the left, conversation in the center, components on the right. Putting the draft in the center started turning it into a document app. I wanted discussion to remain the main way I participate, with the draft available alongside it. The agent overview and the article discussion also needed different things. At the overview, I want to see the pieces in progress and the workers and methods Ghostwriter can use. Inside one article, I want its drafts, research and feedback. Repeating a dashboard inside every article made the interface busier without helping me work on it. The resulting design keeps a main conversation with Ghostwriter and lets me enter a separate, persistent conversation for a piece.
Proposed Ghostwriter organization: one agent has a main conversation and an optional Pieces set, whose entries are separate work conversations. Workers and saved workflows are shared agent capabilities.
Proposed organization: Ghostwriter coordinates the editorial operation. Each piece keeps a separate work conversation.
## Typed conversations Working through Ghostwriter made it clear that the article is the unit of work that needs to persist. It has a lifecycle, from an idea through research, drafting and review to publication or being put aside. A research assignment or a critique is one contribution to that work. The article can involve several agents and workflow runs before it is finished. The context for that work includes more than the current draft. A worker revising a passage needs to know what the reviewer objected to, which claims the sources support and what I've already accepted. Those decisions accumulate as the article develops. Keeping them in separate worker conversations would leave me or Ghostwriter to reconstruct how they fit together whenever another worker takes over. That's why the piece gets its own conversation. In the design I'm working toward, each worker can draw on the relevant history and contribute its result to the same thread, with drafts and research attached to the piece. Several workers may be active at once, but their contributions come together around the work they're helping complete. The thread records the collaboration across them, including my own feedback. Convergence has a concrete meaning here: the contributions of several agents build toward one result, and the thread keeps the history of how that result developed. I can follow which draft a reviewer assessed, why we changed the argument and what still needs to be resolved. The conversation gives me a way to understand and steer the combined work.
One piece retains a shared history of human, researcher, writer and reviewer contributions, alongside its sources, draft versions, critique and current lifecycle stage.
Research, drafts, reviews and human decisions accumulate around one piece. Workers may run in parallel; the conversation retains their contributions.
This also explains why the conversations are typed: - A piece has an editorial lifecycle, drafts and review decisions. - A job opportunity has a recruiting lifecycle, correspondence and interview preparation. Both need an ongoing conversation with the context for their work attached, but the useful information and the meaning of progress differ. A type defines that structure and the behavior associated with it. For Ghostwriter, the component defines a set called Pieces. Job Search uses a set called Opportunities. Each entry has its own history, working material and current state. An agent can have several such sets with different purposes and behavior. An ordinary agent still starts with one persistent conversation. Extra work conversations come from an optional component. A system helping me with fitness and daily habits may be fine with a single continuing conversation; Ghostwriter needs somewhere to work on several articles independently. That history can grow much longer than the model's context window. For each turn, the system derives the context to give the model from the conversation's history and working material. Keeping the history and choosing what a worker needs to read are separate concerns. ## Workflows and conversation events The next part is making interaction within these conversations programmable. I'm designing workflows as scripted orchestrations that run inside a conversation and contribute results to it. A workflow could research a question, ask a worker for a draft, request a critique and wait for my feedback. The article can need several such runs. A research procedure might run again after a critique exposes a missing source. Completing that procedure says the research has returned; it doesn't mean the article is finished. The piece's lifecycle and the execution of a particular workflow have different jobs. The conversation gives those procedures a place to meet. A review sequence could work like this: 1. A reviewer posts a critique of the current draft into the piece's conversation. 2. A configured reaction asks Ghostwriter to assess the critique. If a claim needs evidence, it delegates research using the draft and that specific question. 3. The research result returns to the same conversation. Ghostwriter can use it to request a revision or bring a decision to me. 4. My feedback becomes another contribution to the piece's history that subsequent work can use.
A reviewer contribution in Piece A triggers a configured reaction. Ghostwriter chooses a research workflow, which receives relevant material and returns its result to the same Piece A conversation.
Example reaction: a critique prompts more research, which returns to the originating piece. The conversation continues after the workflow finishes.
I find this easier to reason about than coordinating events scattered across services. The event is meaningful in the context of the work: a reviewer has responded to this draft of this piece. The response belongs to a particular piece and draft, and the next worker can be given that material together with the review. An external service can participate too. A GitHub connector could post a CI result into the conversation for the relevant issue. The configured behavior for that conversation set would determine what follows. Connecting the service still takes work, but the system has a common place to receive its contribution and coordinate a response. What interests me is computing over a conversation's accumulating history. I can make a particular requirement explicit, such as waiting for my review, while leaving the agent to decide how to investigate a criticism. I don't have to anticipate every editorial decision as a branch in a workflow editor. ## The agent as manager Ghostwriter remains responsible for the broader editorial operation. I can talk to it about which pieces matter, ask where something is stuck or change how I want reviews handled. It makes progress by working with the piece conversations and delegating to workers with the relevant material. Trying the same distinction in Coursework helped. One version gave each course its own agent, but that meant visiting each one to recover where I was. I preferred one Coursework agent that could help me decide what to study, with separate lesson conversations holding exercises and feedback. A lesson needs its own work history without becoming another agent I have to manage. ## Agent components I'm still refining how components should work underneath this. A component extends the agent's capabilities: it can keep state, expose operations, respond to events and provide a human interface. The card on the right is how I inspect and use that capability. The components give the agent different capabilities: - **Conversations** supplies a set of work conversations with configured behavior. - **Workflows** supplies procedures the agent can run. - **Workers** supplies the roles it can delegate to. A work conversation can also have its own components and attachments. A draft may only need a simple viewer; if it lives in Notion, a link to the original may be enough. A live component belongs there when its state or controls help with that particular work. I don't want every attachment to become another miniature application. The shared component API is still open. Working through these uses is helping define what belongs to the agent, what belongs to a conversation and what several conversations should be able to share. ## The discovery loop The useful part of this process has been getting specific about how I would use each system. A sketch gives me something to react to: where I would begin, what I would inspect when returning, and how I would intervene when the work goes in the wrong direction. That often changes the underlying model as well as the interface. The loop I'm using is: - Pick an activity I know well enough to judge, and work through concrete moments of using it. - Build those interactions in the shared form factor and revise what feels wrong or is missing. - Add the accepted design to the canonical workspace so it can be considered alongside the other systems. - Implement a reusable component's behavior, exercise it on a real task and try the same capability in another system. I skipped a fundraising system because I haven't done enough of that work to give useful feedback on the design. Writing and studying give me much clearer expectations to test against. Typed conversations and workflows are the current focus. I'm working through which contributions should trigger another worker, when the manager should decide what happens next, and what context each participant needs. A reviewer posting feedback on a piece is the next concrete case to define and exercise, then carry over to a different kind of work. --- ## Restarting Idyllic URL: https://www.wcdc.io/writing/buildlog-01-building-the-grokbot-i-want-to-use Date: 2026-09-22 Description: Working on my startup again after a 6-month hiatus. I'm rebuilding Idyllic solo in 2026, after a hiatus. The earlier project ran from April 2024 through December 2025. Since then, using AI for writing, coding and business experiments has made the problems I want to solve clearer. I've also become more convinced by the Bitter Lesson: general methods that benefit from more computation tend to outperform carefully encoded human knowledge. I'm comfortable leaving more decisions to the model. I want to build an environment where I can see its work and change how the system operates. ## What I like about Grokbot Grokbot felt like it finally got the interaction right: a persistent agent with one continuing thread. I can describe what I need, create a bot and start talking to it. When I return to writing, I know which conversation to open. I especially like how composable it is. I can create a group chat of bots, bringing together agents I already talk to individually. That scales naturally in the way human communication does: when work involves more people, we bring them into the conversation. I want to keep that simplicity as the systems behind those conversations get more capable. ## The writing pipeline When I want to create an agent for writing and get really specific about how it works, skills don't seem to carry it far enough. I'm talking about a whole editorial pipeline: taking an idea, enriching it with research, critiquing the draft through multiple passes and bringing me in for review. That's hard to encode in a skill, and it's hard to verify. The skill is Markdown. I can write down how the process should work, but then I have to run it and inspect the traces to see what actually happened. Once several agents are involved, I also have to follow how their work fits together and whether the coordinating agent is managing them the way I intended. I don't want to build that in Zapier or n8n. I hate working in those workflow editors. Defining an editorial process that way is extremely difficult, because the next step depends on what comes back from the work. A critique might call for more research or another revision; my review might change what the article is trying to say. I don't want to draw out all of those decisions as a workflow. What I want is the flexibility of an agent with a system around it that I can inspect. Parts of the editorial process should have their own visible state and controls, so I can manage the process of the agent managing its workers. I shouldn't need another prompt just to see which draft is being reviewed or where work is waiting on me. ## Seeing and controlling the process I want to see the machine in motion without having to reread the instructions and reconstruct the process from its traces every time. I expect to stay involved, like a captain aboard a ship that's already running. I can check with the engineers, inspect the hull or go to the bridge and adjust the course while the machinery keeps operating. For the writing system, I want to be able to: - Open the draft that's waiting for review and leave feedback, while independent research continues. - Inspect the research a worker has returned before using it in the article. - Change which article the system should work on next. I can still talk to the agent when I want to discuss the direction or explain a change.
Concept illustration of a writing agent coordinating workers around shared records. Human cards show Research B running and Draft A awaiting review, with feedback returning to the draft's records.
Concept illustration: Draft A waits for human review while Research B continues. The live cards show the same records the agent uses, and feedback goes back into those records.
## Agents as software systems An agent, in this design, is a software system I can talk to. The writing agent might coordinate several research and critique workers internally, but I can manage the editorial process through one continuing conversation. Creating another top-level agent adds another system for me to oversee. That gives me a practical way to decide where a new capability belongs: - A review queue belongs inside the writing agent as a component. It extends the editorial system I'm already managing. - A separate business operation can have its own agent because I want to return to it and direct its work independently. An internal worker doesn't automatically need its own entry in my sidebar. ## Software factories The discussion around software factories often makes the setup sound complicated. Some people describe it as skills and a queue; others show systems whose internal workings I don't know. I find it easier to reason about the development process itself: 1. Someone encounters a problem and records it as an issue, perhaps in Linear. 2. A coordinator routes the issue to a worker, with the relevant context from shared notes or a specification in Notion. 3. The worker makes a change and explains what it did in a pull request. 4. GitHub CI runs checks, and a reviewer assesses the change before it can be merged. Feedback can send it back for more work. People still decide which problems matter and whether the resulting changes solve them. Code can enforce required checks and review before merging, while an agent decides how to investigate the issue and implement a change. In Idyllic, I'd want that whole operation to be the agent I talk to. I could start with a software project, then add the queue and worker setup it needs as I develop the process. Its coding agents would be participants inside the system. The components could supply the supporting machinery: - A queue would hold work and its current status. - Skills and memory would retain the procedures and project decisions workers need. - A cache could keep results that would otherwise have to be retrieved again. - Herdr instances and computers would provide places for workers to run. - Connectors would let the system use an existing service where that makes sense. Cloud computers are part of that direction; the current application runs locally. ## Agent components Idyllic's layout puts agents on the left, the selected agent's conversation in the center, and its components on the right. Each component has a live card that opens into a fuller application.
Idyllic interface study with agents on the left, a Ghostwriter conversation in the center, and component cards in the right sidebar.
An interface study with sample conversations and activity.
An agent component is a small application with saved state and behavior. It exposes operations to the agent and an interface to me; both use the same underlying state. The bundled components already include: - **Journal:** keeps records we can both inspect and supplies entries as context. - **Computer:** provides a Linux computer we can both operate. - **Herdr:** manages worker and terminal sessions, including work the agent delegates.
Idyllic's Add component dialog, with Journal, Computer and Herdr on the left and a Computer preview on the right.
The bundled component catalogue before Workflows was added. The Computer panel is an illustrative preview.
I considered dividing the sidebar into separate sections for tool integrations, routines and other kinds of extensions. For now, I'm keeping it as a simple collection of cards. Each component should have few dependencies and expose operations the agent can combine. I'll add more structure when using the app, or watching someone else use it, gives me a reason to. ## The SDK There are already useful terminal tools and installable skill packs for coordinating agents. I want to package those capabilities so I can work with them without continually watching the agent's terminal. Command output often tells me what the agent is executing without giving me a useful overview of the work. The design gives an agent its own persistent computer, where it can keep files and use installed software. The SDK lets a developer connect a capability to a small reactive app in the sidebar. I think of the backend as an OS-like environment for these components. A plugin needs a way to retain its state and respond to events after any particular model turn has ended. Its human interface can stay live between model turns. For a queue, the agent and the card should read and change the same work records. When a worker finishes, the queue updates its record and the card receives the new status. Changing a priority in the card updates the record the agent will read next. Neither side has to reconstruct a separate version from chat. A connector can still use MCP or another service underneath; the component provides the retained application and controls around it. ## What I'm trying next The local app already supports persistent conversations and attaching bundled components. A basic Workflows component now keeps run history and can pause for human review. Its steps currently generate text in sequence; the more adaptive editorial process above is what I want to build on top. The experience I'm aiming for is assembling an agent from components. I could choose them myself, perhaps by dragging them into place, or ask the agent to choose what it needs. After a little configuration, I'd start using the system and refine it through conversation. For example, I could tell the writing agent to put drafts in the review queue before revising them further. I want it to remember that arrangement, so I don't have to explain the relationship between those components in every session. Automatic component selection and remembering how they should work together are still part of the design; today I attach the bundled components myself. Writing will give me a system to use daily and something concrete to show other people. I want to watch which components they reach for and where they still need to ask the agent to explain what's happening. Those attempts should tell me what to make visible next. --- ## A mobile builder for personal agents URL: https://www.wcdc.io/writing/building-idyllic-mobile-agent-builder Date: 2026-09-16 Description: Editing an agent's routines and data from a phone. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *2024 and 2025* ![Store-preview artwork showing the agent library, interactive responses and the mobile function editor.](/assets/idyllic-prior-iterations/building-idyllic-mobile-agent-builder/store-preview-agent-interaction-builder.jpg) The mobile concept brought an agent library, interactive conversations and a function editor into the same application. These store-preview designs show how we presented that combination. A personal agent needs to be available while someone is using it throughout their day. A plan changes away from the desk. A note occurs to someone while they are out. If every adjustment to the agent requires a laptop, its builder is absent during much of the experience it is supposed to support. I began exploring a mobile version of Idyllic in 2024, and by 2025 I was working on a builder where people could assemble agents on the phone itself. An agent had a system prompt, reusable functions and persistent data. The challenge was to make those parts editable on a narrow screen while keeping the resulting behavior understandable. ## Adding the resources an agent needs ![The Tester agent and its Add Agent Component menu.](/assets/idyllic-prior-iterations/building-idyllic-mobile-agent-builder/tester-component-picker.jpg) The component picker offered functions, notes, tables, integrations and MCP servers. Above it, the agent's system prompt and functions appeared as separate cards. The agent screen separated its prompt from the components attached below it. The Add menu exposed a small set of component types, then each selected component could have its own configuration. This kept the overview readable without requiring every setting to fit on one screen. The components supplied different kinds of resources: - **Functions** held repeatable procedures made from blocks. - **Notes** gave the agent documents to consult or update, with a description of what belonged in each one. - **Tables** gave it structured records with named columns. - **Integrations and MCP servers** appeared as ways to connect external capabilities. Coachbear illustrated how the parts could work together. Its configuration contained a Morning Routine function, notes for ongoing observations and a Food Log table. The table had columns for Name, Timestamp, Calories and Notes, plus a description telling the agent when to add an entry. Its card displayed a Read/Write setting beside the schema. ![Coachbear configured with a Morning Routine function, writable notes and a Food Log table.](/assets/idyllic-prior-iterations/building-idyllic-mobile-agent-builder/coachbear-agent-components.jpg) The agent's components carried their own descriptions and controls. The Food Log card showed its schema and Read/Write setting directly in the agent configuration. Asking an agent to keep a food log leaves open where the information should go. Attaching a table supplies a particular destination and tells the agent what a record contains. A later question can refer to the accumulated records. The notes provide a different destination for observations that belong in prose rather than columns. This made configuration part of the agent's usable environment. The person could inspect the objects the agent had been given, open their settings and change what was attached. The overview showed more than a prompt because the agent's behavior depended on more than its instructions. ## Keeping the program readable on a phone I liked the iOS Shortcuts programming model because it was linear enough to read on a phone while still supporting loops and conditions. A procedure could proceed from top to bottom, with extra structure appearing where the work needed it. The Morning Routine editor followed that approach. Every operation occupied a row containing its name and inputs. Earlier results could appear as blue references inside later inputs, so the procedure could pass generated text between steps without copying that text into several prompts. ![Morning Routine displayed as a vertical program with generation, extraction, a loop and conditional branches.](/assets/idyllic-prior-iterations/building-idyllic-mobile-agent-builder/morning-routine-block-editor.jpg) The function editor combines ordinary action rows with a For each item block and an If/Otherwise branch. Indentation and colored borders show which operations belong inside the control structure. The visible sequence starts with generation and extraction. A For each item block takes the extraction result as its input. Inside the loop, another generation step precedes an If/Otherwise branch. One branch contains a notification. The alternative contains generation and web search before its notification. The layout explains several relationships at once. Vertical order shows the sequence of operations. Indentation places actions inside the loop or branch that controls them. The End If block marks where the conditional finishes, and the blue references show which previous result a later action uses. The prompts are partly clipped in the screenshot, but the control flow remains readable. This was the property I wanted from the editor: a person could look at the program and follow how an intermediate result would be used. The procedure could become more complex without immediately requiring a wide canvas of connected nodes. ## Letting AI edit the visible procedure Small changes could be made directly, but a larger revision might require many taps. I proposed putting an AI toolbar above the keyboard, where someone could describe a change and have the assistant modify the blocks in place. Undo would remain available afterward. Both editing methods would act on the same procedure. A person could ask the assistant to alter it, inspect the changed blocks and then continue editing directly. The visible program would preserve the result of the conversation instead of requiring someone to infer the current behavior from a history of requests. Julius and I were still working through the split between building an agent and using it. A chat with the finished agent should perform work; the editing assistant would change how that work happened. We also deferred bringing the builder into one mobile iteration while prioritizing the user-facing experience. The toolbar was a design proposal, and the supplied screens capture several parts of the mobile exploration. The phone itself offered useful capabilities for personal agents. Location could supply context, push notifications could bring someone back when input was needed, and health data suggested applications using information already recorded on the device. I wanted the authoring experience close to those uses, so a person could adjust their tool where they were using it. ## Generating a calculation from a new question Tables opened a different route to useful behavior. A saved function could describe work someone already knew they wanted to repeat. A question about accumulated data might call for a calculation the person had never specified before. When I was choosing how to support those tables, one observation mattered: AI generated MongoDB's query language well in my experiments. I expected modest personal tables with frequently changing columns, and I wanted the agent to work with their contents. The query language was therefore part of the interface I was choosing for the agent. The Food Log experiment showed an aggregation generated during a conversation. An aggregation is a sequence of database operations that transforms records into a result. The tool card exposed stages including sorting and grouping, then returned two groups named `quick_followup` and `spaced_out`, each with a count and an average calorie-change value. ![A Food Log aggregation tool call showing pipeline stages and two returned result groups.](/assets/idyllic-prior-iterations/building-idyllic-mobile-agent-builder/food-log-aggregation-result.jpg) The aggregation card exposes pipeline stages and returned values alongside the agent's response. The agent could formulate a calculation against the attached table and use the returned values in its response. I did not have to build a dedicated reporting function for that exact question. The table supplied the stored records, its schema described the available fields, and the generated query selected the operations to perform on them. The response described how one food choice affected the next, which went beyond what the calculation established. Group averages can show a difference in the recorded data without proving that one choice caused another. The tool card made the calculation's output visible enough to separate the returned numbers from the agent's interpretation. These two forms of programming could coexist in the same agent. A saved function preserved a procedure the person wanted to specify and inspect. A generated query could answer a new question over records already present in a table. On the phone, the builder exposed the procedures and resources, while the conversation gave the agent a place to put them to use. --- [Series index](/writing/building-idyllic-prior-iterations) --- ## How I built an animated product video system URL: https://www.wcdc.io/writing/animated-product-video-system Date: 2026-09-15 Description: Making animated explainers for Sim Academy with Claude Code. ## How the system works I built a nearly fully automated explainer-video production system for [Sim Academy](https://docs.sim.ai/academy). [Claude Code](https://claude.com/product/claude-code) agents operate a production harness and write animations through a TypeScript DSL I designed on top of [Remotion](https://www.remotion.dev/). Agents explore competing concepts, build complete films in parallel, review them, and combine the strongest parts. They also draft narration and generate voiceover. I direct the explanation and screen the results, sometimes delegating comparison and selection to the lead agent. [Sim](https://www.sim.ai) is a visual builder for AI workflows. The DSL represents its blocks, configuration, and execution as a shared world, so a run can drive the canvas, chat, and logs together. Remotion renders the React components at each frame.
The finished invoice-processing film. Original narration, 2 min 24 sec.
### How you use it I give Claude Code the product behavior to explain, the audience, and the intended understanding. The agent reads the repository's instructions, product references, and annotated examples before proposing a visual script. A request can be informal because the session already contains that context. This was my request for alternatives to the invoice film. “PH” refers to an earlier Product Hunt video:
```text  btw I think we should be showing an email inbox opening up and an attachment like we did the PH video, we need to show an zoom animation / flyby of showing the inbox opening an inbox / -- i think you need to help me ideate 6 variations of this video by trying lots of e2e ideas using subagents please ```
The agent turns that request into a brief and dispatches complete builds. I review the MP4s, give corrections, and ask for another variation or a final synthesis. Source, narration, and generated audio remain with each film so the same process can revise it later. ### The phases of production: diverge and converge The shared brief fixes the product mechanics and teaching goal. Candidates vary how they explain it. 1. **Research and brief.** Establish the actual workflow, example data, and claims each beat must communicate. 2. **Diverge.** Give separate agents distinct concepts and isolated Git worktrees. Each produces a complete film so its pacing and continuity can be judged. 3. **Build.** Establish static layouts and camera framings, animate them, then write narration and generate audio. The order is concept, visuals, narration, audio. 4. **Review.** Inspect frames and footage, run checks, and return concrete defects to the builder. 5. **Converge.** Select a base film and useful contributions from other candidates. Rewrite them into one dataset, layout, and timeline, then review the combined result.
Candidates share the brief and library. Review selects contributions and supplies corrections for later builds.
Candidates share the brief and library. Review selects contributions and supplies corrections for later builds.
The invoice production explored six candidates. I approved the wave and delegated the final selection; the agent combined the inbox/PDF structure with other candidates' cursor behavior, adjacent-row comparison, and Logs ending. A selected scene may use different values or assume an earlier action. Synthesis reconciles those dependencies in source code. The repository's synthesis template makes the selection explicit:
```text Build THE SYNTHESIS video: . I reviewed N candidates and specced the exact recipe — this is the convergence cut, not another experiment. THE RECIPE (my verdicts, follow exactly): - = 's (quote the director verdict on why it won) - = 's … - = REBUILT: Mine `git show origin/:` for each borrowed element. ```
### How mistakes are caught The system uses several kinds of checks because valid code can still produce a misleading film. | Check | What it catches | | --- | --- | | Shared geometry and timing | Containers too small for their contents, detached connection anchors, block reveals preceding their clicks. | | Types and validation | Unknown objects, invalid references, nonexistent highlight targets, configuration/schema mismatches. | | Film audits | Overlapping interactions, input before a panel settles, possible dead holds. | | Rendered stills | Cropping, unreadable fields, panels covering the action. | | Boundary comparison | Unintended visual changes at joins meant to remain continuous. | | Playback and screening | Weak explanations, poor pacing, incorrect emphasis, motion that passes static checks but teaches little. | The early boundary verifier caught a highlight that had not faded, changing 4,140 pixels across a cut. Another build passed static checks but used mostly binary state changes and looked like a slideshow. Mechanical failures can become library constraints. Adding a block now derives the search, cursor click, palette dismissal, block reveal, and editor focus from one operation. The block's reveal time follows its click time.
The palette selection, cursor click, block reveal, and editor focus. Six-second excerpt, silent.
The review prompt sends one batch of timestamped repairs back to the existing builder:
```text FIX ROUND on (you built it — same worktree/branch ). Frames read, findings (each = timestamp → what's wrong → the fix): - s: → - s: → … Re-still each fixed beat and READ it before re-render. bun run lint + bun scripts/anim-lint.ts clean. Re-render → same mp4 path. Reply ≤6 lines: what changed per finding, any finding you disagree with + why, mp4+branch. ```
That is a historical template. The preserved linter's default discovery can miss later DSL films, so its clean result does not establish full audit coverage. Checks must target the intended film, and the repaired motion still needs playback review. ### How VO sync works Narration describes the authored visuals. `scenes.ts` defines scene names and minimum visual durations; `narration.ts` associates speech with those names. The `vo-sync` script generates an [ElevenLabs](https://elevenlabs.io) clip per scene and measures its duration. A hash of text, voice, model, and settings lets unchanged scenes reuse accepted takes. Each scene gets the longer of its visual minimum or its audio plus padding, rounded up to a tenth of a second: ```ts const durationSec = Math.max( s.minSec, Math.ceil((audioSec + pad) * 10) / 10, ); ``` With the default 0.7-second padding, a 14.237-second clip extends a nine-second visual minimum to fifteen seconds. Generated timing and the audio manifest move the next scene and clip to the same new start.
The measured clip extends the beat to 15 seconds. Subsequent scene and audio starts move together.
The measured clip extends the beat to 15 seconds. Subsequent scene and audio starts move together.
This aligns scene boundaries, not individual words. An action at two seconds stays there unless its timing is explicitly revised. Duration-relative camera moves can absorb a longer read; smaller beats and playback review keep the key actions with the relevant speech. ## Components ### The DSL and how it was designed The DSL is an ordinary TypeScript library. Its declarations separate what exists, what happens, and where the viewer looks: | API | What it owns | | --- | --- | | `defineWorld` | Named blocks, configuration rows, references, example outputs, and layout derived from product geometry. | | `scheduleRun` | Block start/finish times, dependency waits, wire travel, and downstream resolution. | | `simulate` | State at a requested time, derived from scheduled events. | | `buildScript` / `workspaceScript` | Construction actions and their cursor, editor, and panel behavior. | | `planFilm` | Beat claims, durations, camera direction, and cumulative starts. | | `highlight` / `marksAt` | Emphasis on named objects or fields, using their actual geometry. | A run's finish time supplies the completion ring, outgoing pulse, downstream value, and log entry. Maintaining one schedule removes timing values an agent would otherwise have to keep consistent.
One scheduled finish supplies several visible consequences. Each view reads the same event.
One scheduled finish supplies several visible consequences. Each view reads the same event.
The simulation computes state from events up to the requested time. Remotion can render frames out of order, so a frame cannot depend on having rendered the previous frame first. World processes use film time. Camera and highlight direction can use time local to a beat. In this source excerpt, `W` and `plan` are declared earlier: ```tsx const coldRun = scheduleRun(W, { t0: plan.at("the-workflow", 0.8), }); const References: React.FC = () => { const {t, tFilm, dur} = useBeatClock(plan, "references"); const marks = marksAt(W, [ highlight( [row("answer", "Messages"), block("retrieve")], {in: [2.2, 0.5], out: [dur - 1.4, 0.9]}, ), ], dur); return ; }; ``` `coldRun.at(tFilm)` preserves the run across cuts. `marks(t)` starts a highlight window within the current beat. The author names the Messages row and its source block; the renderer supplies their positions and shared emphasis. These are authored demonstrations. Invoice contents and responses come from film data, and some final log values are authored too. The renderer does not execute business APIs to discover the outputs. Ordinary React remains available for scenes outside the DSL, with fewer built-in guarantees. I designed the language from successful films and repeated failures. Fable, a model I temporarily had access to through Claude Code, supplied many of the strongest early examples. When access ended in June, I tried to preserve its decisions through annotations and components that Opus could reuse. Components helped, but Opus could copy a film's overall structure and still show a table changing without a write operation causing it. Successful Fable examples also contained hand-positioned overlays and independently timed elements that other agents copied incorrectly. When Fable access returned in July, new films and their traces supplied more examples. I asked for the shared model directly:
```text i think I want a "simulation engine" is the thing -- it should basically run the model, logs renderer of that state model happens in real time, chat of that happens in real time as well if u know what i mean. is that a lot to ask for? basically an animatable sim-world. I think it's mainly state management / reducer with actions wdyt ```
Distillation meant moving those relationships into examples, instructions, and software. It involved no model-weight training. The DSL turned “highlight this row” into a reference to existing geometry and made workflow views consume common state. On July 7, nine agents built the same Slack IT-triage brief, three each using Sonnet, Opus, and Fable, without VO. I judged Sonnet's films comparable. All three tiers could still miscoordinate a click and block reveal; that defect became the shared add-block sequence. The comparison established useful fixed-brief execution, while cheaper-model original ideation remained untested. ### Components of a good explainer video Each beat needs a visible claim. A second run needs another teaching purpose, and the camera needs a reason to move. **Visual pointing** makes a relationship visible through synchronized emphasis. A reference field and its producing block light together; the reference turns into its resolved value where it already sits.
A reference and its source share emphasis, then the reference resolves in place. Original narration.
**Controlled comparison** holds enough constant to identify the change. A memory explainer repeats the same question with memory off and on. In the invoice film, the manual and automatic rows have different invoice values but share the same fields and clerical task.
The workflow runs, writes an invoice row, and compares it with the manually entered row. Original narration.
**Provenance** connects a result to the operation that produced it. **Continuity** keeps the same objects and layout recognizable while attention moves between them. **Behavior before anatomy** gives the mechanism something to explain. The invoice film establishes manual entry before building the workflow, then returns to the inbox to show invoices being processed while the cursor remains still.
The next morning repeats the inbox setting with automatic table updates. Original narration.
Narration supplies the names and reasons that the picture cannot convey. A claim string or a motion audit cannot judge whether this explanation works; the rendered sequence is the evidence for review. ### Supporting files A new agent reads the repository's instructions and relevant accepted and rejected examples. Film-specific files preserve the data and timing it must keep consistent. | Files | Responsibility | | --- | --- | | `CLAUDE.md` / `AGENTS.md` | Production order, repository conventions, product constraints, review requirements. | | Product source and schema references | Real interface components, field names, options, and legal workflow behavior. | | Notes and visual scripts | Viewer confusion, beat claims, visible actions, and source grounding. | | World data, layout, `Video.tsx` | Shared objects, schedules, geometry, and rendering. | | `scenes.ts`, `narration.ts` | Ordered beats, visual minima, and corresponding speech. | | `_generated/vo-timing.ts`, audio manifest and MP3s | Measured durations, cumulative offsets, and cached takes. | | Accepted critiques, `REJECTED.md`, case studies | Decisions and failure examples future agents need to read. | Examples must change when the API changes. Otherwise an agent can copy the fragile technique from a recommended film even after a safer operation exists. The [public creator repository](https://github.com/ouiliame/sim-explainer-creator) preserves the earlier component-based harness and annotated examples. It predates the mature Academy DSL. ### The prompts and subagents The production skills divide the work: | Skill | Responsibility | | --- | --- | | `sim-video-ideate` | Explore distinct concepts. | | `sim-video-brief` | Specify the story, workflow, claims, and constraints. | | `sim-video-fleet` | Dispatch candidates and organize refinement and synthesis. | | `sim-video-review` | Inspect rendered work and return specific repairs. | The `video-builder` subagent owns one complete candidate. Its system prompt supplies the shared contract:
```text You build ONE complete Sim explainer video end-to-end, in your OWN worktree, from the CONCEPT brief you were handed. You have zero session context beyond this prompt — everything you need is in the repo. This system prompt is the INVARIANT: the conventions, the build order, the verify gates, and the report format that every lane shares so that lanes are comparable and recomposable. ```
The fleet adds the variable concept. The following is the opening of the repository template; setup and verification instructions follow it:
```text Build ONE complete Sim video end-to-end: variant — "". CONCEPT: <2–4 sentences describing THIS staging's distinct visual metaphor, camera language, and structural idea. Make it genuinely different from the siblings — a different lens on the same idea, not a re-skin.> ```
A separate `engine-folder` agent turns repeated implementation into shared operations. Its task template requires proving the change on an accepted film:
```text ENGINE FOLD: . Precision over speed; kill DOFs, derive. READ FIRST: . THE FOLD: . Back-compat: raw props still work, zero breaking changes. ACID TEST: re-point ONE golden onto the new construct — its code must get SHORTER with identical-or-better frames (still-gate before/after, READ the pairs). Re-render. Refresh the golden. REPLY: API shipped (signatures), what was mis-ordered before, lines saved in the acid test, before/after verdict, branch. ```
The builder fixes the current film. The engine-folder updates the operation, its checks, and the example future builders will copy. --- ## How to give your AI taste URL: https://www.wcdc.io/writing/how-to-give-your-ai-taste Date: 2026-09-14 Description: How examples and feedback turn personal judgment into guidance an AI can use. Taste is not a moat by itself. When a model can reproduce much of what makes a design good from a screenshot, those decisions become available to someone who could never have made the original. Good taste still helps you choose the example and judge the result. But even that choice can begin with a collection someone else has curated. You can borrow more of their judgment than the phrase “taste is the moat” suggests. The practical question is how to give AI enough of that judgment to produce work you like, without personally correcting every decision. ## Examples carry more than rules We've been trying to explain good writing for a long time. [The Elements of Style](https://www.gutenberg.org/ebooks/37134) offers useful guidance, but giving everyone the same style guide doesn't make everyone an equally good writer. “Omit needless words” leaves you with the difficult part: deciding which words are needless. A sentence can repeat a point, or supply the missing reason that finally makes it clear. Both make the paragraph longer. Taste doesn't need to be mystical for this to be hard to describe. A preference can depend on several choices working together, and we often recognize the result before we can explain those choices. A good example preserves that interaction. An article shows how much context the author gives before making a claim, where an example helps, and when the explanation has gone far enough. “Write clearly” contains none of that detail. A site can use dithering to turn photographs into patterns of dots while keeping the type crisp. Applying that texture everywhere would make the text harder to read. Both versions could fit “make it retro.” A reference shows how the image treatment, type and empty space work together. When people say taste is the moat, I think they're pointing at the ability to produce better work when everyone has access to similar models. Quality is the advantage. Taste matters because it steers the model toward that quality, and examples let some of that steering happen outside your head. ## The best examples are annotated A reference still leaves an ambiguity: which part do you want? When I give AI an article whose prose I like, I want its diction and pacing. I don't want its subject matter appearing in my essay. A model can imitate the wrong property while following “write like this” quite faithfully. In a transition, a thumbnail can expand into a larger view while the same image stays visible throughout. An annotation can point out that continuity and the way the background recedes, instead of asking for a “smooth animation.” A sequence of frames records what changes and what stays recognizable. The original clip is still needed to judge the timing. While working on *Thinking in rhythms*, I kept asking for simpler writing. Some revisions cut the explanation until they barely said anything. Others added so much explanation that a useful intuition became a textbook. The preference wasn't just for fewer words. I wanted enough reasoning to understand the idea, with no repeated explanation after it had landed. A reference paragraph and a note about where it stops convey that much better than “be concise.” For example, “Clear briefs improve AI writing” states a conclusion. A more useful explanation would be: > A brief tells the writer who will read the piece and what they need to understand, so it can judge whether a paragraph belongs. The annotation can name the difference: “This explains how the brief changes a writing decision. Its extra words supply the mechanism. Shortening it to the first sentence would remove the explanation.” My prose rules include rejected passages beside better versions, with notes on what changed. The comparison makes a rule such as “avoid artificial punchiness” less ambiguous. The writer can see the sentence that failed and how a complete, ordinary sentence does the same job. A whole article is useful for structure and pacing. A short comparison isolates one decision. Keeping both gives the model a target at each level. ## Selection is easier than specification It's often easier to choose between two openings than to describe the opening you want from a blank page. The alternatives give your judgment something to react to. That changes how you can develop the instructions. The first version doesn't need a complete theory of your taste. It needs enough direction to produce attempts worth comparing. After a correction, the useful thing to save is the choice and its reason. “I prefer B” helps with this draft. “B names the reader's problem before introducing the framework” gives the next draft a decision it can reuse. Some preferences won't have a clear explanation yet. The comparison is still worth keeping. Asking AI to propose reasons can help you articulate the difference, but its first plausible explanation shouldn't automatically become a rule. Repeated examples reveal the scope. You might prefer a short opening in several practical articles and a longer opening in a personal story. Recording what each piece was trying to do keeps those preferences from turning into contradictory instructions. This is how a taste guide can grow through selection. You collect decisions made on actual work, then revise the instructions around patterns that keep recurring. You don't have to invent a comprehensive guide before making anything. ## Taste has to meet other people A collection of things you like can also become a way to repeat yourself. More agreement between you and the model doesn't establish that the work has improved. Taste is, in part, what has worked condensed into judgment. That judgment needs contact with the people the work is for. If an explanation feels elegant to you but readers can't use it, something in your idea of a good explanation needs updating. For an article like this, a useful response is a reader explaining how they would apply the idea to their own work. If they repeat the heading but can't describe what they would do differently, the article may have named the idea without teaching it. Other work needs other evidence. A product page has to help visitors understand the product. A story might succeed because someone finds it moving or funny. “Effective” depends on what you meant to make, not one universal metric. Getting more people involved expands the feedback available to you. A writer can catch a structural problem, while a reader unfamiliar with the subject exposes the context you assumed everyone had. Their disagreements are useful because they test different parts of the work. I want those observations beside the examples too. A passage I liked but readers misunderstood teaches me something a folder of favorites cannot. ## A reviewer needs something to test Rules and references give the writer direction. A rubric gives the reviewer specific reasons to reject a result. “Is this a good article?” leaves too much room for agreeable commentary. For an explanatory essay, the questions can be more concrete: - Does the opening identify a problem the intended reader recognizes? - Does each main conclusion have an explanation or example that supports it? - Could a reader apply the idea to a different case? - Does any paragraph repeat a point without adding useful information? An adversarial review looks for where the draft fails those tests. It should quote the passage and describe the missing step. That gives the writer something to repair; a high score alone doesn't. The context of the review matters. After a long conversation, the model has seen your explanations of what the draft means. It may understand the argument because you explained it in chat, even when the article never does. A fresh reviewer receives the rubric, the draft and a description of the intended reader. It cites the passages that support its judgments and flags explanations it had to supply itself. It can still overlook a gap, but it no longer has the original conversation filling gaps for it. The rubric needs checking too. A test for short paragraphs is easy to satisfy by deleting reasoning. A reviewer should be able to reject a draft that obeys the style rules but fails to explain its subject. ## A small system is enough to start The material can live in [Notion](https://www.notion.com/), a reference collection in [Are.na](https://www.are.na/), or a folder of Markdown files. The model needs access to the actual examples and annotations, not just their titles. For a writing task, a small folder could contain: ```text taste/ brief.md references/ corrections.md review.md ``` The brief says who the piece is for and what they should get from it. The references show the intended quality. Corrections preserve the choices made during earlier work, and the review file holds the questions used to judge a draft. The next writing session reads the relevant material before drafting. A separate reviewer checks the result, and feedback from readers can change the examples or questions you keep. [My writing process](https://www.wcdc.io/writing/how-to-write-with-ai) also separates the argument from the final voice pass, so a style repair doesn't hide an unresolved idea. A useful first test is whether a new session can handle a related task without you repeating the old correction. If the mistake returns, checking whether it read the reference comes before rewriting the reference. The annotation may be unclear, or the model may need help applying a decision you've already explained. --- ## 9/14 - System Snapshot: How I'm Running My Life with AI URL: https://www.wcdc.io/writing/system-snapshot-2026-09-14 Date: 2026-09-14 Description: My current setup and the work I still coordinate myself. I'm sharing this publicly as a working note for myself about the system I'm building. It records what I'm using, how the different activities connect, and the unfinished parts I need to return to. I'm currently unemployed, living in San Francisco, and trying to keep the things I care about moving while I look for work. It's been a difficult period. Having more time hasn't automatically made it easy to stay engaged with everything I want to do. Job search and Idyllic get most of my attention. The businesses and writing give me work to do with agents, while languages, study, exercise and life with other people have their own reasons to be here. I still initiate much of the work and carry context between these activities. ## My current AI stack I record thoughts on my Plauds while walking and talking. The transcripts preserve how I arrived at an idea, including the questions and qualifications that disappear in a short summary. Alongside years of journals, they supply material for writing and for agents working with me. **ai-organs is the heavy context center.** It holds daily logs, journals, goals and personal records. Its domain tools cover things such as habits, health and Korean study; an agent reads the relevant records and combines them for the task at hand. My macrostates describe conditions I'm working toward, so that history has a direction as well as a chronology. The distinction between shared context and project work matters in daily use. A writing agent can recover an experience from my history, but the essay's drafts and illustration assets belong in its own folder. Decisions about the article stay with the article, where the next session can inspect them. The interfaces I use around that context have different jobs: - **Codex** is my main work interface for research, coding, writing and study. - **OpenCodex** extends that setup to mobile and multiple AI accounts. Most of my work still happens locally in Codex. - **Aside** gives me an agent in the browser, with access to signed-in websites and browsing context. - **Notion** is a loose document workspace where I've tried writing processes and inspected intermediate material. Its freely arranged pages also inform what I'm looking for in an Idyllic interface. - **Linear** holds the work queues. ## Job search and technical preparation My background is in developer tools and programming languages. Before Idyllic, I worked in the Terra and CosmWasm ecosystem, building SDKs, simulators and CWScript. Agents help research roles and organize evidence of that work; I handle introductions and conversations. The technical stage of interviewing makes me insecure because I haven't coded by hand in a while. Building through agents and demonstrating the same abilities unaided require different preparation. React fundamentals, TypeScript, debugging, data structures and algorithms are the areas I need to practice, alongside explaining the decisions in my previous projects. Writing up those projects already gives me something useful for the search: public explanations I can point to. It also makes gaps in my own explanation apparent before I have to answer questions in an interview. ## Micro-businesses and Busibody A friend told me he'd reached roughly $1m in annual recurring revenue with a business that agents helped originate and run. That encouraged me to test a couple of stealth micro-businesses and learn more about the work around an offer. My technical background doesn't answer the GTM questions automatically. Who needs this? What would make the offer understandable to them? Where would they encounter it? The experiments give those questions a specific offer to work on, with external examples and market observations to learn from. **Busibody provides shared infrastructure across the businesses.** Each business has its own context, while common tools and records support the operating work. Needs that recur across the experiments inform what belongs in Busibody. I'm still directing the work; customer demand and revenue remain things to establish. This is one connection to Idyllic: a business needs more than an agent capable of completing an isolated task. I have to supply the right context, inspect what happened and decide what follows. Building shared business tools gives me concrete coordination problems to work on. ## Writing and public presence My writing queue contains ideas from conversations, recorded walks and project work. For a selected piece, agents recover source material and help draft it. I choose the substance and review the result. That process has produced published work. On September 11, I published Thinking in rhythms, How to write with AI and Mental models for working with AI on my site. The useful material comes from explaining an experience closely enough that someone else can understand the decision or mechanism involved. Working with agents on those pieces also exposes review problems. A change to the argument can require new prose, while a request to fix one sentence should preserve the rest. When an agent loses that distinction, I have to reconstruct what we'd already agreed on. That is a specific requirement for Idyllic's treatment of context and review history. My website, X and LinkedIn are the current publishing channels, with GitHub providing technical examples. YouTube and a collection of educational material for founders and agents remain possible extensions. The unresolved question is how useful public work leads to more conversations, collaborators and paid opportunities. ## Languages and education These interests have histories that predate the AI setup. Their current activity levels vary, and much of the structured study is still in the queue. ### French I first taught myself French, then spent a year at a French lycée in the literary Bac L track, studying philosophy and literature. I reached academic fluency and earned **88/100 on the DALF C2**. French became a language I read and thought in. I read deeply in philosophy and literature, and the French essay tradition influenced how I approach a question: identify the tension, then develop an argument that addresses it. That background is part of how I write now. I'm still conversationally fluent, but rusty relative to my strongest period more than ten years ago. The aim is to recover ease, precision and range through subjects that hold my attention. Regular AI voice conversations about books and ideas are a proposed practice, not an established routine. ### Korean I've lived in Korea, and Korean is part of my family and community life. My grammar knowledge is ahead of my spontaneous speaking: understanding a construction doesn't mean I can retrieve it quickly in conversation. A recent Korean church visit made the listening gap concrete. I enjoyed being there and meeting people, but couldn't follow the sermon. The language matters because it changes how directly I can participate in that community. I have iTalki lesson material and vocabulary and grammar records in my Korean study tools. Those give a tutor specific material to work from. The practice I still need is listening and producing language in conversation, especially about everyday life and subjects I already discuss at length in English. ### Mathematics and ML I studied mathematics and computer science at Berkeley, including linear algebra, discrete mathematics and probability. My current study interests include proofs, probability and statistics, with information theory and cybernetics connected to my interest in systems. Much of my technical experience comes from building languages, runtimes and developer tools. Building a language model from scratch is on my study list because it would connect the mathematics to the models underneath the tools I use. Working through implementations and derivations is the missing practice here. ### My study and practice queue These are candidates and materials to work from, rather than a claim that I'm taking all these courses: - Stanford CS336 and other LLMs-from-scratch material combine the theory and implementation work I'm looking for. - The "Modern Developer" series is also on my list. Coursera, MIT OpenCourseWare and Stanford are sources for structured study. - My DesignCode library holds references for React, interface design, animation and agent workflows. It already gives me examples to inspect when a project calls for an unfamiliar technique. - Coding quizzes and exercises could support interview preparation. For languages, I'm considering topic-based voice practice during walks or cardio. - Recurse Center, coding dojos and salons are possibilities for learning alongside other people. For a course workspace, the unresolved interface question is concrete: after several days away, where do I see the last exercise, the part I struggled with and the next assignment? That belongs among Idyllic's design questions, even before I have a dependable study routine. ## My body, my day and life with people I've trained on and off for years and built a substantial strength base. Keeping that training present through changes in work and routine has been harder. My current goals are to get leaner while retaining muscle, improve bodyweight strength and build aerobic fitness. A recent 35-minute elliptical session left me feeling grounded despite the resistance I felt beforehand. Walking and pickleball also give me movement I enjoy. Food at home and sleep support the same goals; activity and body records let me look back at what happened instead of relying entirely on how the week feels. Being unemployed also means choosing more of the day's structure myself. Logs and check-ins help me see where the time went and return to priorities. I've also configured a weekly review. I live in San Francisco with my wife. Shared meals, outings and household coordination belong in this arrangement too; Winha's Slack surface is one part of that shared work. Correspondence and practical documents need somewhere findable when a decision or follow-up comes up. Church, sport and learning groups offer different kinds of contact with people. The Korean church visit connected language practice with community, and pickleball gave me both exercise and time with others. Those activities meet needs that an agent conversation doesn't cover. ## What I'm building with Idyllic The current Idyllic direction comes from managing this arrangement myself. Busibody has recurring business operations to support. Writing produces decisions about context and review. Study raises questions about returning to unfinished work. I still remember many of the connections and supply the next prompt. I have a local workflow prototype that runs model steps and pauses for my feedback. It retains the inputs, outputs and review history for an execution. So far, I've tested that behavior on hypothetical material. The design work has two main questions: - What structures can take over repeated coordination that currently depends on me prompting or relaying context? - What does the interface need to show so I can understand what happened, what it relied on and where my judgment is needed? Agent journals are one requirement I'm considering. An agent helping with a business needs contact with the market; a tutor needs evidence of what I can do. Recording what it tried and learned would make that evidence available to the next agent, with less of the explanation passing through me. I'm approaching the work from both directions. Participating in the activities supplies concrete problems, and examining their relationships helps me decide where shared infrastructure could reduce the work. I'm studying what becomes difficult as the arrangement grows more complex. Eventually, I want other people to design their own setups and delegate more to an agent version of themselves. The questions I can work on now come from the system I'm using and the parts I still have to hold together. --- ## How to write with AI URL: https://www.wcdc.io/writing/how-to-write-with-ai Date: 2026-09-11 Description: Writing as a compilation process, from scattered notes to a clear argument and readable prose. I have more material than I can turn into essays. I write journals and talk through ideas on walks. By the time I sit down to write, I have fragments from several different conversations about the same thing. AI is useful here because it can help me recover those fragments and work out how they belong together. Sometimes a raw dump and a request for a polished essay are enough. When the result misses, though, another rewrite can improve individual sentences without getting much closer to the piece I wanted. I want writing that communicates what I mean and doesn't make the reader work through an unpleasant synthetic voice to receive it. To make that work with agents, I needed a way to specify the decisions behind the sentences. ## Substance and voice need different edits When a draft feels wrong, I ask whether it gives the reader something they didn't have before and whether its points follow from one another. I also ask whether the prose is pleasant to read. I may agree with the argument and still dislike reading sentences that feel airy, repetitive or assembled from familiar phrases. Those questions lead to different edits, but the dimensions affect each other. Missing reasoning can make a sentence generic, and bad phrasing can obscure a precise thought. Separating the questions helps me avoid treating every problem as a request to “make it sound more human.” I call the things a piece gives its reader substantives. A useful fact qualifies, but so does a nuanced argument whose value only becomes clear after several paragraphs. A worked explanation can be the main reason to read it. For [*Thinking in Rhythms*](/writing/thinking-in-rhythms), I wanted to unpack the promise of agents working around the clock. Work waits for incoming information, another task to finish, or a human decision. Because work has dependencies, removing the need for sleep doesn't remove every reason to wait. The right schedule depends on what can become actionable between runs. An outline containing “autonomy,” “triggers” and “human rhythms” wouldn't preserve that argument. Those headings name topics. A causal spine records why one point follows from another, which is the part I needed the reader to understand. If that relationship is missing, another voice pass won't supply it reliably. AI-generated content sometimes reminds me of scar tissue. It is functional and continuous, but it lacks the texture of the thing it replaces. I feel that when every sentence resolves into a familiar shape, as though a small set of phrases were doing the work of a much more complicated understanding. The text could move to another topic with a few nouns changed. It doesn't seem to have encountered the awkward case that would force the writer to qualify the claim or choose a more exact word. Simple language can carry a complicated model. “The task was waiting for my decision” is plain and precise. “The task had reached a point where human input was required for further progress to be possible” makes me work harder to receive the same information. Other cases need more explanation. A paragraph about running agents faster needs to distinguish finishing earlier from reaching the next useful step earlier. Removing that distinction might make the paragraph shorter while making the thought less accurate. I associate good writing with the pressure of those decisions. The writer's understanding includes cases where an obvious claim fails, so a qualification has a reason to be there. Their sense of the reader changes which example they choose and which steps need explaining. I want the specific thought to determine the prose. Adding quirks to disguise AI involvement would give me another layer of performance to remove. My suspicion is that much of the complaint about AI writing comes from the experience of reading something bad. The prose promises an insight and delivers a familiar conclusion. Whether AI helped produce a piece matters less to me than whether the piece was worth reading. ## Writing is a compilation process A sentence belongs in an article because of what its paragraph needs to explain. The paragraph's job depends on where the argument has reached, which depends on the structure of the piece. Even an elegant sentence can be wrong if those earlier decisions are wrong. Following those dependencies backward brings me to the thing I want to communicate. The spark determines which questions I research. What I learn helps me choose a form. The form and material constrain an outline, which gives the sections and paragraphs their jobs. The sentences make those decisions visible. This is why I think of writing as a compilation process. An intention becomes an account of what I mean, then a structure for explaining it, then prose someone can read. Each representation makes decisions that the next one relies on. | Stage | What it settles | | --- | --- | | Spark | What I want to share, and why it might matter. | | Research | Which material belongs, what it supports, and what remains unclear. | | Form | Whether the piece should explain, argue, teach a process or do something else. | | Causal spine and outline | What the reader needs to understand first, and why each point follows. | | Headings and paragraph beats | What each section and paragraph must accomplish. | | Sentences | How each paragraph expresses its particular thought. | | Stylistic choices | The words, rhythm and transitions through which the reader receives it. | These decisions still have to be made when I ask for an essay in one prompt. The model fills in whatever I have left open. Feedback such as “more insightful” or “less AI” asks it to revise the result without identifying which decisions failed or which ones should stay fixed. The next version might improve the voice while quietly changing the point. That explained my frustration with stylistic passes. I was trying to settle individual expressions while the claims and structure were still changing. Editing only the sentences was like patching binary bytes while the source program kept changing. Unless the reason for a correction reached the source, the next compilation could lose it. To delegate a stage, I need to specify what its output must preserve. Suppose a paragraph must explain why an agent that finishes earlier can still wait until the same human review. The model can choose an example and find the wording. A paragraph that merely recommends running agents more often has failed the assignment, however well it reads. I call that specification a macrostate. It describes conditions that many different outputs can satisfy. Each stage reduces the degrees of freedom for what comes next, while leaving room for choices that don't change the intended result. Once a paragraph's meaning and role are settled, I can leave much of its expression to the model. The intermediate decisions make the conditions I started with specific enough to delegate: the piece has something worth reading, and the prose isn't painful to read. I don't need one uniquely correct essay. I need to know which differences are harmless and which ones violate what I wanted to communicate. ## From a spark to a working brief “What does it mean for an agent to work for you 24/7?” was the useful question for [*Rhythms*](/writing/thinking-in-rhythms). It gave the research a purpose. I was looking for material that could help resolve that question, rather than everything I had ever said about agents. An archive search can help find a spark, too. Several notes might return to the same unresolved problem. I still need to choose what I want to communicate, because the most frequently mentioned topic isn't necessarily the thought worth developing. When a phrase already expresses the thought well, I keep it with the brief so the surrounding paragraphs can grow around it. Adding the phrase to a finished essay later risks making it fit a structure that was built for another point. A walking note often assumes context I had in my head. It may contain the conclusion without the event that prompted it, or a complaint without the distinction that would make it useful to someone else. For the rhythms question, relevant material included why teams meet at regular intervals, where work accumulates and what a person actually decides when an agent needs help. A note about a model's reasoning ability might share the same vocabulary while contributing little to that explanation. A collection of matching quotations still leaves the writing problem unsolved. I want an account of what those quotations mean together, where they disagree and what remains unclear. AI can propose connections I hadn't articulated, but I need to distinguish its interpretation from something I actually said. An explanation that sounds coherent can still assign me a position I don't hold, or turn a tentative idea into a conviction. My working brief contains: - The thought I want the reader to receive, and what prompted it. - What the reader probably believes already, including the confusion the piece should resolve. - The relevant evidence and what it supports. - The claims and distinctions that must survive, including anything still uncertain. - Any exact phrases worth preserving. That brief is easier to disagree with than a polished essay. I can point to an interpretation that is wrong before several paragraphs depend on it. Once the research has clarified the thought, I choose a form. A guide needs to leave the reader able to do something. A mental-model essay needs to develop a way of seeing a problem and show what that perspective changes. I use existing articles as references for how those explanations develop. A useful template might introduce a familiar problem, follow a concrete case until the usual explanation fails, then derive a better model from that failure. It tells the writer what each part must accomplish without borrowing the reference article's claims or anecdotes. Within that form, I work out the causal spine and each paragraph's job. If the outline contains a claim and a conclusion but no explanation between them, I can address that before generating the prose. ## Saving decisions and revising the draft Chat is useful for challenging an interpretation or explaining why something bothers me. But the current understanding needs a home outside the sequence of attempts, so the next request doesn't have to infer which parts still govern the draft. I keep one folder per essay in `~/projects/writing/essays/`. `BRIEF.md` holds what the piece is trying to communicate. The `pad/` folder holds research and the causal outline. Numbered drafts preserve earlier versions, and `REVISIONS.md` records what changed and why. My journals stay in my personal archive. During substantive review, I ask whether the piece says what I meant and supplies the steps a reader needs. A comment such as “make this more insightful” gives the next attempt too much to guess. “This explains how to schedule a run, but the reader still doesn't know what could become actionable between runs” identifies a particular hole in the explanation. The correction belongs in the outline as well as the passage. Once a section works, I keep it. A request to improve the ending shouldn't silently regenerate an opening I have accepted. If drafting exposes a contradiction, I return to the underlying claim and revise the paragraphs that depend on it. The saved decisions tell me where the change belongs. ## Voice work after the substance holds together I give the writer voice references early, then use a focused voice pass once the substance holds together. Unslop skills and filters can flag stock transitions, excessive symmetry or sentences that announce an insight instead of stating it. My shared prose skill lives in my agent skills folder. `structure.md` governs how an explanation develops, `register.md` records patterns I keep rejecting, and `examples.md` shows better writing. A new session can read those files and the essay's brief before making a change. Some rules are blunt. I don't use em dashes in these essays. I ask for complete sentences instead of fragments such as “Same craft, different physics.” I cut “Here's the core idea” when the next sentence can just state the idea, and flag repeated “it's not X, it's Y” constructions. Other rules protect the explanation. Name who does what. Give “this” and “that” clear referents. Keep the steps that make a conclusion follow, even when they take another paragraph. A list of prohibitions can remove obvious tells while leaving the writer unsure what good prose should do, so I also keep positive examples of patient sentences that carry the reasoning. When an entire section has the wrong rhythm, I would stop repairing it sentence by sentence. A fresh pass can use the settled argument and a positive voice example, with the selected phrases preserved, to produce that section again. Sections I have already accepted stay unchanged. For this kind of writing, I find Opus 5 basically unusable. The prose is often so airy that I have to stop and work out what a sentence is saying. GPT 5.6 Sol has been much easier for me to steer toward the voice I want. These are my preferences from using them, and I expect them to change as the models improve. Passing a style filter doesn't establish that a conclusion follows. I still have to read the explanation. If polishing removes the qualification that made a claim accurate, it has damaged the piece while making the sentences smoother. Turning months of journals into an essay involves more unresolved decisions than turning a settled thought into a short message. If a direct request already gives me writing I would use, there is no reason to manufacture a larger procedure around it. I expect better models to take on more of this work. What I want to retain is the spark and the understanding of what the piece should give its reader. Those let me judge the result, explain what missed, and decide when the writing is good enough to share. --- ## Mental models for working with AI URL: https://www.wcdc.io/writing/mental-models-2026-q3 Date: 2026-09-11 Description: Quarterly notes on examples, macrostates, learning systems and working with abundant intelligence. I've been collecting the mental models that help me reason about working with AI. These are my current notes, drawn from writing, building software and trying to run businesses. I plan to revisit them each quarter as the tools and my own practices change. ## 1. Great artists steal The winning strategy in a game where machines can imitate styles and reproduce good work is to copy what works, not spend years acquiring the skill to produce it yourself. Seeing a good example used to leave a large gap between recognizing its quality and being able to make something like it. AI can now do much of the work across that gap. That changes the return on spending years developing a capability that a model can already approximate from a reference. A finished website encodes thousands of decisions about what to show, how to arrange it and what a visitor needs to understand. Describing each decision in a prompt would be difficult even for someone who understood them all. The example also preserves how those decisions work together. Showing the model a page that produces the intended effect gives it a much richer starting point than a request for something spacious, clear and confident. Taste is overrated as a prerequisite. Even the judgment used to select an example can be borrowed. A designer whose work you respect may already have put together a useful collection. Taste keeps moving up a layer: choosing whose selections to use can replace the need to develop all the judgment behind those selections yourself. Humans have always learned through examples. AI makes more of the decisions inside them available for immediate use. The remaining work is to adapt the example to the actual problem. The model can help identify which decisions should transfer and which need to change. Once a result works, each revision can preserve the good decisions while exploring the unresolved ones. An illustration might keep its composition and drawing style while changing the relationship it depicts. Starting from existing work and refining it locally concentrates invention where the reference has no answer. ## 2. Macrostates over microstates An essay needs to communicate an idea and be good to read. Many different drafts can satisfy both. Those drafts are different microstates within the same macrostate: the relevant properties remain the same even though the sentences change. If two drafts preserve the argument and the intended voice, the difference in their exact wording may not matter. The distinction continues down through the work. Several outlines can support an argument. Within an outline, several paragraphs can do the same explanatory job. Within a paragraph, several sentences can preserve the meaning. One exact phrase might matter while the wording around it remains open. The boundary follows what matters in the work; it doesn't have to sit at the same level everywhere. This gives an agent a space of acceptable choices. Specifying every sentence leaves very little for it to do, while “write a good essay” leaves it guessing at important decisions. A brief can specify the reader's starting confusion, the understanding they should leave with, and the argument that gets them there. The agent can resolve much of the prose underneath those conditions, and the author can evaluate whether the result preserves them. A website may need to explain an offer and make booking easy, while leaving hundreds of layout decisions open. As models become more capable, more of those decisions can happen below the level that needs human attention. Being exacting about a result doesn't require micromanaging every choice involved in producing it. It requires knowing which properties matter enough to constrain the work. ## 3. The digital exoskeleton The future knowledge worker is a cyborg with a digital exoskeleton. Several systems surround the person, each carrying an ongoing part of their life. Some operate businesses that generate income. Others help develop a network and make friends, or turn thoughts into writing that reaches people. These pursuits can move forward at the same time because each has somewhere to keep its context, tools for doing work, and a way to learn from what happens. Each system acts as a body for one of those pursuits. A business body can keep track of its offer, perform parts of the service and use customer responses to improve the next attempt. A body supporting relationships can remember conversations, help identify people to meet and bring back a reason to reconnect. A writing body can develop ideas from journals and retain feedback on the resulting essays. Human attention still matters, but the work no longer has to lose its continuity whenever that attention moves elsewhere. The learning is what makes this larger than a collection of automations. A scheduled operation repeats a task. A learning system uses what happened to change what it does next: a response changes an offer, a correction changes a writing rule, or a conversation changes which introduction would be useful. Some operations can run while the person works elsewhere; others wait for a decision. In both cases, the system preserves experience that the next attempt can use. Getting these bodies around yourself early means more of today's activity can improve tomorrow's work. The bodies also supply material for one another. Trying to run several businesses has exposed common management problems for me, which has led to ideas for software to help operate them. Those observations can also feed the writing queue. Writing can introduce people to your thinking; the resulting relationships can lead to new projects. Shared context lets one pursuit use what another has learned. The unit of work becomes a person together with several developing bodies, with more experience and capability than the person could maintain alone. ## 4. Ideas with bodies The human inside this arrangement is also an agent with limited knowledge and attention. An expectation influences a decision; the decision produces a result; that result should change what the person expects next time. Cybernetics describes how action and feedback guide a system toward a goal. Applied to the mind, this makes it possible to inspect how an observation becomes a belief and how that belief shapes a decision. Metacognition brings those normally implicit steps into view. The difficulty is that the mind is also doing the work it is supposed to be inspecting. People forget why they believed something, confuse what they wanted with what they expected, or remember a prediction differently after seeing the outcome. Meanwhile, feeds and advertising systems compete to direct their attention toward other objectives. External tools can preserve an earlier belief and its reasons, making it possible to compare the original expectation with what actually happened. One structure I've been thinking about is a place to keep predictions that gets revisited as evidence arrives. A prediction might concern whether a certain kind of event will help you meet people you want to see again. Its record could hold the expectation, the reasons for it, and what would call it into question. Later notes from attending those events would give a review something to compare with the original belief. Preserving the earlier version matters: otherwise, a model could rewrite the prediction to fit the evidence and hide what needed to change. A prediction describes what is expected; a goal describes what is wanted. Both can have a body in this sense: a persistent record, a trigger that brings them back into consideration, and access to information that might change the next decision. A goal can also have tools for acting on it. New evidence can update its progress, change the route or suggest that the goal itself needs revision, with the reason kept alongside the change. The idea becomes available for continued work between moments of human attention, with its history available to guide the next decision. ## 5. The human bottleneck The context an AI most needs is often information a person could supply in a sentence. A transcript may have no speaker names; a decision may have no record of why it mattered. Reconstructing that context later can take substantial effort or be impossible, even though recording it at the time would have been easy. The person's limited attention is often best spent supplying what the system cannot reliably discover on its own. Capturing context works better when it fits how the person already thinks. Walking helps me develop ideas, and I use Plaud to record them as they form. I can follow a thought without stopping to turn it into a tidy note. Some of what comes out would never have become writing if I had needed to sit down and compose it. For anyone who also thinks well while walking or talking, this is the workflow I'd recommend trying. The transcripts stay with my other context so AI can read them later for a particular purpose. A walk might contain an idea for a business, a thought about someone to contact and part of an argument for an essay. Keeping the full source preserves uses that weren't apparent at the time of recording. A summary made for one purpose can discard the detail that matters for another. Speaker names and the reason for a decision are useful additions. Sorting a thought into the right conceptual category can usually wait. Once the source exists, a model can help organize and interpret it repeatedly. The capture process has to be easy enough that the person will actually use it; otherwise, the rest of the system has nothing to work with. ## 6. Markdown first My daily log is one chronological record split across files. A simple script appends an entry with a timestamp to that day's Markdown file. I keep it alongside journals, chat archives and transcripts. A simplified view of the context folder looks like this: ```text personal-context/ ├── logs/ │ └── YYYY-MM-DD.md ├── journals/ ├── chats/ └── knowledge/ └── transcriptions/ └── plaud/ └── YYYY-MM-DD-walk.txt ``` The log doesn't require each entry to become a task, a person, a belief or a node in a knowledge graph. It can just record what happened or what I was thinking. A few shortened entries from one day's log: ```markdown # 2026-08-29 (Saturday) - [13:20] Keep data and state available on the server. Add computation around it. - [13:23] Try the journaling agent with the last 30 days of context in Markdown before building a knowledge graph. - [22:09] I want my site to show how I think, break down problems, and document the work. ``` That middle entry describes a simplification I was considering for a journaling agent. I had been thinking about a more elaborate memory structure, but reading the last thirty days of context might already give the model enough to do the job. Date order preserves useful relationships without my having to describe them all explicitly. I can ask what changed during a week, which idea keeps returning, or what led up to a decision, and let the model examine the source material. Plain files make it cheap to find out what the work actually needs. Search, a database or more structured records can follow when a concrete limitation calls for them. The input surface can remain a timestamped note even as the machinery reading it becomes more capable. A new use for the archive doesn't have to require a new way of recording a thought. ## 7. Prompting is the interface When describing an outcome is enough to start work, prompting becomes an interface to the computer. Improvements to that interface often remove something that previously had to be explained. A repeated instruction can become a saved skill. A recurring request can become a scheduled trigger. The person still determines what the system should do, but no longer needs to reconstruct the instruction on every occasion. I've had long prompts that I kept firing through a hotkey before turning them into skills. The repetition exposed an operation I wanted to keep. Once that operation had a name and a saved definition, I could invoke it with much less explanation. This is one way a personal interface develops through use: repeated intentions become easier to express. There is another side to a useful interface: it helps the person have the next idea. A Linear board makes waiting essays visible. A page showing several illustrations makes it possible to compare them and identify what needs to change. A view across projects can expose the same unresolved problem in several places. The state of the work supplies information the person can use to give better direction. These are the two benefits I look for in interfaces such as Aside AI (@AsideAI): fewer instructions to repeat, and a clearer view of the work to direct. A useful abstraction does both. It can turn a long request into a selection while showing enough context to suggest a new possibility. As AI takes on more work, the interface matters increasingly for what it lets the person understand and ask for next. ## 8. Intelligence is Water As intelligence becomes more abundant, I've found it useful to think of it as pressure. A task can look like a single step from A to B, while the actual route contains branches, obstacles and places where several paths converge. Intelligence does the work of finding a way through that structure. More of it makes it possible to investigate routes that would previously have demanded too much attention to pursue. Getting a document corrected might involve finding the right office, reaching someone with authority and supplying evidence they can accept. If the office lacks authority, a more persuasive explanation won't help, but another contact might. If several contacts all require the same evidence, those routes converge on a common problem: obtaining it. Each response changes where further effort can be useful. The pressure moves through the openings the situation actually provides. As this work becomes cheaper, an initial refusal can lead to a broader search. AI can investigate which office handles the correction, check alternative forms of evidence and prepare the next attempt using what the earlier one revealed. If one route has to wait for a reply, another may still be available to explore. A process that would consume an afternoon of attention can become several manageable lines of investigation, each retaining what it has learned. The problem hasn't become simpler; more intelligence is available to work through its complexity. --- ## Thinking in rhythms URL: https://www.wcdc.io/writing/thinking-in-rhythms Date: 2026-09-11 Description: How queues, triggers and human review determine when agents can make useful progress. I want to explain what “agents working for you 24/7” would actually require, and how to build a system that makes useful progress while you're away. If you've used an agent to research a question or revise a draft, you already know it can do useful work. The uncertainty begins when that task ends. Who decides what comes next, where does the next assignment come from, and what happens when the work needs you? ## How work moves through a team Suppose a writer, an editor and a researcher keep their essay ideas on a Linear board, with briefs and drafts in Notion. On Monday, they choose which essays to develop that week. The researcher gathers sources, the writer drafts, and the editor reviews what comes back. A short morning meeting lets them decide which work can move forward that day. An editor's comment can become a research assignment while the writer works on another essay. The researcher saves an answer in the linked notes, ready for the writer's return. Because the board and documents retain these contributions, the team can work at different times without asking one person to remember every unfinished exchange. Shared hours still matter. When the writer and editor disagree about the argument, a conversation lets each answer shape the next question. Once they agree, they need time apart to do the work. Sleep gives that separation a [daily biological rhythm](https://www.nhlbi.nih.gov/health/sleep/sleep-wake-cycle), although people differ in when they sleep and work. The team can choose its meeting intervals. Reconsidering the week's priorities every ten minutes would interrupt the work those priorities were meant to organize. Leaving an unanswered question until next Monday could hold up an essay all week. Weekly planning and daily review give different decisions a useful interval, with a conversation between meetings when something cannot wait. Now suppose the researcher no longer needs sleep. They can spend the night checking sources and preparing findings for morning. An assignment to “develop this idea” still leaves them waiting if the writer has not explained the idea. Removing sleep gives the researcher more time to act on what the team already knows; the extra hours do not supply the writer's missing intention. ## Which work can continue without you? An agent faces the same distinction. An agreed brief may give it enough direction to write a draft before asking for feedback. In an interview, each answer from the writer can change what it asks next. Checking a quotation also requires repeated feedback, but the source itself supplies it: the agent compares the words, corrects the mismatch and checks again. We can separate how often the work needs feedback from whether a person must provide it. A completed draft can wait for the writer's review. An interview needs their participation throughout. Frequent feedback alone therefore tells us very little about whether the work can continue while the writer sleeps. The matrix describes phases of work, so an essay can move between its cells. A live discussion settles the argument. Research and drafting then proceed independently, and the finished draft returns for review. The agent may make hundreds of small checks during the independent phase without needing a person at any of them. The amount of work that can proceed alone also changes as we clarify it. “Write about autonomy” leaves many decisions open. After a discussion establishes the audience and the claim, the agent can investigate a specific example without asking what the essay is for. Human participation has made a new stretch of independent work possible. ## The parts of the system For this writing system, I'd use Linear to hold assignments and Notion to hold the material behind them. The agent would read from both, do a selected task, then save its result and update the board. A trigger would start that operation. Reviews would supply the decisions that prepare the next assignments. Each part needs a connection to the others for the work to continue across sessions. The [Linear board](https://linear.app/docs/board-layout) can distinguish work we might want from work we can start. I'd [define statuses](https://linear.app/docs/configuring-workflows) for Backlog, Ready, In progress, Needs input, Review and Done. An essay idea belongs in Backlog until we know what to ask for. A task enters Ready when its question and context are clear enough to act on. Review holds work that has returned and needs my attention. A board with fifty essay ideas might contain only two ready assignments. “Find the original passages supporting these claims and add the links to this page” gives the agent a question it can answer and a place to leave the result. The rest of the essay can remain unsettled. Readiness applies to the next assignment, which is often much smaller than the project it belongs to. ### A research assignment > **Work:** Check the sources for the claims marked in the linked draft. > > **Context:** Read the essay brief and the marked passages, then follow their source links. > > **Result:** Add the original passage and its link beside each claim. Flag any claim the source does not support. > > **When to pause:** If the intended claim is unclear, save a specific question and mark the issue Needs input. > > **Next exchange:** Move completed source checks to Review for the writer. The linked [Notion page](https://www.notion.com/help/collaborate-with-people) holds the current brief, source material and draft. When a run ends, those records remain available to the next one. If the agent needs a decision, it can save the exact question beside the relevant passage. I can answer later, and a new run can continue from the answer instead of reconstructing the whole discussion. Saving the draft completes only part of the handoff. The agent also needs to link the result from the issue and move it to Review, or mark it Needs input with the question that stopped it. Otherwise, useful work can exist in a document while everyone looking at the board thinks it is still underway. The shared record has to tell the next person what they can do now. A trigger determines when the agent returns to that record. A [cron job](https://manpages.ubuntu.com/manpages/noble/man5/crontab.5.html) can start a queue check at a chosen time. A [Linear webhook](https://linear.app/developers/webhooks) can notify a connected service when an issue changes, so that service can start a run when a task becomes Ready. In either arrangement, the trigger supplies the occasion to act; the issue and its linked brief supply the assignment. These connections require setup. The agent needs authorized access to the board and [Notion's content API](https://developers.notion.com/guides/data-apis/working-with-page-content), along with instructions for choosing tasks and saving results. A board containing assignments cannot start work by itself. Once the tools and trigger are connected, the next run can pick up an assignment without requiring me to open a chat and explain it again. ## Where the next work comes from The queue also lets work arrive independently of whoever is doing it. While the agent researches one essay, I can add a question about another. The new assignment remains on the board until there is capacity to take it. Without that shared queue, I would have to interrupt the current session or remember to start another one later. Work creates further work for specific reasons. A draft exposes a claim with no supporting source, so its review produces a research task. The research finds a contradiction, so the essay needs a discussion. After the writer resolves the contradiction, a revision becomes possible. The queue grows through these exchanges as the team learns what the essay needs. Some exchanges add tasks; others unblock tasks that already exist. An answer to yesterday's interview question may let the agent continue the same draft. Moving that assignment from Needs input to Ready records the change. The number of issues stays the same, but the amount of work the agent can do without me has increased. The agent can help maintain this supply. I might ask it to flag unsupported claims in active drafts and create research tasks for them, or check selected sources for material relevant to those essays. These instructions give new tasks an editorial purpose. Asking for endless new ideas merely to keep the machine occupied would create a growing list for me to sort through. One activation can handle several assignments. After saving a result, the agent checks Ready again and takes the next task. The run can continue for hours if useful work remains, then stop when the ready queue empties or a limit is reached. It does not need a fresh scheduled trigger between every task. A later trigger lets it return to a queue that may have changed. The scheduler or event receiver has to remain available even when no agent run is active. ## Changing the tempo The recurring queue check has a tempo we can adjust. Checking once a day leaves newly ready work waiting longer than checking once an hour. The metronome controls when the agent looks for work; it does not determine how long each assignment takes or when the writer will review it. Suppose a brief becomes Ready on Monday at 9:05 a.m., and the agent is available to take it. A daily check at nine will not see it until Tuesday morning. An hourly check sees it at ten on Monday. A trigger attached to the change of status can start the work immediately. Each faster setting reduces the delay before the same assignment begins. If the draft takes one hour and I review at nine each morning, that delay affects the whole essay. The daily check starts on Tuesday at nine and finishes at ten, too late for Tuesday's review. I read it on Wednesday. The hourly check finishes on Monday at eleven, so I can read it on Tuesday. A more frequent check has saved a day. Starting immediately at 9:05 on Monday finishes the draft at 10:05, another fifty-five minutes earlier. I still read it on Tuesday at nine. Both of those schedules have reached the same review, so accelerating the start again changes how long the draft waits on my desk. Further gains now require an earlier review, which would change my schedule as well as the agent's. The board makes the next delay visible. If tasks sit in Ready, I can inspect how long they wait for pickup and how long the agent spends on each assignment. If Review keeps growing, the agent is completing work faster than I am reviewing it. More drafting capacity would then add to the pile that needs my attention. Batching and limits on work in progress change that arrangement. Suppose I can review two drafts each morning. Producing ten before the first review risks repeating the same misunderstanding across all ten. Producing two, applying the feedback and then preparing the next two lets the correction affect later work. A smaller batch can mean less finished material at first and less rewriting afterward. The information outside the system has a tempo too. If a source publishes roughly once a week, checking every minute mostly returns the same page. Frequent checks can detect the next update sooner, but those saved minutes matter only if someone can use them. Repeatedly checking a draft while I sleep cannot produce the opinion I have yet to form. Some changes do justify an extra run. A source correction arriving before publication may need attention before the regular review. In work that depends on a brief price movement, waiting an hour could lose the opportunity entirely. A system can keep its ordinary daily rhythm and still respond to selected events as they happen. ## What the meeting produces A meeting can produce information that no amount of independent drafting would supply. If I say a draft explains a technique when I wanted it to explain an idea, that comment identifies a problem without fully resolving it. A conversation can establish what I expect the reader to understand and which example would make that understanding possible. Each answer changes the next useful question. Once we agree on the intended argument, the agent can point to a paragraph that no longer belongs or ask for the missing premise. Generating ten more versions before that exchange would give me more prose built around the same unresolved choice. The conversation needs to leave a revised brief in Notion and concrete work on the board. “Find an example of this dependency” can then become a research assignment. “Revise the opening around the agreed question” can become another. The next run inherits the decisions through these records, allowing the work to continue after the conversation ends. A live meeting is useful when the questions depend on one another. Clear comments on a finished draft can wait for the next run, because the agent can act on them without asking another question first. Synchronization can take either form. Its purpose is to exchange the information the next phase needs, at a time when someone can use it. ## A writing day with agents With this arrangement, I would return each morning to drafts, findings and a short list of questions. My review would make some revisions ready and identify which essays need a conversation. During the day, new ideas could enter the backlog while the agent handled prepared assignments. Whatever remained ready at night could continue without requiring me to stay at the desk. An idle agent would then have a reason I could inspect. It might have completed the prepared work, or the remaining essays might need my decisions. A task sitting in Ready because its trigger failed would be a different condition, with a different fix. The dark screen alone tells me none of this; the queue and its history tell me what happened. For each assignment, I can record four times: when it became ready, started, finished and was used. Those times separate the wait to start, the work itself, and the wait for someone to use the result. ### When work stops moving | Where to look | What to check | |---|---| | Ready → Started | Did the trigger arrive? Did the agent select the task, and was it available to begin? | | Started → Finished | Is the work still progressing, or does it need an answer? Save any missing question and name who can answer it. | | Finished → Used | Can the next person find and use the result? Check the handoff, review time and batch size. | | Nothing becomes Ready | Does the backlog contain clear assignments? Which discussion, source or decision would make the next task possible? | | Checks return unchanged material | How often does the source change, and would earlier detection affect the next decision? | For a first version, I'd connect one essay's brief and task board to a scheduled run, then set a time to review its result. I would compare those four times before changing the schedule. In the Monday example, an hourly check gets the draft into Tuesday's review; starting immediately leaves it waiting there longer. Following the work through to its next use shows which interval is worth changing, including the time I need to supply a decision. --- ## Controls for agent workflows URL: https://www.wcdc.io/writing/building-idyllic-agent-experience Date: 2026-09-10 Description: Interface studies for Idyllic's desktop builder and mobile app. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *June-August 2025* An agent that responds to incoming messages has to keep working while its author changes it. I was building that kind of agent in Idyllic: a prompt, custom procedures and triggers that could start those procedures without someone pressing Run. I wanted people to describe what an agent should do, inspect the resulting program, and then use it in their daily lives. That put the builder and the running agent in the same application. A conversation with the builder could change the instructions. A conversation with the finished agent would execute them. Both looked like chat, but they changed different things, and the interface had to make the difference understandable. ## Keeping an editable draft beside a running agent The Telegram prototype made the problem concrete. A Message Received block contained an instruction to reply using the Send Message tool. The trigger and the action appeared together in the document, so someone reading it could see what started the procedure and what the agent was supposed to do next. ![A Message Received trigger contains an instruction to reply using the Send Message tool.](/assets/idyllic-prior-iterations/building-idyllic-agent-experience/agent-experience-telegram-trigger.jpg) The implemented Telegram trigger and reply instruction. Suppose the author was halfway through changing that instruction when another message arrived. If saving the editor also changed the running agent, the incoming message could execute an unfinished procedure. Autosave, usually a convenience, would make every keystroke a possible change to active behavior. I designed a separation between the current draft and a deployment snapshot. The editor could keep saving the draft while execution used the latest deployed version. Publishing a new snapshot would be an explicit transition. Local undo would help with editing mistakes, and synchronization between tabs would keep two open editors from presenting different versions of the draft. The builder also needed a dependable way to change the document. I had implemented conversion between XML and the BlockNote editor's blocks, then added tests and evaluations for document generation. The model produced a structured representation; a deterministic parser turned that representation into editor content. Conversion in the other direction let the same document return to text the model could work with. This gave generation a specific output to aim at. A malformed document was a failure at the representation boundary, which I could test separately from whether the instructions made a useful agent. I could also improve the parser without asking the model to perform the editor's bookkeeping through a growing collection of small commands. ## Seeing what a function block does Julius and I worked through the function interface in Figma. A reusable function needs a definition containing its procedure and a way to call that function from somewhere else. If both appeared as identical blocks, someone inspecting an agent could confuse changing a procedure with supplying inputs for one execution of it. The inputs made this distinction visible. A search call needs a query, while a campaign operation might need several parameters. Those fields belong to the particular call. The function being called has its own definition, which may be reused elsewhere. We explored different icons and treatments for the two, including a function symbol for the definition and a lightning bolt for execution. ![Agent builder design with Web Search, Summarize and Create Campaign blocks beside a preview pane.](/assets/idyllic-prior-iterations/building-idyllic-agent-experience/agent-experience-builder-design.png) Our Idyllic 3.0 builder design shows function parameters and a preview beside the procedure. The execution states are design examples. The design above puts Web Search, Summarize and Create Campaign in a procedure beside a preview pane. It also shows why one density could not serve every moment of editing. A newly inserted operation needs its inputs exposed so the person can complete it. Once configured, the same fields can obscure the sequence if every block stays expanded. We considered opening parameters during authoring and allowing a compact representation afterward. Button placement carried part of the program's meaning. Play beside a procedure suggests testing that procedure; Play at the agent level suggests a broader run. Repeated Save buttons introduced another ambiguity: whether someone was saving a field, the function or the agent. These were questions we worked through in the layouts, where the relationship between a control and its target could be seen. The frame includes designed error and active states. Those states turn the procedure into something a person can follow during execution: which operation is active, where a failure occurred, and which result belongs to which step. The preview then has a specific job alongside the editor, showing the effects of the procedure being tested. ## Making execution visible in the document I implemented streaming text inside individual executed blocks. That required the runtime's events and the editor's state to agree. A chunk of generated text needed to reach the block executing that generation, and a later run needed to remain distinguishable from an earlier one. The synchronization work exposed stale state, duplicate events and recursive updates. These were visible product problems as well as implementation problems. If an output appeared under the wrong block, someone testing a procedure could draw the wrong conclusion about what that block did. The execution display had to preserve the relationship between the program, the run and the arriving output. This changed what I needed from a preview. A final answer could tell me whether the overall result looked useful. Output attached to the executing steps could help me locate where the procedure stopped matching my intent. The document was becoming both a way to specify behavior and a place to inspect that behavior as it happened. ## Giving the agent's user a useful response The mobile playground explored what a person should see once they were using the agent. A presentation-preparation example offered an explicit choice to create a checklist. Selecting it added the response to the conversation, followed by a document card. ![Mobile chat playground showing a create-checklist confirmation, the chosen response and a document card.](/assets/idyllic-prior-iterations/building-idyllic-agent-experience/agent-experience-mobile-confirmation.png) My mobile interaction playground tests a confirmation component and document card before the full Day Bear behavior was connected to the engine. A button gave the response an exact form that the application could handle. The person did not have to compose a sentence and rely on the model to interpret it as the intended choice. The document card gave the resulting checklist somewhere to open, so the conversation could continue without carrying the entire document as another long message. I tested these components and their message protocol in a playground before connecting the full Day Bear behavior to the engine. The interaction could be evaluated on its own: the agent asks for a choice, the person makes it, and the result appears as an object they can open. That was the user-facing counterpart to the builder's execution view, with controls shaped around the decision the person was making at that moment. --- [Series index](/writing/building-idyllic-prior-iterations) [Previous: Documents that run AI procedures](/writing/building-idyllic-executable-documents) [Next: A language for AI applications](/writing/building-idyllic-domain-encoding) --- ## Clarity Bear: From idea to specification URL: https://www.wcdc.io/writing/building-idyllic-clarity-bear Date: 2026-09-10 Description: An interview app for thinking through a software idea. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *October 2024* I tried using an AI interview to turn a braindump into a specification. I wrote down a rough idea, had AI process the context, then answered questions about it. The result was a list of action items in a useful order and at a level of detail I could work with. I wanted to make that process into an Idyllic app. We called it Clarity Bear. Its job was to help a person develop an incomplete idea far enough to produce an editable specification. The application needed to retain the original intention, learn from the answers and choose questions that filled meaningful gaps. A conversation could continue indefinitely without doing any of those things particularly well. ## Giving the interview a beginning and an end I drew four pages: braindump, processing, interview and review. The braindump page gave the person a document editor in which to write freely. Processing would turn that material into an outline and prepare the interview. The interview would gather missing details, and review would display the specification produced from them. ![Four rough screens for braindump, processing, interview and review, connected as an app flow.](/assets/idyllic-prior-iterations/building-idyllic-clarity-bear/clarity-four-pages.png) My four-page Clarity Bear sketch. Each screen represents a stage of the proposed interview. For the first implementation, I planned to hardcode these pages and their server routes. The design below describes that planned application. Working through a particular interview would give me a better account of what a general builder needed to express than starting with a catalogue of hypothetical interview features. ## Choosing a question from what is still missing Each run of the app would have its own conversation. After an answer, an agent process would examine the conversation history, update a scratchpad and choose another question. The scratchpad was intended to organize what the interview had learned against a rubric, including matters such as success criteria and next steps. ![Diagram of an interview loop that evaluates answers against a scratchpad rubric, updates clarity and asks another question or moves to review.](/assets/idyllic-prior-iterations/building-idyllic-clarity-bear/clarity-question-loop.png) A rubric and scratchpad would guide the next question and the transition to review. An illustrative walkthrough makes the intended behavior easier to see. Suppose the initial braindump says, “I want to build a journal app.” An early question could establish what the person wants the journal to help them do. If the answer is that they want to recover useful ideas from earlier entries, the interview has learned something that should change the remaining questions. It now has a reason to ask how those ideas would be found and used. The answer also belongs in the developing specification. Asking a good follow-up would be of little help if the final document reverted to a generic journal app. The scratchpad and conversation history gave the generation step material from both the original braindump and the clarifications that followed it. The next question should come from an unresolved part of that account. If the person has already explained the desired result, asking for the goal again wastes the answer they gave. If they have described a large system but no first useful step, a question about the smallest next step can make the specification more actionable. The rubric was meant to give the loop this direction, so that each answer changed what the app needed to learn next. This made the interview a stateful program. The latest message was an input to an operation that also read earlier information, revised a working account and selected an action. The visible question was one output of that operation. Progress toward the review screen was another. ## Letting the person decide when to review I proposed a clarity score to indicate when the interview had gathered enough information. Once the score crossed a threshold, the interface would offer a way to finish and generate the specification. Crossing that threshold would make the exit available; the person would choose whether to take it. The score's meaning still needed to be worked out. We had no calibration establishing that a percentage could reliably measure the completeness of a project specification. Its role in the design was to connect the interview's internal assessment with a visible control. A related Figma design shows that relationship. The conversation sits beside a clarity meter and a “Show results” control. The example percentage gives the indicator a visual form, while the button gives the person a concrete next action. ![Clarity Agent interface with an example clarity percentage, agent progress, a Show results control and a sample greeting exchange.](/assets/idyllic-prior-iterations/building-idyllic-clarity-bear/clarity-interface.png) A related Clarity Agent interface study with sample conversation and progress content. That distinction mattered because “enough information” depends on the intended use of the result. A person might want a first draft of the specification while some decisions remain open. The interface could offer review without treating the agent's assessment as an order to end the conversation. ## Carrying the answers into an editable specification The information-flow sketch brings the inputs together. The braindump contributes the initial idea and outline. The interview contributes questions, answers and the scratchpad. The final generation step uses those materials to create a task list. ![Information flow from braindump and outline through interview history and rubric to a task list.](/assets/idyllic-prior-iterations/building-idyllic-clarity-bear/clarity-information-flow.png) The proposed task-generation step would use both the original outline and what the interview learned. I wanted the result to use editable document blocks, with tasks that could connect to Linear. The specification needed to remain useful once the interview stopped. If it contained a mistaken assumption, the person should be able to correct that part of the document. If a task needed revision, they should be able to work on the task itself. This connected Clarity Bear to a broader problem I was encountering in AI interfaces. A useful result could become difficult to work with when it existed only as text inside a past message. Giving an artifact an identity and an editor would let later operations refer to the same result and change it deliberately. For Clarity Bear, the concrete requirement was a document assembled from the whole interview and available for further editing. The app builder would also need to describe how an answer changed the scratchpad, how that changed the next question, and when a control could take the person to review. Those connections were the next part of the application I needed to represent. --- [Series index](/writing/building-idyllic-prior-iterations) [Previous: Interactive results for AI apps](/writing/building-idyllic-interactive-apps) [Next: A visual builder for AI apps](/writing/building-idyllic-ui-and-logic) --- ## A language for AI applications URL: https://www.wcdc.io/writing/building-idyllic-domain-encoding Date: 2026-09-10 Description: Experiments with XJSN and domain-specific languages. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *September-October 2025* A delivery route contains stops, constraints and decisions about their order. A programmer can represent those concepts in code and ask a coding assistant to change them. Someone who understands the delivery business should be able to make the same kinds of changes without first building the database, API and screens around the route. The earlier Idyllic builders let me assemble prompts, procedures and tools. I now wanted to give the agent a representation of the activity itself, with objects it could inspect and operations whose meaning was already defined. ## Giving the domain a vocabulary I called this work **domain encoding**. For a routing application, the vocabulary would describe the things the business cared about and the valid ways to work with them. An operation might still make database calls underneath, but the person and the agent would encounter the domain concept those calls served. ![An original Idyllic slide places DSLKit and XJSN Schema between a business icon and code, under the heading Domain Encoding.](/assets/idyllic-prior-iterations/building-idyllic-domain-encoding/domain-encoding.png) Domain encoding, shown in an original Idyllic proposal slide. The proposal slide places DSLKit and XJSN Schema between the business and its representation as code. Idyllic would supply the language machinery. Each application would supply the concepts and rules that made its language useful. A domain-specific language has a deliberately limited job. If the agent is planning routes, it needs to express route-related work. It does not need permission to invent arbitrary database operations or modify the application implementing those routes. The available vocabulary can keep the generated program within a space the application knows how to interpret. Choosing that vocabulary is substantive design work. Exposing every low-level database operation would leave the model to reconstruct the business's rules each time. A useful domain operation can carry some of those rules in its implementation, so the model selects and combines meaningful actions. The language's expressive power comes partly from what has already been decided inside those actions. ## Letting the model write a program the system can check I had been implementing and testing XJSN, short for Extensible JavaScript Notation, as a common notation for these languages. It combined JSON values with function-call syntax. Models were already familiar with that shape from code, and a person could read a nested call without working through a stack of tagged JSON objects. The calls were inert. Parsing an XJSN expression produced a tree of data; it did not execute JavaScript. The application could inspect that tree before allowing any operation to run. The parser and schema had different jobs. The parser recovered the expression's structure: a call with a name, arguments, and perhaps other calls nested inside those arguments. The schema specified which names existed and what arguments they accepted. The same parser could therefore serve a routing application or a customer-management application, while each schema exposed a different language. A generated expression passed through a sequence of checks: 1. The model received the domain's available operations and wrote an expression. 2. The parser converted that text into a structured tree. 3. Validation checked the calls and their arguments against the domain schema. 4. If validation failed, an error could identify the offending call and the expected argument, giving the model something specific to repair. 5. An interpreter could carry out the checked expression through the registered operations. The distinction matters when a generated call is almost right. A call can have perfectly valid syntax while referring to an unknown operation or supplying text where a number is required. Parsing alone cannot catch that mistake. A schema can describe it precisely enough that the next attempt repairs the argument instead of blindly regenerating the whole program. The schema also supplied the information used to instruct the model. That kept the description of the available language tied to the definitions used by its validator. Adding an operation would otherwise require maintaining separate accounts of what the model was told and what the system accepted. I describe this generation and repair loop in more detail in the [XJSN article](/writing/xjsn). My experiments encouraged the hypothesis that limiting what the model could express would help it perform a particular job reliably. The next problem was deciding whether a valid expression did useful work. ## Designing behavior within the language ![An original Idyllic slide describes intelligence design as developing agents that work within a domain represented as code.](/assets/idyllic-prior-iterations/building-idyllic-domain-encoding/intelligence-design.png) Designing agent behavior within the domain's language. Original Idyllic proposal slide. A route can contain valid stops in an allowed order and still be a poor plan. The language establishes what the system can understand. Choosing an appropriate route also depends on the information the agent receives and the decisions it makes with that information. I called this second stage **intelligence design**. It included the context, examples and procedures that guided the agent's behavior. An application author would define how the agent approached the work, while the domain language gave that behavior definite objects to act on. The separation made failures easier to locate. An unknown function belongs to the language's validation problem. A valid but unhelpful plan points toward the agent's instructions, missing context or decision procedure. Improving one does not automatically improve the other. This was the property I wanted to carry over from coding environments. A coding assistant can inspect an artifact, change part of it, and receive feedback at a specific location. I wanted work with routes and business procedures to have an equally inspectable representation, so an agent could revise the work instead of only discussing it. ## Making the representation visible I also wanted to operate the encoded system through a board of widgets. Each widget would hold useful state, make that information available to the agent, and update when the agent changed it. Once configured, the same system could be used through the interface or an API. This was the product design we were developing, with the integration path still open. An equipment-support example helped us work through what the interface should contribute. Before starting a conversation, a restaurant operator could select the piece of equipment they needed help with. That selection would supply information the application already knew, instead of making the operator reconstruct it in a prompt. The assistant could then begin with the selected equipment and ask about the problem. The example exposed decisions that a language alone could not settle. We still needed to establish where the equipment data came from, what the operator saw, and what belonged in the administrator's view. We discussed rough wireframes to make those choices concrete enough to get feedback on. I wanted the interface for my own testing too. If an agent changed a domain object, I needed to see the change and understand what it had done. The widget board would connect the language experiment to an observable result: a person supplies context, the agent acts on the relevant object, and the updated object appears in the application. --- [Series index](/writing/building-idyllic-prior-iterations) [Previous: Controls for agent workflows](/writing/building-idyllic-agent-experience) [Next: A shared runtime for concurrent agents](/writing/building-idyllic-stateful-runtime) --- ## Documents that run AI procedures URL: https://www.wcdc.io/writing/building-idyllic-executable-documents Date: 2026-09-10 Description: Idyllic's document-editor prototype from spring 2025. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *March-May 2025* I wanted to write an AI procedure in a document and run it from the same page. The instructions could sit beside the background material they referred to. After a run, I could open the result, change the procedure and try again. One example in my design notes was a journal reflection: select a week's entries, reflect on their ideas, and save the reflection as a new document. It looked simple on the page. Making it work meant deciding how an instruction found its inputs, what passed between steps and what the program actually returned. ## The document as a program A document already gives people useful ways to organize a procedure. Headings group related work. Paragraphs explain what to do. References point to material elsewhere. I wanted those familiar elements to have an executable meaning. The document editor therefore worked on a structured program underneath. A section could contain a sequence of steps; a step could refer to a document, an object or a tool. The runtime walked that structure to decide what to execute. This gave a heading or reference a defined role that survived changes to the page's appearance. The Idyllic 2.0 mockup shows the broader idea: structured information, action controls and a chat composer on one page. A person could inspect the material and ask for an operation on it. ![Idyllic document-as-app design with an example invoice table, action chips and a chat composer.](/assets/idyllic-prior-iterations/building-idyllic-executable-documents/executable-document-design.png) Our Idyllic 2.0 mockup combines a sample invoice table with actions and a chat composer. The reflection procedure can be written in three instructions: 1. Read a week's journal entries from `@Documents`. 2. Generate a reflection on the ideas in those entries. 3. Create a document containing the reflection. The references were important. `@Documents` identified a collection the system could inspect. A reference to a particular document retained its identity even when shown as a readable name or an inline pill. That let natural-language instructions refer to real objects without requiring the user to type their internal IDs. ## Running one instruction “Read a week's journal entries” is more than a single text-generation request. The system has to find the entries before it can do anything useful with them. In the walkthrough, the agent first received a view of the document directory, with names and IDs. It could then select documents and fetch their contents. I wanted it to be able to ask for more information until it had enough to complete the instruction, rather than assuming that one retrieval would always suffice. This was the role of the agentic execution loop inside a step. It interpreted the instruction and used the available tools to carry it out. A simple step could call a known function; a more open-ended step could need several tool calls. ## Passing results between steps An outer loop moved through the procedure in order. Its job was to retain each step's result and make the appropriate information available to later steps. This exposed an ambiguity in how I was using the word “context.” The execution could remember that it had selected several documents, while the next model request still lacked their text. Holding a document reference in program state does not automatically put its contents in a model's prompt. I had to separate the two: - **Execution state** records the selected objects, completed steps and results of the run. - **Model context** is the information supplied to a particular model call. The executor must decide what to load or include from that state. For the reflection step, the executor had to fetch the selected journal entries and supply their contents to the model. The collection's identity alone gave the model nothing to reflect on. I explored context scopes to keep this flow local to the work being done. Entering a section or event handler established the information available there; completed steps added their requests and results. An instruction could also contain a phrase for AI to resolve using the information available at that point, such as turning a rough description into a search query. ![Execution test table showing a search query and document results accumulating in the context available to later steps.](/assets/idyllic-prior-iterations/building-idyllic-executable-documents/executable-document-context-table.png) A development view of the query and document results available before and after each step, using example data. The development table let me inspect the context before and after each operation. Its search example begins with a query, adds document results, then passes both onward. I could check the state transitions with example data, while inspecting the actual messages sent to the model remained a separate check. I also tried executing document prompts in parallel. Sequential execution became the more useful starting point because a later instruction could build on what an earlier one found. In the reflection example, generating the reflection before selecting the journals would break the dependency the page was supposed to express. ## The generated document The final output needed to be a document in the application. Returning a chat message saying the procedure had finished left the artifact card with nothing to open. The intended path through the reflection example was: 1. **Start a run.** Parse the document into a sequence of instructions and initialize its execution state. 2. **Resolve the inputs.** Find the selected journal entries and load the material needed for the reflection. 3. **Generate the reflection.** Run the instruction with that material and retain the resulting text. 4. **Create the output document.** Give the document-creation tool a name and content; receive the identity of the new document. 5. **Return that document to the interface.** The artifact card opens it, and citations can link to the generated result.
An instruction document selects journals, passes their contents through reflection and document creation, then returns a separately saved document that an artifact card can open.
Explanatory illustration made for this article. Journal contents feed the reflection; document creation saves the result, and the artifact card opens that saved document.
I changed `executeDocument` to create that new document, implemented Julius's artifact design and connected citations to the generated result. The order of those tasks mattered: the card and citations both depended on having a concrete document to point to. The prototype was still resolving how headings and surrounding prose should influence each prompt. Chat persistence also remained unfinished, so assigning generated documents to persistent conversations was a separate problem. ## The execution movie A person waiting for the reflection needed to understand what was happening before the final document appeared. The development table exposed the execution rules, but asked the reader to inspect too much internal state. Julius designed a compact animated display that we called the “movie.” It let you watch the procedure unfold: operations appeared with status indicators, completed work remained visible, and the active operation showed what was happening now. That unfolding sequence is what made the movie metaphor fit. Each operation could expand to show its contents. Reading sources might reveal the documents being used; creating a document might reveal the emerging artifact. The surrounding row stayed consistent while the detail inside it could suit the operation. ![Compact execution card with a completed analysis row, an active fetching-sources row and expandable detail.](/assets/idyllic-prior-iterations/building-idyllic-executable-documents/executable-document-movie.png) My implementation of Julius Lattke’s execution movie, connected to a demo executor. Each operation can expand to show its contents.
Three views of the same execution card progress from reading journals to writing a reflection and creating a saved document. The active operation expands to show its contents.
Explanatory illustration made for this article. One run progresses through reading, reflection and document creation, with different contents inside each expandable operation.
I connected an implementation to a demo executor before the new execution rules were complete. This gave us something to watch and discuss while developing the runtime. The animation and expandable contents made the experience tangible: we could consider what someone needed to see during a run, alongside what the executor needed to retain. The design had three views of the same work. The editable page expressed the procedure. The movie showed a particular run. The generated document held its result. Keeping those roles distinct made it possible to explain what editing an instruction, inspecting an operation or opening an artifact was supposed to do. --- [Series index](/writing/building-idyllic-prior-iterations) [Previous: A task list shared with an agent](/writing/building-idyllic-shared-task-state) [Next: Controls for agent workflows](/writing/building-idyllic-agent-experience) --- ## Interactive results for AI apps URL: https://www.wcdc.io/writing/building-idyllic-interactive-apps Date: 2026-09-10 Description: Early designs for editable checklists and journal search. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *August to October 2024* A generated checklist should let you check things off. The model can write the tasks, but the application has to decide what a checkbox changes, where that change lives and what happens when another list appears. Task Bear gave us a concrete case. A person would describe something they needed to do, and AI would break it into a checklist. I wanted the result to remain useful while they did the work. That meant designing the interaction after generation as carefully as the prompt that generated it. ## Turning a request into an interactive result The Task Bear design had a feed for activity and results, with input controls along the bottom. Those controls could open more detailed interfaces when the app needed information. A shared layout could support several kinds of app, provided each app could define its own inputs and results. ![Colored annotations divide a Task Bear screen into agent activity, interactive results and bottom input controls.](/assets/idyllic-prior-iterations/building-idyllic-interactive-apps/interactive-anatomy.png) Anatomy of an Idyllic UI: the feed, agent activity, interactive output and input controls. For the “Add Tasks” action, the interaction was deliberately small. Pressing the control would insert a text input into the feed. The bottom controls would disappear while that input was active. After submission, a loading skeleton would occupy the result area while the model broke the request into tasks. The completed checklist would then replace it. The temporary input and the resulting checklist had different lifetimes. The input only needed to collect a request, and it had a clear submission or cancellation point. The checklist needed to stay available after that exchange ended. Treating both as undifferentiated chat messages would leave the application with no explicit account of which interaction was still waiting for an answer. A journal action made this distinction more visible. Its input had three stages, including back and cancel controls. Moving backward meant revisiting an input stage; canceling meant leaving the interaction and restoring the app's controls. The app needed to track that progress separately from whatever text the model was producing. At this point I was building screens manually. Loading arbitrary app definitions into the shared layout remained unfinished. The manual screens helped identify what the layout would have to support: input steps, activity, results and controls whose availability depended on the current interaction. ## Letting each checklist keep its own state The checklist's state belonged to the individual feed item. This was an explicit decision in the Task Bear specification, and it prevented a simple but consequential mistake. Consider two lists generated during the same session. The first contains preparation tasks for a meeting. The second contains tasks for a piece of writing. If Task Bear kept one global set of checkbox values, generating the second result could replace the first list's state, or a checkbox in one result could affect the other. Each result needed its own record of completed items. With state attached to a feed item, the person could scroll back to the meeting checklist and continue using it. Creating another checklist would create another result with its own state. Nested tasks also belonged to that result, so expanding or completing an item had a defined target. ![Nested Task Bear checklist in Figma, with selection guides and Julius Lattke’s cursor visible.](/assets/idyllic-prior-iterations/building-idyllic-interactive-apps/interactive-nested-checklist.png) Our collaborative Task Bear design, with Julius Lattke’s Figma cursor visible. Each generated checklist was meant to retain its own state. The model's role was to propose the contents of the list. After that, checking an item could be an ordinary application interaction. There was no reason to send a new message asking the model to reproduce the whole checklist with one item marked complete. The application already knew which item the person had clicked. Julius and I used Storybook to work on these components independently of the agent. A checklist with sample data let us examine nesting, controls and visual states while the execution code was still changing. Separating presentation from the running process made the design easier to discuss: we could change how a task appeared without also having to generate a new task list. ## Showing the work behind an answer Search Agent tested another part of the feed. A checklist becomes useful once its content exists. A search interface also needs to communicate what is happening before the final answer arrives. I was connecting search over my journal material to an agent. The flow used LangGraph, and vector search was exposed as a tool the model could call. I moved the material and search into Convex, then had the agent report updates there so the interface could react as it worked. There are several different things an interface might receive during that process. Text streaming reveals an answer as it is written. An activity update can reveal that a search is underway. A citation associates a claim in the answer with material the search found. One does not automatically provide the others. Streaming the final paragraph, for example, says little about what was searched before that paragraph was composed. Julius's Search Agent design gave these different kinds of information their own places. Search themes appeared above the result, dated source chips exposed the retrieved material, and citation markers connected the answer to its sources. The figure uses placeholder content to show that arrangement. ![Search Agent card shows search themes, dated source chips, a summarizing stage and citation markers around placeholder text.](/assets/idyllic-prior-iterations/building-idyllic-interactive-apps/interactive-search-agent.png) Julius Lattke’s Search Agent design, with placeholder results showing where sources and citations would appear. I connected the design to the search flow and got citations working. Text streaming and the display of individual subsearch queries remained work in progress. A further implementation problem was translating LangGraph's events into information a person could use. The graph could emit internal state changes, but the interface needed meaningful descriptions of activity rather than a dump of those events. The feed now had two distinct responsibilities. It could show a search whose activity was still changing, and it could hold a checklist whose generation had ended but whose controls remained useful. Each feed item needed to identify what it represented and which changes it could still accept. Finishing an AI response was only one transition in the life of the thing on screen. --- [Series index](/writing/building-idyllic-prior-iterations) [Previous: From Telegram workflows to AI programs](/writing/building-idyllic-workflows) [Next: Clarity Bear: From idea to specification](/writing/building-idyllic-clarity-bear) --- ## Building Idyllic - Prior Iterations URL: https://www.wcdc.io/writing/building-idyllic-prior-iterations Date: 2026-09-10 Description: The earlier Idyllic designs, with original sketches and prototypes from 2024 and 2025. I started building Idyllic in 2024 to make AI tools that people could adapt to their own work. A useful conversation often depended on context I had supplied and a sequence of questions I had worked out. I wanted to save that work in an application I could keep using and change as I learned what it needed. Julius Lattke worked with me on the product designs. We explored small applications with their own feeds, documents that could run a procedure, and agents that shared editable objects with the person using them. I built prototypes to work through the behavior behind those interfaces. These articles explain the concepts we explored in 2024 and 2025 through their interfaces, execution models and design tradeoffs. Each keeps the exploration period alongside the title; the explanation follows how the system was meant to work. ## 2024 [From Telegram workflows to AI programs](/writing/building-idyllic-workflows) starts with a Telegram journaling bot and follows the experiments toward programs that could retain state between steps. [Interactive results for AI apps](/writing/building-idyllic-interactive-apps) covers the feed-based applications and Julius's Search Agent. A running workflow needed somewhere to ask for input and show the sources behind its answer. [Clarity Bear: From idea to specification](/writing/building-idyllic-clarity-bear) follows Clarity Bear. I wanted the conversation to collect missing information and leave me with a document I could work from. [A visual builder for AI apps](/writing/building-idyllic-ui-and-logic) covers the visual program builder and the experiments with editable objects inside documents. Buttons and generated results needed behavior that the application could represent explicitly. ## 2025 [A task list shared with an agent](/writing/building-idyllic-shared-task-state) follows the planner designs. Changes made through conversation needed to affect the same tasks I could edit through the interface. [Documents that run AI procedures](/writing/building-idyllic-executable-documents) traces a journal-reflection procedure from instructions and document references through sequential execution to a saved result. Julius's execution movie made the run visible as it unfolded. [Controls for agent workflows](/writing/building-idyllic-agent-experience) follows the builder and mobile interfaces. An agent needed controls suited to its task, including confirmations and editable documents. [A mobile builder for personal agents](/writing/building-idyllic-mobile-agent-builder) explains the mobile-first design, configurable agent components and a Shortcuts-like function editor, including an experiment with AI-generated database queries. [A language for AI applications](/writing/building-idyllic-domain-encoding) covers the work on representing an application's concepts and operations in a form a model could use. The language and builder had to agree on what those operations meant. [A shared runtime for concurrent agents](/writing/building-idyllic-stateful-runtime) follows the move to TypeScript classes and the Virtual Office prototype. The browser and the agents operated on state belonging to the same running application. --- ## A task list shared with an agent URL: https://www.wcdc.io/writing/building-idyllic-shared-task-state Date: 2026-09-10 Description: A planner prototype with live task cards in chat. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *January-February 2025* I wanted to plan my day with an assistant and then use the plan as an ordinary task list. If I asked the assistant to add a task, it should appear in the planner. If I checked the task off myself, the assistant should find the updated status when it next read my tasks. A checklist generated inside a chat response could show the plan at the time of the answer. Once I changed a task in the planner, that copy would be out of date. I wanted the chat card and the planner to read and change the same stored tasks. ## Building the planner around task records Julius designed expandable task cards with subtasks and categories. The hierarchy let a larger activity stay compact until I needed its details. A checkbox let me change a task's status directly, without writing a message asking the assistant to mark it complete. ![Planner component test showing categorized task cards and an expanded task with nested checkboxes.](/assets/idyllic-prior-iterations/building-idyllic-shared-task-state/shared-state-planner-components.png) My Storybook implementation of Julius Lattke’s planner design, with component-example tasks before database integration. I implemented Julius's components in Storybook first. Sample tasks let me work on their appearance and interaction before connecting them to the database. Once those components worked, I assembled the planner pages and connected their state to Convex. The component test in the figure comes from the earlier step. The page structure followed the task hierarchy: a day view, a task detail view and a subtask detail view. The selected date also needed to be available to the chat. If I was viewing a different day, the assistant needed that context to interpret a request about the plan on screen. I put that application-specific behavior in a registry. The planner registered the components it could display in chat and a context provider that supplied the selected date. The main chat interface could use those registrations when it was running inside the planner, rather than carrying planner-specific logic throughout its own code. ![TypeScript application configuration registers planner components and supplies the selected date to chat.](/assets/idyllic-prior-iterations/building-idyllic-shared-task-state/shared-state-app-registry.png) The application registry and planner context provider. The selected date is shared with the planner’s chat components. ## Attaching a task card to a tool result Julius also proposed using AI in the add-task interaction. I implemented it alongside the planner and then worked out how a tool call could produce a useful interface inside the response. A tool call lets the model ask application code to perform an operation. The code can add or read tasks and return a result to the model. I extended that result with an optional `genUI` field describing a component to display. The backend checked tool results for the field and added those descriptions to the chat response. The frontend then used the app's registry to choose and render the component. I had first tried describing the interface through structured model output, but that did not fit the tool-calling setup I had in place. Attaching the description to the tool result put it beside the operation that had produced the data. A tool that worked with tasks could return both information for the model and a task interface for the person. The component could bind to data in three useful ways. A static card could receive a snapshot and display it. A live card could receive an ID and query the corresponding record in Convex. An interactive card could use that query and also call a mutation to change the record. The last two bindings allowed a card inside an old message to display current application data. ## Checking a task off after the answer ends Consider an illustrative request to add “Prepare the meeting notes” to a day. The application stores the task, and the response displays a task card that queries it by ID. The planner reads the same task. Both views can therefore display the stored title and completion status. When I tick the card's checkbox, the component sends a mutation for that task to Convex. The database changes the record, and views subscribed to that record receive the updated status. The planner can show the task as complete even though I clicked inside the conversation. Opening the task elsewhere does not create another completion state to keep in sync. The model does not have to remain active for that interaction. It has already finished its response, while the component continues to run as part of the application. The next time the assistant needs the task's status, its tools can read the updated record. A live interface does not automatically put every database change into the model's conversation history; the assistant still needs to retrieve the state relevant to its next action. This also clarifies when a snapshot is useful. An answer might need to preserve what a plan looked like when it was made. A task control that I intend to keep using needs a live binding instead. They can look similar while having different behavior, so the component description needs to determine which one the application is rendering. One request could also require several tool calls. If each call returned the same task interface, the final answer could contain duplicate controls. I added deduplication while tuning the implementation. The application needed to decide which cards belonged in the answer after the tools had finished, rather than display one card for every backend operation. ## Giving other objects an identity The object-method prototype extended the idea beyond tasks. An object exposed named methods that the agent could invoke with arguments. The runtime could load objects dynamically, let methods change their data and let one object refer to another. In the example below, the agent invokes a journal collection's summary method. The method creates a summary object, and the tool result identifies that object. A later operation can address the summary by its reference instead of requiring the agent to copy the text of an earlier answer into a new request. ![Object-method prototype showing a named journal object, its summarizeEntries method and a reference to the resulting summary.](/assets/idyllic-prior-iterations/building-idyllic-shared-task-state/shared-state-object-method.png) An object-method prototype returns a summary as another named object. The dates identify the test collection. I describe the collection operations in more detail in [Semantic objects: giving models handles instead of data](/writing/semantic-objects). The planner explored how a person would work with an object from the interface. A task's ID lets application code locate its record. The registered component supplies the checkbox and other controls that make the record usable on screen. --- [Series index](/writing/building-idyllic-prior-iterations) [Previous: A visual builder for AI apps](/writing/building-idyllic-ui-and-logic) [Next: Documents that run AI procedures](/writing/building-idyllic-executable-documents) --- ## A shared runtime for concurrent agents URL: https://www.wcdc.io/writing/building-idyllic-stateful-runtime Date: 2026-09-10 Description: Testing concurrent work and human review in a simulated office. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *November-December 2025* Several agents working on one document need somewhere to keep the document while it changes. They may have different prompts and responsibilities, but they are contributing to the same piece of work. A person also needs to inspect that work, intervene, and return to it later. I was building an Idyllic runtime around that shared session. I started with a working chat so I could test the path from the browser to the model and back. Then I could change the application model behind the chat and see what each experiment actually enabled. ## Choosing what one object represents I wanted an application author to express the session as a TypeScript class. Its properties would hold the current work, and its methods would describe the operations that changed it. For a task board, that meant keeping the tasks and their status alongside the code that assigned work or responded to review. The important choice was what one instance of the class represented. Giving every agent a separate runtime object would also give each one a boundary across which shared information had to travel. Three agents editing the same document would need some way to coordinate their versions of it. I chose one instance for the whole session. Agents could run as functions inside it, with their own prompts and context, while reading and updating common state. Ordinary variables could hold an intermediate result. Functions could describe repeatable procedures, and promises could coordinate activities that ran at the same time. I could use familiar code structures to express the arrangement before deciding what a visual builder should expose. A module would add a configured resource to that application. A document collection, for example, would bring a place to keep documents together with operations for working on them. A messaging module would bring the conversation data its functions needed. I wanted installing a capability to supply the state behind it, so every application author would not have to reconstruct that state separately. ## Making the class survive and communicate Cloudflare's Durable Objects gave me a way to associate a session with a named object and attached storage. I explored the platform through small tests, including a counter and a tic-tac-toe application. The counter retained its value between some requests and reset in later tests. I could not treat an ordinary in-memory property as durable state: important values had to be saved and restored when the runtime recreated the object. The framework therefore had more work to do than keep a class instance around. The authoring model could make state look like ordinary properties, but the running system needed to connect the relevant changes to storage. The game also needed a connection through which clients could make moves and see the current board. Writing raw WebSocket messages at each call site was too low-level for the application model I wanted. ![A development sketch connects a Next.js application and idyllic source directory to bundling, script upload, a routing table, and a dispatcher worker. Red notes mark open implementation questions.](/assets/idyllic-prior-iterations/building-idyllic-stateful-runtime/deployment-sketch.png) A deployment sketch from my Durable Objects research notebook. Red annotations mark open questions. The deployment sketch traces the machinery around the class. An `idyllic/` directory sits beside the frontend. A deployment command bundles its server code and uploads it, and routing information lets an incoming request find the appropriate deployed program and session. The red notes mark questions I was still working through about bundling and live connections. I wanted to generate that machinery from the application's source. The author would write a TypeScript class; a source transform would produce the Worker and Durable Object code needed to run it. The browser would call the session through a client interface, with Idyllic handling the routing and synchronization underneath. The prototype eventually transformed `system.ts` into that runtime and connected it to React. It supported several parallel streams, so I could test more than one model response progressing inside the same session. The detailed source model is described in [Idyllic v4](/writing/idyllic-v4). ## Streaming several activities into one interface A research application gave the parallelism a purpose. An explorer, a critic and a synthesizer could have separate outputs while contributing to shared work. Each output needed a place in the session's state and a corresponding place in the interface. When server code changed a synchronized field, the framework sent the change to connected clients. Streaming output needed a more specific lifecycle: text could be appended to a field, and the stream could eventually complete. Several generations could therefore update their own fields without the application author having to route every token through one combined response. Completion mattered because a partial output can be visible before it is ready for the next operation. A growing paragraph and a finished result may contain the same text at a particular instant, but they permit different next steps. The runtime needed to express that difference alongside the content. This also gave the interface something more useful to show than an overall loading indicator. A person could watch the separate outputs and the shared state while work continued, rather than waiting for the entire application to resolve into one answer. ## Testing intervention in a small shared world I built a Virtual Office as another test application. It contained a task board, two simulated employees named Alice and Bob, and an activity log. Each employee had a current assignment and a panel displaying generated work. ![The Virtual Office prototype shows two tasks in progress, a documentation task in the backlog, and generated work from simulated employees Alice and Bob beside an activity log.](/assets/idyllic-prior-iterations/building-idyllic-stateful-runtime/virtual-office-working.png) Virtual Office running demonstration tasks. The task board and each simulated employee's generated work are visible together. In the first capture, Alice is working on a login form and Bob on a landing page. Documentation remains in the backlog. The board describes the work at the session level while the employee panels show the individual activities underway. Those views need to agree. Assigning a task affects both its board status and the worker's current assignment. Producing a result makes work available for review. If a person rejects the result, that feedback has to enter the same state the agent uses to continue, or the board becomes a display disconnected from the process it supposedly controls. ![A later Virtual Office view shows one task done, one in review, and one in progress. Alice and Bob are taking breaks, while the activity log records task feedback and state changes.](/assets/idyllic-prior-iterations/building-idyllic-stateful-runtime/virtual-office-review.png) Later in the same recording, tasks have moved between work, review and completion. Energy bars and breaks belong to the test application; they do not measure model performance. The later capture shows documentation marked done, the landing page in review, and the login form back in progress. The activity log records the human rejecting the login form after it entered review. Alice and Bob are taking breaks, a behavior in the toy office simulation; the energy bars are not measurements of model capability. The demonstration exercised concurrent work, review and changing shared state. It did not establish that the generated login form or landing page was useful finished software. What I could inspect was the application's behavior as those tasks moved through the process. The same connection helped me debug the framework. A coding agent could send WebSocket requests to the running session while I watched the browser update. Both were clients of the same object, so I could see the effects of a test through the application itself. Calling an operation, changing state and displaying the change already belonged to the runtime; a second kind of caller could reuse that path. I wanted to use this runtime to explore the module system and more complex agent patterns. The small applications gave me a way to investigate those questions with concrete state and behavior: write the session, run several activities inside it, and observe what happened when another client intervened. --- [Series index](/writing/building-idyllic-prior-iterations) [Previous: A language for AI applications](/writing/building-idyllic-domain-encoding) --- ## A visual builder for AI apps URL: https://www.wcdc.io/writing/building-idyllic-ui-and-logic Date: 2026-09-10 Description: Using an interview app to work out the builder's design. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *November to December 2024* The Idyllic builder needed to connect an interface to the AI operations behind it. Clarity Bear supplied a specific problem. Its first page had a document editor and a button. Pressing the button needed to read the document, generate an outline, store that outline and open the interview page. The interview then needed the outline to prepare its questions. I could write that behavior directly in application code. A visual builder needed to represent the same connections in a form a person could inspect and change. The challenge was deciding what the diagram had to describe so that changing it would change the running application. ## Following a button click through the app My UI-and-logic drawing puts the screens on one side and their operations on the other. The button in the braindump page starts the outline-generation flow. The interview has a different trigger: sending a message starts an evaluation of the conversation and the generation of another question. The result also changes the clarity indicator. The review page receives the final document. ![Side-by-side UI and logic diagram connecting a document editor, button callbacks, AI processing, interview messages and review output.](/assets/idyllic-prior-iterations/building-idyllic-ui-and-logic/composition-ui-logic.png) An Idyllic UI-and-logic study linking interactions on each screen to the operations that produce its next state. The initial button click is a useful case to follow. The AI operation needs the current contents of the editor. When the operation returns an outline, the app needs to keep it beyond the lifetime of that call. Navigation then changes the visible page, and the interview reads the stored outline. Each step has to agree about which value it is passing along. A line from the button to the AI operation can say when generation begins. It does not, by itself, identify the document to read. A line from the AI operation to navigation can say which step comes next, but it does not tell the interview page where to find the result. The builder needed to describe both the order of actions and the movement of values. ## Running the diagram I built a parser that took React Flow nodes and edges and translated them into an abstract syntax tree, or AST. The AST was a structured description of the operations for an interpreter to execute. The editor handled the visible graph; the interpreter handled the meaning of its operations. This separated two kinds of change. Moving a node on screen could change the diagram's layout without changing the program. Changing a node's properties or connections could change what the interpreter ran. The saved graph needed enough information to reconstruct that behavior independently of the editor's current display. I got a rudimentary interpreter working, including navigation, buttons, string interpolation and string-based callbacks for chat messages. I also added a text element that could receive streaming output from an AI node. These were working parts of the builder; the complete Clarity Bear flow and dynamic editing still needed more work. The editor capture shows the initial action sequence clearly: an entry point leads to an AI call, which leads to a state update and then navigation. ![Idyllic builder with page, state and logic controls and a graph of entry point, AI call, state update and navigation nodes.](/assets/idyllic-prior-iterations/building-idyllic-ui-and-logic/composition-november-builder.png) The editor still shows an action sequence, beside notes proposing a move toward data flow. I was planning to move that graph toward data flow. In the Clarity Bear example, the AI result would have a visible relationship to the state field holding the outline, and the interview would have a visible relationship to that field. Expressions and type checking would help explain which values could be connected. The graph would then show more than a path through operations; it would help a person trace the information those operations used. Streaming added another requirement. A text result could change many times while an operation was running, so state updates had to reach the appropriate part of the interface repeatedly. I encountered a race in those updates and fixed it by partitioning them by key. The display and its backing state needed to remain consistent during generation, as well as after the final value arrived. ## Giving structured results useful controls A builder also needs components suited to the results it creates. The early semantic-object experiments explored objects that combined data with relationships, methods and a renderer or editor. A palette makes the idea tangible. The data contains colors, but a person works with a palette by looking at swatches and using controls. A musical pattern has a different representation and needs a way to play it. The prototype placed a palette, a small chart and a musical pattern inline, with interfaces fitted to those objects. ![Inline palette, sparkchart and musical pattern with playback controls in an Idyllic prototype.](/assets/idyllic-prior-iterations/building-idyllic-ui-and-logic/composition-semantic-objects.png) The semantic-object prototype gives different structured objects their own visual controls. Still from a development recording. I was also proposing operations across more substantial objects: use a calendar and a task list to create a schedule, for example. The palette and music experiments gave me a smaller place to test how a typed result could appear and accept interaction. They did not yet supply the behavior of a scheduling app. The component-library design addressed how those building blocks could be chosen. It included a button, chat, progress bar and agent activity display. A component needed editable properties and events that could connect to the runtime. Choosing a button from a library supplied its appearance and basic interaction; connecting its click event to a program supplied its job in that particular app. ![Component library with Agentic Thinking, Button, Chat and Progress Bar choices and a preview of completed, active and pending steps.](/assets/idyllic-prior-iterations/building-idyllic-ui-and-logic/composition-component-library.png) A component-library design with placeholder steps in the preview. ## Selecting context for an operation As I used my own chat application, I began treating a project as a place that could contain context, state, an interface and logic together. The builder raised questions about how values reached an operation. Project memory raised a similar question about how relevant material reached a model call. A model ultimately receives messages. I wanted to distinguish those messages from the material available to construct them. A project might contain several conversations, while a particular query needed only selected parts. A prompt template could arrange the selected material into messages, but choosing and transforming that material were operations of their own. I began describing context in terms of actions such as selecting, remembering, forgetting, aggregating and transforming. The proposed interface for those actions was broader than the behavior I had working. The concrete implementation was a project memory mode that searched other chats in the same project and inserted retrieved material into a new query. I still needed to make that search more specific. The builder's next job was to make these connections intelligible. For the Clarity Bear button, I needed to see which document entered the AI call, which state field received the outline and which page consumed it. For a question using project memory, I needed to see which material was selected and how it entered the messages. Each operation needed an explicit account of what it read and where it put its result. --- [Series index](/writing/building-idyllic-prior-iterations) [Previous: Clarity Bear: From idea to specification](/writing/building-idyllic-clarity-bear) [Next: A task list shared with an agent](/writing/building-idyllic-shared-task-state) --- ## From Telegram workflows to AI programs URL: https://www.wcdc.io/writing/building-idyllic-workflows Date: 2026-09-10 Description: Journaling experiments with n8n and Telegram. [Building Idyllic - Prior Iterations](/writing/building-idyllic-prior-iterations) *March to July 2024* I was trying to make AI useful across a process that lasted longer than one conversation. My first working example was a journaling workflow: I sent a message to a Telegram bot, and n8n added it to that day's Notion page. Redis carried messages between the services, and a separate workflow could send the same material to mem.ai. That solved capture. I could get a thought out of my head without opening a document and finding the right place for it. Using the accumulating material was a different problem. An AI response would need context from earlier entries, and improving that response would require remembering what had produced it. The next experiments followed those requirements into feedback, process state and eventually a small program format. ## Connecting feedback to the answer that produced it Suppose I told the Telegram bot that an answer had missed something important. By the time I sent that feedback, I might already have changed the prompt. The journal might contain new entries. Sending the feedback alongside the current prompt would give a refinement process the wrong evidence: it would be judging instructions and context that had never produced the answer I was criticizing. My feedback design therefore saved the intermediate records. A template and a set of context produced a rendered prompt. The model invocation saved that prompt and its output. When the workflow delivered the answer through Telegram, it attached the Telegram message ID to the invocation. ![Handwritten workflow connecting a prompt template and context to a model call, Telegram delivery and a stored invocation.](/assets/idyllic-prior-iterations/building-idyllic-workflows/workflows-april-generation.png) My feedback-system sketch. The generated response would retain a link to its prompt and Telegram message. A reply to that message could then point back to the exact invocation. The proposed feedback record included a good or bad judgment and an explanation. That explanation mattered because “bad” alone gave the system little direction. An answer could be factually wrong, omit relevant context or use the wrong format, and each failure would suggest a different change. I sketched a refinement step that could revise the instructions or add examples to the prompt. I was also considering changing one variable at a time so that a later result could be compared with the earlier one. The loop was still a design, but its storage requirement was clear: useful feedback had to remain attached to the prompt, context and output it concerned. ![Handwritten generation, user-feedback and prompt-refinement flows, with feedback connected to the original invocation.](/assets/idyllic-prior-iterations/building-idyllic-workflows/workflows-april-feedback.png) The feedback path matches a response to its invocation before using it to refine a prompt. ## Giving an assistant a place in a process A sequence of model calls becomes more complicated when a person participates between steps. Julius and I needed a concrete process to explore, so we used his design proposal workflow. He was focused on the user experience, while I was working on the developer tools that could support it. A request first needed Julius's decision about whether to pursue it. Research and a meeting established what the client wanted. A rough proposal collected deliverables, milestones and estimates. Negotiation revised that proposal until there was an agreement, after which the work produced tasks, files and progress updates for review. This gave the assistant specific jobs. It could research an incoming request, extract information from meeting notes or turn agreed details into a proposal using a template. Julius still owned the decision to proceed. The process stage could determine which materials the assistant needed and which actions were appropriate. Preparing a proposal before a scope had been agreed was a different operation from updating tasks during the work. I modeled those stages in XState and brought the model into TypeScript. The state machine described the process; a running actor represented one instance moving through it. Messages could tell that actor that something had happened, such as a proposal being accepted. I had the stage model working before I had useful agent behavior attached to it. The proposal also exposed something that a stage diagram left out. A negotiation might change the deadline and remove a deliverable while remaining in the same stage. “In negotiation” would still be true, but an assistant preparing the next proposal needed the revised terms. The current context had to change even when the stage did not. That led me to distinguish the history of what had happened from the current account of the work. A stored conversation could preserve how the deadline changed. The next action needed the deadline now in force. I considered an event log and processes that would use new events to update state, while leaving open how strict the overall process model should be. ## Describing a program independently of its executor The workflow experiments also made me interested in generating interfaces. In a small text-to-form experiment, I used a nested Zod schema to describe the form elements a model could return. The model produced a structured specification before the result became HTML. The schema gave the form a constrained representation that application code could interpret. ![A request passes through planning and structured element specifications to produce an empty HTML form.](/assets/idyllic-prior-iterations/building-idyllic-workflows/workflows-july-form.png) A form-generation study using a nested schema to constrain the generated interface. I wanted a similar separation for the operations behind the interface. A saved program could describe its steps as data, while an executor supplied the code that ran them. I built a pure-data representation and a Python executor, then tested an essay-ranking script that processed essays in parallel. Writing that small program exposed practical gaps. The format could assign a value to one variable name, but could not yet express all the assignments I needed. It also lacked string interpolation. A literal instruction and an instruction containing the result of a previous step needed different treatment. These were problems I could find by trying to express a program, before asking a model to generate one. A proposed essay workflow made the larger requirements easier to see. It would generate three essays and display them for a person to choose from. The program would retain the selection, run critique and revision steps on that essay, then turn the result into a tweet. I had tested the ranking component; this longer interaction was the design I wanted the program format to support. The selection step changes the runtime. Generation can finish while the program waits for a person. Their choice becomes an input to the next operation, so it needs to be stored somewhere the executor can read. The interface also needs to know when to display the essays, when to accept a selection and which result to show during revision. A chain of model calls alone does not describe those interactions. ![Architecture diagram connecting a user interface, AI composer, program description, execution engine and database.](/assets/idyllic-prior-iterations/building-idyllic-workflows/workflows-july-architecture.png) An architecture study connecting a proposed composer to the execution system I was testing. The architecture drawing separates a composer, a program description, an executor and a database that supplies state to the interface. I hoped an AI composer could eventually help create the programs. My immediate job was smaller and more concrete: write a useful program myself, run it, and discover what the format could not yet express. Waiting for a selection and carrying that selection into a later step were requirements the essay example could actually test. --- [Series index](/writing/building-idyllic-prior-iterations) [Next: Interactive results for AI apps](/writing/building-idyllic-interactive-apps) --- ## Idyll: a convergence layer for agents URL: https://www.wcdc.io/writing/idyll Date: 2026-08-20 Description: A Markdown prototype for goals that outlast an agent session. ## Motivation I was curious about the most effective way to work with multiple agents. Naïvely, I thought the solution was to spawn a lot of agent sessions in parallel, wrangle them through tmux, make sure all the work aligned with the goal, and jump in whenever one needed help. This is what you see on X when people post crazy monitor setups full of Claude Code and Codex sessions. But this can't possibly scale. It fractures my attention and makes the work cognitively exhausting. Nobody wants to spend all day at a desk micromanaging agents. I've been following the agent space for a while, and I've noticed that new breakthroughs usually solve one of two problems: 1. They reduce how much a human has to prompt by automating it, obviating it, or abstracting it away. 2. They give the human a legible surface for understanding the high-level work, so the human can make decisions at that level instead of operating inside every task. That gave me a hint about a new primitive: something that sits above an agent or set of agent sessions and replaces what I do at the desk. I've also been thinking about how to use agents to pursue goals that extend beyond one session: managing a fundraise, conducting a job search, losing weight. These are long-horizon goals that outlast the timescale of most cloud agents. The same primitive should handle those too. ## Breaking down the human's role The first step was to analyze the role I played in my agents. My agents and I form one effective unit that the external world sees through merged PRs and published content. Agents are the interface through which I get work done. If I wanted to create the layer above them, the best place to start was wherever I was still needed: when I intervened, what refinements I supplied, and what context I held implicitly that the agents could not access. Every morning I would open a session and type some version of what we were doing. The goal and our progress against it lived in my head, so every session received a slightly different copy. If I spent an hour steering one agent through a bug, I would come back to the others having lost part of the larger picture. I was doing more than supplying context. I was deciding: - what mattered at the current level of the project - which work should happen next - which outputs were good enough to keep - which decisions were settled and should stop being revisited - whether the work was moving toward the goal at all The agents were producing candidate work. I was selecting, verifying, and carrying the destination between sessions. So that is the thing to build: the goal, written down outside my head, in a form something else can check work against. ## What an idyll is An idyll is one goal, written down in a folder, with an agent whose only job is that goal. The folder contains the end state I want and the conditions that would tell me I reached it, where things currently stand, what has already been tried and what it yielded, and dated records of what actually happened. The agent reads all of that, works out the difference between the current state and the desired state, and hands tasks down to ordinary agent sessions. Those sessions do not need to understand the whole goal. They only need to know what to do next. The example I keep returning to is weight loss. The folder holds the target and how I would know I reached it. Contact is what I ate, what I weighed, how I slept, and what training I did, all dated. Attempts are the interventions I tried and whether they worked. Every day, the idyll folds the new contact into the state and identifies the next difference that matters. A job search has the same basic shape. So does an essay. Each has an end state, a record of contact with reality, a history of attempts, and a process for computing the gap between where things are and where they should be. I called it an idyll rather than an agent on purpose. “Agent” already means a chat session that runs tools. I wanted a word without that baggage, so the thing could grow into whatever it turns out to be. ## Macrostates, not microstates When working with agents, the most important boundary is between “I care that this gets done” and “I care how this gets done.” There are probably thousands of ways to write code that satisfies a specification. Most of the time I do not care which path an agent takes. I care whether the result has the properties I asked for. Drawing that line creates a hierarchy. Without it, every agent output arrives at the same level of importance. You read implementation choices, intermediate reasoning, tool output, and project-level decisions as if they all deserve equal attention. That flatness is what makes twenty sessions unmanageable, not simply the volume. The terms come from statistical mechanics. A macrostate is the description you care about, such as temperature and pressure. A microstate is one particular arrangement of particles that produces it. Enormously many microstates can satisfy the same macrostate, and the point of the macrostate is that you do not need to inspect them individually. An agent session searches through microstates. The idyll holds the macrostate: the end state I want and the conditions that would tell me I am there. This also explains where taste belongs. Sometimes I genuinely care about the path: the architecture, the tone of the prose, the way an interaction feels. That does not mean I need to supervise every microstate. It means those properties belong in the macrostate. If I care that an essay sounds direct and human, that is part of the destination, not a reason to watch every sentence being written. The better I articulate the macrostate, the more freedom agents can have underneath it. ## Prototyping it in Markdown I wanted to reach for a graph database. Goals, attempts, criteria, and evidence map neatly onto nodes and edges, and I had already been excited about graph databases for months. Being excited about a technology is a bad reason to build on it. Infrastructure installed before the problem is understood will carry the design whether or not the design is good. So I gave myself a rule: the concept has to work as plain Markdown files that a person can read and edit before I write a software system around it. If I cannot prototype it in Markdown, I do not understand it yet. That rule also settled the container question. My first instinct was an object with methods. A goal has a lifecycle. Conditions get added and retired. Evidence arrives and attaches to a condition. That sounds like a type with an API. I had built two versions of exactly that in the weeks before. Both encoded my current theory of what a goal was, and that theory kept changing. Every improvement to the concept became a migration of the object model. Markdown makes the opposite trade. It gives up formal structure at the beginning so the representation can move while the domain is still being learned. A person can change it in an editor. An agent can read the new version directly. The stable structure can be extracted later, after it has appeared repeatedly in real use. ## The model already existed in how I use Claude Code Markdown files still need a container. I hand Claude Code folders every day and it already handles them well, so I looked at what those folders contain. Here is a writing skill I use: ```text .claude/skills/prose/ ├── SKILL.md ├── register.md ├── examples.md └── structure.md ``` `SKILL.md` opens with frontmatter describing what the skill is and when the agent should load it: ```yaml name: prose description: > William's writing standards, distilled from every documented instance of him rejecting AI-register prose. Use this skill whenever you are about to write user-facing prose of any kind. ``` The body explains the skill and points to the other files. An agent opens the directory, reads the file that describes it, and follows the references. There is no manifest or registry between the agent and the material. When I want to change what it knows, I edit a [Markdown](https://commonmark.org/) file. A repository works the same way one level up. `CLAUDE.md` sits at the root, and the rest of the project is available through filenames, headings, links, and ordinary search. I have never needed to write a parser for either. Files, prose, and an agent that can read are flexible enough to absorb changes that would require migrations in a typed object model. An idyll uses the same shape, one folder per goal, with the goal where the instructions normally go. It becomes the layer above [Claude Code](https://claude.com/claude-code) that holds the destination and hands work down. ## What goes in the folder The current format has five entries. Only one section changes shape between domains. ```text IDEAL.md destination: one paragraph describing the world when this is done acceptance criteria: each carrying its measurement procedure domain section: the only variable grammar STATE.md where things stand now, dated and kept separate from IDEAL ATTEMPTS.md what was tried -> what it yielded worked / did not work / unclear, append-only contact/ dated records of what happened, with excerpts and references registers/ standing records for recurring people, policies, incidents, hypotheses, applications, or other domain objects ``` ### `IDEAL.md` `IDEAL.md` states the destination and the conditions that would make it true. Each acceptance criterion carries its own method of measurement. “The essay is good” is not a criterion. “A technical reader can reconstruct the compiler pipeline without opening the codebase” is closer, because someone can actually test it. The domain section is allowed to vary. A policy goal may contain rules and causes. A research goal may contain hypotheses and falsifiers. A job search may contain market hypotheses and pipeline stages. A learning goal may contain a curriculum and mastery tests. That variation stays in the text. There is no application-level catalogue of goal types. ### `STATE.md` `STATE.md` describes where things stand now. It is dated, factual, and glanceable. Keeping it separate from `IDEAL.md` matters more than it appears. If the current state can leak into the desired state, the goal quietly becomes whatever has already been achieved. The two files create a hard boundary between the map and the current position. ### `ATTEMPTS.md` `ATTEMPTS.md` is append-only. Each entry says what was tried and what it yielded. The result can be `worked`, `did not work`, or `unclear`. “Unclear” matters because missing evidence is different from failure. It tells the idyll to collect information before repeating or rejecting the attempt. ### `contact/` Contact is what actually happened: a weight measurement, a meal, a reply from an investor, a rejected application, a user interview, a changed artifact, a new test result. Every record is dated and includes the relevant excerpt or measurement. Without absolute dates, the idyll cannot calculate a rate, a streak, staleness, or distance to a deadline. ### `registers/` Registers hold recurring entities that accumulate history: one file per company in a job search, one record per policy or incident, one page per hypothesis, one record per investor. The code only knows that the folder and files exist. Everything that differs between losing weight, raising money, and revising an essay lives in the prose. ## What convergence means An idyll is not just a memory folder. Its job is to make a large number of agent runs converge. Each run creates a candidate change to the world: a code edit, a message, a revised argument, a new experiment, a different diet. The idyll has to decide what to keep, what to reject, what is now settled, and what uncertainty remains. The operators I keep arriving at are: - **Diverge:** generate meaningfully different approaches when the current one is not enough. - **Verify:** check an output against the written conditions while the work can still be changed. - **Select:** choose the best candidate at the right level of granularity. A paragraph can be kept without keeping the entire draft. - **Lock:** record settled decisions so later agents do not reopen them without new evidence. - **Distill:** turn repeated results into a reusable rule, preference, or higher-level instruction. Merge is a form of selection at a finer grain. Instead of choosing one complete output, the idyll can keep the strongest parts of several. Three things separate convergence from wandering: 1. Verification happens inside the round, not after a long chain of work has already accumulated. 2. Settled decisions are locked, so the system does not repeatedly explore the same branch. 3. Attempts and contact remain available, so the system does not repeat work without knowing what happened before. ## Why I removed the progress score My first implementation had a distance number and a convergence verdict. They are the obvious things to put on a dashboard. They also invite the model to fabricate precision. Ask for progress from zero to one hundred and it will usually produce a number, even when the criteria share no common scale and half the evidence is missing. The guess looks exactly like a measurement. The better procedure is less compact: 1. Take one condition from the macrostate. 2. Find the evidence relevant to it. 3. Check the condition using its written measurement procedure. 4. Cite the evidence. 5. Return `satisfied`, `not satisfied`, or `not verifiable`. `Not verifiable` is a real answer. It means the next task may be to obtain a measurement rather than to do more work. This also clarifies the role of summaries and indexes. Assume the agent can read every session, revision, [Git](https://git-scm.com/) commit, message, and subagent tool call at no cost. What is still missing? The summary can be reconstructed and the index can be derived, so neither is missing. The macrostate stays missing until a person articulates it, and verification stays missing because reading a record is not the same as checking it against conditions. Summaries, indexes, and scores may still be useful when context is expensive. They are caches. I should add them after observing the expensive read they save, not build them into the concept in advance. ## How to tell whether it is converging I do not think convergence reduces to one number. Three trends have to agree. ### The state moves toward the criteria More of the written conditions become satisfied, or the gap on a measurable condition gets smaller. ### The criteria stop moving Early in a project, criteria should sharpen as the goal becomes better understood. Over time, that churn should decline. If the destination changes after every attempt, apparent progress may only be the system rewriting the goal to match what it happened to do. ### The error signal narrows The next unresolved question should get smaller and cheaper: ```text How would we measure this? -> Which artifact contains the evidence? -> Does section three explain the runtime boundary? -> Add one sentence distinguishing validation from execution. ``` An attempt bought something if it made the next question more specific. A hundred attempts that return the same error signal are activity, not convergence. So an idyll is converging when the state approaches criteria that are stabilizing, while each round produces a narrower next question. This is still a theory, not a result I want to overclaim. The structure is clear enough to test; whether it holds across months-long goals has to come from running it against months-long goals. ## Where the project is now The idyll currently runs as a skill file plus a small verifier that can inspect any folder containing an `IDEAL.md`. The larger engine and interface are on a branch. I am still holding the project to the Markdown rule. Every implementation wants to add stages, indexes, scores, or new types. I keep cutting those back unless repeated use gives me a reason to keep them. I also ran a lab that was supposed to test convergence. It exposed a bad experiment: the custodian was grading its own output, and no real work happened between passes, so the system converged by construction. It could test whether the folder was internally consistent. It could not test whether the folder caused better work in the world. The next test is not another simulation. It is to run real goals for months: a job search, a body-composition goal, a fundraise, a substantial piece of writing. The structure should come out of what those goals repeatedly require instead of being proposed to them in advance. The standard for adding more software remains the same. When the Markdown stops being enough in the same place more than once, that is evidence for the next abstraction. --- ## Project Cyborg: an engine for iterative AI research URL: https://www.wcdc.io/writing/project-cyborg Date: 2026-06-11 Description: How independent samples and a feedback loop turn a document collection into an ongoing research process. Project Cyborg is an experiment in running AI research over an existing collection of documents. I wanted to find out whether repeated, independent samples could surface useful patterns, and whether those findings could guide the next round of research. Over forty days, the experiment developed into a research engine with reproducible sampling, a ledger for every model call, and a channel for feeding unresolved questions back into the next run. ## The constraint was never compute Running model calls in parallel was straightforward. Deciding what those calls should do, and how to use their results, needed a system around them. Ask a vague question ten thousand times and you get ten thousand vague answers, which is a reading problem stacked on top of whatever problem you started with. The engine could produce text far faster than I could read it. The question became: **what kind of system converts compute into value reliably enough that adding more compute adds more value?** I ended up calling that compute market fit. A system has it when the only thing standing between it and more output is more compute. Most systems do not have it. You drive compute into them and they produce noise, or they produce good work that nobody has the attention to consume, and either way the marginal dollar buys nothing. Finding one of those systems was the actual experiment. Everything else was apparatus. ## Keep each experiment bounded I gave each experiment a limited budget and wrote down its result before choosing the next approach. The limit made it possible to abandon an unproductive program without committing the rest of the experiment to it. Every program read existing documents. An experiment could finish without waiting for new observations. ## Compute over history rather than over the future An observation system starts collecting data when it is installed. Useful patterns may take months to appear. An existing document collection lets the experiment start with enough material to sample immediately. The corpus was already indexed and embedded, so each program could draw a different selection and finish within one run. The engine samples that material repeatedly, compares the results, and records what each pass cost. ## The accounting comes before the research The ledger was built before any research program, because an experiment that cannot say what it spent is not an experiment. Every model call goes through one wrapper, which appends one line to a file: ```ts interface LedgerEntry { ts: string; // ISO timestamp at completion runId: string; program: string; model: string; inputTokens: number; cachedInputTokens: number; outputTokens: number; costUsd: number; ms: number; ok: boolean; error?: string; } ``` Nothing else is allowed to be the source of truth. A database exists for querying and gets rebuilt from the file, so a disagreement between them is settled by throwing the database away. Failed calls land there too, since a run that errored still cost tokens. Three append-only files hold everything the engine knows about itself, and their line counts are the shape of the experiment: ``` engine/data/ledger.jsonl 6,211 one line per model call, with its cost engine/data/runs.jsonl 12,282 lifecycle: run_start, run_end engine/data/frontier.jsonl 413 one line per open question ``` The lifecycle file carries 6,211 `run_end` events against 6,061 `run_start` events. The gap is the useful part: a hundred and fifty runs ended without a recorded start, because I restarted the engine five times mid-flight. A file that recorded only completions would have shown a clean number and hidden every interruption. The runner enforces a budget limit using estimated costs. Early estimates diverged substantially from billed usage, so the watchdog needs a conservative margin for estimation error. ## Repetition across independent samples is the cheapest signal detector Ten programs ran. The one that mattered most is the simplest. **ensemble** asks the same question many times, each from a different sample of the corpus, independently, and then counts which claims recur. Those claims become candidates to check against their source passages. A single expensive answer and many cheaper independent ones can use a similar budget. Comparing independent answers helps identify which claims recur across the source material, though repetition alone does not establish that a claim is true. The other programs are variations on where to point it: connections across documents I never stated in one place, mechanisms for frictions that keep recurring, ideas that must come back with a test and a kill criterion, and a synthesis pass every forty runs or so over everything produced since the last one. Models are routed rather than pooled. The strongest model gets the fewest slots and the questions needing a mechanism; the cheapest gets the most slots and the questions needing volume: ```ts export interface Program { name: string; model: string; weight: number; // scheduler weight charBudget: number; // packet size, ~4 chars per token maxOutputTokens: number; weights?: Record; // packet collection mix buildSystem: () => string; buildPrompt: (packet: Packet, seed: number, extra?: string) => string; } ``` The corpus is a read-only local snapshot, and the sampler that draws from it is seeded and reproducible. Keeping the snapshot unchanged makes it possible to re-run an experiment against the same material. The sampler weights exposed a less obvious problem. They applied to collections, so a file's chance of being drawn also depended on the collection's size: ```ts // Per-file draw probability within a collection: // collection sampling probability / number of files in that collection ``` A weight that reads as a preference between collections is a preference between files once you divide by how many files each collection holds. Nothing reports it. Every draw is legal, every packet looks varied, and the only symptom is the same material arriving under different seeds. ## What it returned The output is a file of attractors: claims that kept re-emerging across independent samples, each with the number of waves it survived and a pointer to its strongest evidence. ``` Append-only trace/artifact substrate is the missing primitive 12 waves stable The product wedge is a source map for intelligence 5 waves strengthening The right unit is a persistent executable artifact, not chat 11 waves stable The trust membrane is a receipt and checkpoint layer 8 waves stable ``` The recurring need for append-only records and persistent executable artifacts influenced the systems I built afterward. Runs, documents and decisions needed durable identities and links to their sources, so later work could inspect how a result was reached. ## The engine could not learn between waves For most of its life the thing was open-loop, and the ledger could not see it. Synthesis generated exactly three questions for the next wave and kept a short list of unresolved ones. Those questions went into a markdown file, and nothing read them. Every indicator said the system was healthy. Runs completed, artifacts got written, syntheses produced good questions about those artifacts. The failure was visible only in the content of successive waves: the same five convergences kept re-emerging, so marginal insight per dollar was falling while spend held flat. The question that named it, put to my own system, is the one worth stealing: **are we making an agent or just making random calls?** An [open-loop controller](https://en.wikipedia.org/wiki/Open-loop_controller) acts without measuring what its action achieved, which describes a heater with no thermostat and described this engine exactly. Every wave started at a fresh random sample, because the sampler had no access to anything the synthesizer had learned. The fix is one harvester scraping questions out of the synthesis prose into a line-delimited file: ```json {"ts":"2026-06-11T19:13:28.725Z", "q":"What is the minimal process primitive that unifies organs, documents, triggers, and agent runs?", "source":"2026-06-11181420-synthesis-00193.md"} ``` The `source` field is what makes it a loop rather than a queue, because every question walks back to the artifact that raised it. Two programs consume it, and each returns a verdict rather than prose: ``` frontier-chase answered | needs-data | wrong-question deepen promote | revise | kill ``` Three verdicts, not two. A binary forces every question into settled or unsettled, and the third option in each row carries the information the pair throws away. A `needs-data` verdict has to design the experiment that would settle the question, so the cheap answer of declaring more evidence necessary costs something to give. It seeded with 134 questions pulled from 26 synthesis files and now holds 413. The mechanism transfers: **a feedback loop needs a machine-readable channel between its halves, and prose is not one.** The synthesis output was always full of good questions embedded in paragraphs, which is a format only a human can act on, and a human acting on it was exactly what the experiment could not afford. ## What the engine needs Compute buys one person very little on its own. The binding constraint is attention, and no quantity of calls relieves it. Compute buys the ability to run a structure many times, which makes the only question worth asking which structures survive that treatment. These did, in the order they mattered: - an accounting layer you trust, built before any research program - a corpus the engine cannot write to, and a sampler reproducible from a seed - history rather than forward observation, so the system starts warm - independent samples to identify recurring claims for verification against the source material - a machine-readable path from what the system learned back to what it does next - trajectory capture, which the ledger still does not provide and which belongs above every research program on this list The last one is the gap I named on the first night and never closed. The ledger records that a call happened and what it cost, and nothing about how the run got there, so a good run and a lucky run are indistinguishable in the record and nothing downstream can learn what made a program work. The first engine had most of that list, ran well, and could not accumulate. The distance between a system that produces and a system that improves was one file and a consumer for it, which is the cheapest item here and the one everything else was waiting on. --- ## Cortex: searching everything I've written in one second URL: https://www.wcdc.io/writing/cortex Date: 2026-03-20 Description: A search engine for my journals, notes and AI conversations. Cortex searches everything I have written: journals going back to 2012, every conversation I have had with a model since 2024, meeting transcripts, voice notes, and book digests. I can ask a question in ordinary language and get the ten passages most likely to answer it. I first tried [qmd](https://github.com/tobi/qmd), Tobi Lutke's local search engine for Markdown corpora. It worked, indexed the whole corpus, and took an afternoon to set up. It also took 15 to 40 seconds to answer a hybrid query and installed about two gigabytes of local embedding models. After a few days, I had stopped using it. That gave me the requirement for Cortex: return useful results in about a second. Search has to fit inside a train of thought. At one second, I will try five versions of a vague question and follow whatever looks promising. At 15 seconds, each query becomes an errand, so I only search when I already expect a useful result. Once I set that budget, the architecture followed from a practical question: what can Cortex compute before I ask anything? ## Keyword and vector search cover each other's misses Keyword search is fast and precise. [BM25](https://en.wikipedia.org/wiki/Okapi_BM25) ranks a passage by the query terms it contains, giving more weight to rare terms. It works especially well for names, quotations, and distinctive phrases. A search for `IdyllicValue` should find that exact string. It misses paraphrases. If I search for "forcing function," BM25 will overlook an entry where I wrote "a constraint that makes me do the thing." Vector search handles that case. Cortex embeds every chunk as a vector and embeds the query with the same model. Nearby vectors tend to express similar ideas, even when they share few words. The tradeoff is precision: semantic search often returns material related to the topic without answering the question, and unfamiliar proper nouns may disappear entirely. I run both searches in parallel and combine their rankings with [reciprocal rank fusion](https://plg.uwaterloo.ca/~gvcormac/cormacksigir09-rrf.pdf). BM25 scores and vector distances have different meanings and scales, so I discard the raw scores. RRF only uses each result's position in each list: ```ts const k = 60; for (let i = 0; i < bm25Results.length; i++) { const rrf = bm25Weight / (k + i + 1); // add rrf to this chunk's fused score } for (let i = 0; i < vectorResults.length; i++) { const rrf = vectorWeight / (k + i + 1); // add rrf to this chunk's fused score } ``` A chunk that ranks well in both lists rises above one that only one method likes. The constant flattens the top of the curve, keeping a single first-place result from overwhelming consistent evidence from both searches. Fusion takes less than a millisecond. RRF improves recall, though it still cannot tell whether a passage answers the query. BM25 counts word overlap. Vector search compares two independently computed representations. Neither reads the query and passage together. ## I retrieve broadly, then rerank fifty candidates A reranking model reads the query beside each candidate and scores their relevance as a pair. Its judgments are much better than either first-pass search. Running it across 100,000 chunks would be slow and expensive, so Cortex gives it the fifty candidates retained by BM25, vector search, and RRF. That produces a three-stage query path: 1. Run BM25 and vector search in parallel. 2. Fuse their candidate lists with RRF. 3. Send the top fifty to [Cohere's reranker](https://cohere.com/rerank) and return the best ten. The command exposes each stage so I can inspect and tune it: ```text $ organs cortex search --help Options: -m, --mode vector (default), hyde, keyword, hybrid -n, --limit Max results (default: "5") -c, --collection Filter to a single collection -p, --path Filter results to path prefix -v, --verbose Show timing breakdown --pool Candidate pool size before reranking (default: "50") ``` `--mode` lets me compare keyword, vector, and hybrid results for the same query. `--pool` controls how much work reaches the reranker. A larger pool gives it more chances to recover a good passage and costs more per query. `--verbose` prints the timing of every stage because a total alone does not tell me what to fix. ## A flat vector scan fits this corpus better than HNSW I initially assumed Cortex needed HNSW because it is the standard index for vector search. [HNSW](https://en.wikipedia.org/wiki/Hierarchical_navigable_small_world) builds a graph over the vectors and walks that graph toward likely neighbors. It is valuable when a full comparison against millions of vectors would be too expensive. Cortex has roughly 100,000 chunks on one laptop. I also filter searches often: one collection, one directory, or the entire corpus. HNSW makes those filters awkward because its graph was built across the full dataset. Filtering removes nodes that the graph expects to traverse. I chose an exact flat scan using SIMD distance computation. Filters become ordinary SQL conditions, and smaller scopes make the scan faster: ```sql SELECT chunk_id, distance FROM vec_chunks WHERE embedding MATCH ? AND k = ? ORDER BY distance ``` Collection and path constraints are additional `AND` clauses. I get exact ranking, simple filters, and no recall parameter to calibrate against a ground-truth dataset I do not have. The scan grows linearly with the corpus. When Cortex held 300 to 400 chunks, it took about 1.5 milliseconds while embedding a query took 100 to 200 milliseconds. The corpus has since grown by three orders of magnitude, and the scan remains below the slowest query stages. If that changes, I can add an approximate index in response to a measured bottleneck. ## Markdown is the source of truth I had used the Cortex name before for a portable wiki. Each `.cortex` file was a SQLite database containing entries with double-bracket links. A command-line tool edited it, a small web server displayed it, and semantic search eventually indexed its chunks. I made six of these databases from book digests; the largest contained 73 entries and about 400 chunks. Putting the writing inside SQLite made the format responsible for everything around it. I needed an editor, a viewer, synchronization, and diffs. Other tools on the machine could no longer treat the entries as ordinary files. The current Cortex keeps the corpus as Markdown, subtitle, and text files. SQLite stores a disposable search index derived from those files: ```sql CREATE TABLE documents ( collection TEXT NOT NULL, path TEXT NOT NULL, content TEXT NOT NULL, hash TEXT NOT NULL, indexed_at TEXT NOT NULL, UNIQUE(collection, path) ); CREATE TABLE chunks ( doc_id INTEGER REFERENCES documents(id) ON DELETE CASCADE, chunk_index INTEGER NOT NULL, text TEXT NOT NULL ); CREATE VIRTUAL TABLE vec_chunks USING vec0( chunk_id INTEGER PRIMARY KEY, embedding float[1536] distance_metric=cosine ); CREATE VIRTUAL TABLE documents_fts USING fts5( title, content, collection, content='documents' ); ``` The hash makes indexing incremental. Cortex skips an unchanged file and recomputes the chunks and embeddings for a changed one. I can delete the database and rebuild it from the corpus at any time. A derived index can fall behind its sources, so Cortex reports that state explicitly. `status` tells me which files still need indexing or embedding. This keeps stale data visible without turning the index into another source of truth. ## The timings changed what I worked on I timed each query stage separately on the full corpus. These figures show where the current system spends its time; the corpus has roughly doubled since the first implementation. | Stage | Warm | Cold | |---|---:|---:| | BM25 over the keyword index | 22–107ms | 8465ms | | Embed the query | 286–792ms | 873ms | | Scan the vectors | 475–761ms | 955ms | | Fuse the two lists | \<1ms | \<1ms | | Rerank fifty candidates | 351–362ms | 448ms | | **End to end** | **1.2–1.7s** | **10.7s** | Warm queries take 1.2 to 1.7 seconds. The query embedding and vector scan account for most of the variation. The hosted reranker is unusually stable at about 350 milliseconds, and RRF is effectively free. The first query after the system has been idle is completely different. BM25 jumps from tens of milliseconds to 8.5 seconds while the other stages change much less. I have not proved the cause, though the pattern looks like the operating system reading the index from disk into its page cache. The next query returns to the warm range. Separating cold and warm measurements matters here. Their average would describe neither experience and could send me toward the wrong component. The warm path tells me where repeated searches spend time. The cold path isolates a startup problem in the keyword index. The measurements also justified replacing qmd. Its local embeddings protected text from leaving my machine, while Cortex already sent candidates to Cohere. That privacy boundary had already been crossed. Hosted query embeddings removed the two-gigabyte local model and cut a 15-to-40-second query to the range where I would use it. The hosted design leaves a clear bill: one embedding call and one reranking call per search, plus embeddings for every new or changed chunk. I accepted that cost because the local alternative had already shown me its cost in time, disk, memory, and abandoned searches. ## Retrieval semantics belong in the schema version An early version used the wrong vector distance metric. The embedding model produces normalized vectors, so Cortex should compare them with cosine distance. The database accepted another metric without an error or warning. Results still looked plausible; they were simply worse. Correcting the metric required re-embedding the corpus. Bugs in stored representations get more expensive as the index grows, even when the code change is one line. I added a schema version so Cortex can identify an incompatible index and rebuild it deliberately. The vector extension also constrained the runtime. SQLite has to permit extension loading, and the database driver has to expose it. The usual native SQLite package, [better-sqlite3](https://github.com/WiseLibs/better-sqlite3), did not build under [Bun](https://bun.sh/), while the SQLite bundled with macOS was compiled without extension loading. [Homebrew SQLite](https://brew.sh/) paired with [Bun's SQLite driver](https://bun.sh/docs/api/sqlite) satisfied both requirements. That compatibility chain decided the runtime setup. ## Each source type owns its preprocessing Cortex began with Markdown, then gained `.srt` transcripts and plain-text meeting notes. Subtitle files contain sequence numbers and timestamps that waste embedding tokens and distort chunk boundaries. I wanted each new source type to add one implementation without adding format checks throughout the indexer. The indexer selects a chunk strategy by file extension: ```ts interface ChunkStrategy { preprocess(text: string): string; chunk(text: string): Chunk[]; extractTitle(text: string, path: string): string; } ``` The Markdown strategy splits around headings. The subtitle strategy removes its structural noise before using the plain-text chunker: ```ts preprocess(raw) { return raw .replace(/^\d+\s*$/gm, "") .replace(/^\d{2}:\d{2}:\d{2}[.,]\d{3}\s*-->.*$/gm, "") .replace(/\n{3,}/g, "\n\n") .trim(); } ``` Unknown extensions use the plain-text strategy. The generic chunker never needs to know what a timestamp or Markdown heading looks like; that knowledge stays with the relevant format. ## Indexing carries the work that search cannot afford Cortex decides chunk boundaries, computes embeddings, and generates summaries before any query arrives. It indexes the summaries beside the raw text, giving semantic search a distilled description of a long conversation or transcript. At query time, the system only embeds the question, retrieves candidates, fuses them, and reranks fifty passages. Three commands maintain that precomputed state: ```bash $ organs cortex index # hash files and chunk what changed $ organs cortex embed # embed new chunks, ten in parallel $ organs cortex status # report work still outstanding ``` Precomputation also defines what the search index cannot answer. Vector similarity has no concept of recency, so a passage from 2020 can outrank one from yesterday. I use a separate command that reads files by date for questions such as "what happened this week?" Recency and semantic similarity are different orderings, and I keep them separate. The final system is a directory of ordinary files, a derived SQLite database, and two hosted model calls. BM25 preserves exact language. Vector search catches paraphrases. RRF combines their rankings. The reranker spends its attention on fifty candidates. A flat scan keeps filtered search simple and exact at the current corpus size. I arrived at that design by measuring the version I had. The existing tool proved that the corpus was searchable and that 15 to 40 seconds was too slow. Cortex moves almost everything it can to indexing time so the remaining query path is short enough to use while I am still thinking. --- ## ai-organs: building a personal system out of small programs URL: https://www.wcdc.io/writing/ai-organs Date: 2026-03-19 Description: Keeping up with daily routines through Claude Code. ai-organs is the personal system I run on my own machine. It includes separate tools for habits, health, finance, Korean study, writing, memory, goals, relationships, and search. Each tool owns its data and exposes a small command-line interface. A coding agent calls them together when I ask a question that crosses domains. I arrived at this structure after building several versions around context. I collected notes, Markdown files, embeddings, and databases, then loaded the relevant material into a model. The answers were useful at first. They degraded as soon as the material went stale. That failure changed what I was building. A folder of personal context can only describe what was true when I last updated it. I wanted components that could ingest new data, check their own state, and tell me when something had broken. I called those components organs. ## An organ owns a domain and maintains it My earlier systems treated the model as the only active part. Everything else was material for it to read. That made me responsible for keeping every fact, summary, and index current. The system consumed the same attention I had built it to save. In ai-organs, each component owns a domain and the work required to maintain it. The habits organ records checks, renders weekly views, and detects problems with its database. The finance organ pulls transactions and tracks the freshness of its data. The writing organ has no database, though it still owns a stable operation: evaluate prose against a set of standards and return a verdict. I made maintenance part of the interface: ```ts export interface OrganLifecycle { name: string; setup(): Promise; doctor(): Promise; fix(checkName: string): Promise; } ``` Twelve organs implement this lifecycle. `setup` prepares the organ on a new machine. `doctor` reports what is missing, stale, or misconfigured. `fix` handles repairs that can be automated. If I cannot write a meaningful `doctor`, the component has no way to distinguish healthy state from silent decay. This definition also separates an organ from a context file. Two directories may contain identical data, while only one has a process responsible for keeping that data accurate. The difference is operational ownership. ## I use organs for practices that lose to willpower I needed an admission rule because almost anything can become a personal automation. "What takes time?" produced a list of minor chores. Most saved a few minutes from work I was already doing. I now ask which useful practices repeatedly disappear when my attention gets thin. Financial review, habit tracking, prose review, and spaced study all have proven value for me. Each one works when I do it consistently, and each one tends to collapse during a bad month. Those are good candidates for organs. A daily financial review may take ten minutes, yet automating it does not save ten minutes because I was often skipping it. The useful change is frequency: the review goes from occasional to daily. I am scaling a practice that my available willpower could not sustain. This test keeps ai-organs focused on work I already understand. I do not automate a speculative routine and hope it becomes valuable. I automate the maintenance around a practice that has already paid for itself. ## Developer tools gave me the initial inventory Introspection gave me a short, arbitrary list of organs. My development environment gave me a better one because it already contained small programs selected through years of actual use. Developer tools perform general information operations. A build system turns one representation into another. Version control makes history addressable. A linter evaluates work against a standard and returns errors that another process can act on. Those operations apply well outside software. That analogy produced the current package inventory: ```text packages/ habits/ health/ finance/ korean/ social/ cortex/ memory/ macrostates/ log/ voice/ imagine/ google/ writing-tools/ digest-book/ ai-provider/ cli/ data/ ``` The directory contains sixteen organs and three infrastructure packages: the model provider, the CLI bindings, and the data resolver. Each organ has a domain, a command surface, and an output that another program or agent can inspect. A chat window does not meet that bar. A prose linter does, even though it stores nothing. ## MCP gave the agent tools; the shell made them composable I first considered exposing every organ through one [MCP](https://modelcontextprotocol.io/) server. MCP lets a model choose a function, call it, and receive the result in its conversation. That works well for isolated operations. Cross-domain questions reveal the cost. Suppose I ask for my average strain across the last thirty workouts, grouped by the weeks when I actually meditated. The agent needs two datasets and a join. Through MCP, it calls one tool and reads thirty workout records into the conversation. It calls another and reads a list of habit dates. It then performs the join inside its context. The conversation becomes the storage layer for every intermediate result. Large outputs consume tokens even when the model only needs to pass them to the next operation. Reusing a result means keeping it in context or reading it again. MCP supplies function calls, while composition still has to happen inside the model. The shell already has a place for intermediate data: ```bash organs health strain -n 30 > /tmp/strain.json organs habits show "Meditate" --json \ | jq -r 'select(.checked).date' > /tmp/med.txt join /tmp/strain.json /tmp/med.txt ``` The two organs write files, and `join` combines them. The model can inspect the final result without reading every number along the way. Pipes pass output directly between programs; files and variables preserve results for later use. This is why ai-organs is a CLI instead of a large tool server. I already had a filesystem, processes, pipes, variables, permissions, and remote execution. Recreating those features inside a model protocol would have given me a weaker version of the operating system on my laptop. ## Functions, organs, and systems have different jobs I use three levels of composition: - A **function** performs one operation, such as checking a habit, reading today's strain, or appending a log entry. - An **organ** groups functions around one domain and owns that domain's state. - A **system** reads across several organs to answer a larger question. The morning briefing is a system. It reads recovery from health, this week's adherence from habits, recent spending from finance, and current goals from macrostates. Each organ returns a narrow fact. Their combination can tell me that a week is coming apart. I define systems as prompts containing organ calls: ```md Read this morning's state and tell me what it means, not what it says. organs health strain organs habits day organs finance tx -n 20 organs macrostates tree Name the one thing that changed since yesterday. If nothing changed, say so. ``` Writing a system takes a paragraph and a few commands. The organs remain independent, while the agent decides how to combine their outputs for the current task. | Biology | Unix | ai-organs | |---|---|---| | cell function | a command such as `grep` | a function such as `habits check` | | organ | a program such as `git` | an organ such as `organs habits` | | organ system | a pipeline of programs | a prompt such as the morning briefing | | organism | a shell session | an agent session | | nervous system | the shell | the agent | The model sits above the organs because it owns no domain state. It reads their outputs, chooses what to call next, and composes results. The shell handles the mechanical movement of data; the model handles decisions whose sequence cannot be fixed in advance. ## I stopped designing a personal operating system I had spent two years describing this project as a personal operating system. One architecture document specified a kernel context, a user context, a process messaging interface, and scoped databases for each process. My laptop already provided those facilities. The coding agent could coordinate processes. The shell could connect them. The filesystem could store shared artifacts. SQLite could give each component a local database. iCloud could synchronize ordinary files. I reduced the architecture to three assignments: - [Claude Code](https://claude.com/product/claude-code) coordinates the work. - The `organs` CLI exposes each component's operations. - [iCloud](https://www.icloud.com/) synchronizes the files. That decision also killed two of my own packages. One was a wiki format that stored entries inside a custom database. Once writing entered that database, every editor, viewer, sync tool, and diff needed an integration. Markdown files already worked with all of them. The habits command surface shows how little custom substrate I needed: ```bash organs habits check "Meditate" organs habits check "Exercise" -n "Ran 5km" organs habits check "Exercise" -d 2026-03-17 organs habits uncheck "Exercise" organs habits day organs habits week organs habits grid organs habits stats organs habits add "New Habit" -d "description" organs habits archive "Old Habit" ``` Two commands write entries, several read them at different resolutions, and two manage the habit list. The surrounding infrastructure is generic: a coding agent, a cloud drive, a shell, and SQLite. ## Each organ owns its state and one resolver owns its location The organs use different storage because their domains need different things: | Organ | Domain | State | |---|---|---| | `habits` | behavior tracking | SQLite | | `health` | body data | the [WHOOP](https://developer.whoop.com/) API | | `finance` | money | the [Mercury](https://mercury.com/) API | | `korean` | learning | Markdown lessons | | `write` | prose quality | stateless | | `memory` | world model | [Zep](https://www.getzep.com/), a hosted temporal graph | | `social` | relationships | SQLite and one Markdown file per person | | `macrostates` | goals | Markdown folders encoding status | I only enforce two boundaries. An organ cannot read or write another organ's private state. It also cannot hardcode the location of its own data. One resolver chooses the root for every package: ```ts function resolveDataRoot(): string { if (process.env.AI_ORGANS_DATA) return process.env.AI_ORGANS_DATA; if (existsSync(ICLOUD_BASE)) return join(ICLOUD_BASE, DATA_DIR_NAME); const xdg = process.env.XDG_DATA_HOME ?? join(homedir(), ".local", "share"); return join(xdg, DATA_DIR_NAME); } ``` The explicit override wins. A machine with my iCloud folder uses it. Other machines fall back to the platform data directory. No organ contains an absolute path. I learned the value of this boundary when one package bypassed the resolver and opened a database at its hardcoded iCloud path during command registration. On a Linux machine without that path, every `organs` command crashed at startup. A broken task-list database prevented an unrelated habit check from running. I fixed the path and delayed resource creation until the relevant command executes. Now a missing store takes down one operation at call time instead of the entire CLI at startup. State ownership also requires a single writer. ai-organs runs on my laptop and a Linux box, while only the laptop writes to synchronized SQLite files. SQLite cannot merge concurrent histories. If both machines write, a habit check or log entry can disappear without a conflict I can resolve. ## Libraries contain domain logic; the CLI contains wiring The organs began as independent packages. I wanted them to remain usable from TypeScript while still sharing one command convention. Each package exports its data types, readers, renderers, lifecycle, and command registration: ```ts export { HabitDB } from "./db"; export type { Habit, Entry } from "./db"; export { renderDay, renderWeek, renderMonth, renderStats } from "./views"; export { habitsLifecycle } from "./lifecycle"; export { registerHabitsCommands } from "./commands"; ``` The CLI package owns flags, output formatting, and command registration. Other code can call `HabitDB` or a renderer directly without pretending to be a terminal process. The wiring layer is also the only place where one organ can break the common command surface. I keep registration lazy so importing an organ does not open files, connect to APIs, or construct services: ```ts export function registerHabitsCommands(cmd: Command, providedDb?: HabitDB) { const runWithDb = (fn: (db: HabitDB) => T): T => { const db = providedDb ?? new HabitDB(); try { return fn(db); } finally { if (!providedDb) db.close(); } }; } ``` Registration describes the command. The handler opens the database when the command runs and closes it afterward. A machine without the habits database can still use every unrelated organ. ## I designed the human input around bad weeks Some state can only come from me. A wearable knows my strain, while it cannot know that I abandoned a goal or forgot to record a workout. The habits schema makes that ambiguity visible: ```sql CREATE TABLE entries ( habit_id INTEGER NOT NULL REFERENCES habits(id), date TEXT NOT NULL, checked INTEGER NOT NULL DEFAULT 1, notes TEXT, UNIQUE(habit_id, date) ); ``` Completing a habit writes a row. Skipping it and forgetting to record it both leave no row. More schema cannot recover information that never entered the system. I therefore limit the system to two required moments of attention each day: a morning check and an evening check. Everything between them runs automatically or gets captured as I mention it to the agent. Two check-ins give me less information than continuous logging. They also survive weeks when continuous logging disappears entirely. The shared log is one timestamped Markdown file per day. The agent appends entries as I work, so I do not have to open a form. I keep the log as plain text because I read and diff it directly; query performance matters less there than visibility. The daily cycle gives maintenance a deadline. A continuously running personal system can become vaguely stale without a clear failure point. A morning and evening cycle tells both me and the agent when each check is due. ## The interface can change without moving the state A shell is a good composition layer and a poor dashboard. I wanted to see the day, habits, strain, balance, and recent log entries without asking the agent to assemble them every time. I built a text interface with a navigation rail, a main view, an activity feed, glance metrics, and a command bar. Plain text entered in the bar goes directly into the daily log. The most common interaction is also the cheapest one. The dashboard reads across several organs through a snapshot builder. It receives read access only. Every write still goes through the organ that owns the affected state, preserving the same boundary as the CLI. Three different interfaces have now sat above the command surface. I could replace each one without migrating the underlying data. That is the practical payoff of state ownership. The interfaces also exposed a limit in the architecture. When I stopped opening a dashboard, the interactions it had encouraged disappeared with it. Stable storage does not create attention. The surface still has to earn a place in my day. ## ai-organs is the boundary between maintenance and composition The system now has a simple division of work. Each organ maintains one domain, owns its state, and exposes commands. The operating system stores and moves intermediate results. The coding agent reads across organs and decides how to compose them for the question I am asking. That boundary keeps the system small. Adding a domain means building one package and its maintenance lifecycle. Adding a cross-domain view means writing a prompt or snapshot that calls existing organs. Replacing an interface leaves the state untouched. ai-organs runs on Markdown, SQLite, APIs, command-line programs, and a coding agent. The individual technologies are ordinary. The useful part is that I no longer need one model context, one database, or one application to contain my entire life. I need small components that stay accurate on their own and a reliable way to combine them. --- ## Elements of Agentic System Design: a map of the code around a model URL: https://www.wcdc.io/writing/harness-engineering Date: 2026-03-13 Description: A book and Claude Code skill for designing and reviewing agent runtimes. [Elements of Agentic System Design](https://github.com/idyllic-labs/elements-of-agentic-system-design) maps ten behaviors people attribute to AI agents to the code that produces them. I wrote it while building an agent runtime because I needed to decide which capabilities the runtime should own and which ones applications should supply. ## Motivation That boundary kept moving. Memory could live in the runtime or in application storage. A planner could be a built-in primitive or another prompt. Tool execution could belong to the model harness, a plugin system, or the application itself. A feature list did not help because every feature could plausibly sit on either side. I started writing a book to force the decision. Each chapter needed working examples, and each example needed real code. If I could not explain a behavior without assigning it to a component, I had not found the boundary yet. I kept the book independent from [Idyllic](https://idylliclabs.com). The examples could use my runtime, but the explanations had to begin with language models and ordinary software. Otherwise I would have documented one framework instead of producing a map I could use to design it. ## Breaking down "intelligence" I started with a narrow description of a language model: it takes text and returns text. It does not retain your last message, know who you are, or affect anything outside its response. The surrounding program creates those behaviors. - An agent remembers your name because the program loads your name into the prompt. - It searches the web because the program parses its output, matches a tool name, runs a function, and sends the result back in another prompt. - It works overnight because a scheduler starts it and reconstructs its context from stored data. The model still reads text and writes text in every case. Storage, loops, schedulers, parsers, policies, and function calls turn those responses into a system. Most references organize that system by technique: retrieval, function calling, planning, caching, and multi-agent coordination. Those categories match libraries and papers. They do not match the problem a developer brings to a debugger. A developer says, "The agent forgot what I told it," or, "It keeps wandering off." So I worked backward from each observed behavior to the code that could have produced it. | "It seems to..." | The program actually... | | --- | --- | | Remember what I said | includes conversation history in the next prompt | | Have long-term memory | stores data and retrieves selected records into context | | Do things in the world | parses structured output and dispatches a function | | Think step by step | runs several model calls and passes state between them | | Plan before acting | asks for a plan, then executes each step | | Check its own work | runs a separate verification call and retries on failure | | Have multiple experts | routes work among prompts with different instructions | | Work while I sleep | starts from a timer or external event | | Learn from experience | stores outcomes and retrieves them during later work | When an agent forgets a fact, I can inspect the context assembled for that call and the storage and retrieval code that supplied it. I do not have to search a catalogue of techniques and guess which chapter contains the symptom. ## The ten elements The behavior-to-code pass produced ten elements: | # | Element | What it describes | Where I look in the code | | --- | --- | --- | --- | | 1 | Context | information available during one model call | token budget and context construction | | 2 | Memory | stored information retrieved into later contexts | storage and retrieval | | 3 | Agency | conversion of model output into effects | parser, policy, and execution boundary | | 4 | Reasoning | chains, loops, and branches across model calls | call structure and computation between calls | | 5 | Coordination | communication and sequencing between reasoning processes | execution flow and data flow | | 6 | Artifacts | shared persistent state | typed objects, operations, and lifecycle | | 7 | Autonomy | triggers and ownership of the main loop | schedulers, event handlers, and context reconstruction | | 8 | Evaluation | measurement of success | quality signals and scoring functions | | 9 | Feedback | signals that steer current work | signal sources and injection points | | 10 | Learning | feedback stored for future work | extraction, storage, and update pipeline | Each element had to point to a code address. If I could not say where a developer would implement or debug it, I left it out or folded it into another element. Consider a research agent that keeps reading material nobody requested. The complaint can come from four places: ``` Context The task description permits a broad search. Reasoning The loop never checks whether the current question still serves the task. Agency The search tool has no scope parameter, so the model cannot request a narrow search. Evaluation Nothing checks whether the agent used the documents it retrieved. ``` Those diagnoses lead to changes in different files. The map does not choose one without evidence. It gives me the four places to inspect before I spend a week rewriting the prompt. ## Agency Tool calling almost became an element because every model SDK presents it as a core capability. It only covers one path from model output to an application effect. A tool-calling API standardizes three parts: | Part | What the application does | | --- | --- | | Format | asks the model for structured output instead of parsing prose | | Vocabulary | gives the model a closed set of names and schemas | | Router | translates the selected name and arguments into a function call | The model only produces a string. `delete_all_records` remains inert until application code parses it, finds a registered function, checks the policy, and runs it. | Stage | Example | | --- | --- | | Model output | `{"tool": "delete_all_records"}` | | Application boundary | parse, look up, authorize, dispatch | | Effect | delete rows, write a file, or send an email | Application code creates agency in the middle row. The registry and policy also determine which strings can become effects. If the dispatch table has no deletion function, the model cannot delete anything through that path. That gives me three debugging questions when an agent takes a bad action: 1. Did the model select a bad action from the instructions and context it received? 2. Did the execution layer authorize an action it should have blocked? 3. Did I expose a capability or policy that made the outcome possible? The same classification covers plugin protocols and skills. A plugin protocol extends the functions available to the router. A skill loads procedural instructions into context. Both matter, but neither needs a new element because the ten elements already identify the code involved. ## Editing the map My first outline borrowed levels from science: philosophy, physics, chemistry, engineering, and applications. I removed that structure once the examples showed that it separated principles from the code that used them. I introduced each principle where it affected a design choice instead. The element list also changed as I built examples. I applied the code-address test to every edit: | Edit | Reason | | --- | --- | | Renamed proactivity to autonomy | Proactivity describes how the behavior feels. Autonomy identifies triggers and ownership of the main loop. | | Folded grounding into context | Grounding changes which facts the program places in the prompt. | | Folded planning into reasoning | Planning uses one particular arrangement of model calls. | | Renamed semantic objects to artifacts | The broader name covers any shared typed state used for coordination. | | Separated feedback from learning | Feedback changes current work. Learning stores a change for later work. | Two names collapsed when they led to the same code. One name split when it led to two different implementations. I generated more examples whenever a boundary remained unclear and watched for the same code appearing across them. ## Externalization Three elements move information out of one model call so another call can use it: ``` Memory stores context for one agent to retrieve later Artifacts store shared state that several agents can change Learning stores feedback that changes future behavior ``` They use the same broad operation and serve different consumers. Memory reconstructs what one agent should know. Artifacts coordinate work around a shared object. Learning changes how later work runs. Evaluation, feedback, and learning form another dependency: ``` Evaluation measures the result. Feedback uses that measurement to change the current task. Learning stores the change for future tasks. ``` A system can measure a bad result and continue unchanged. It can also repair the current task and repeat the same mistake tomorrow. Keeping the three elements separate tells me which connection the implementation lacks. ## Writing the book I gave every chapter the same four sections so a reader could apply each element in the same order: ```markdown ### Introduction ### Demystification ### Design Considerations ### The Reframe ``` The introduction names the behavior. Demystification traces it to code. Design Considerations covers the implementation choices. The Reframe converts a complaint about the agent into a change a developer can make. For context, the reframes look like this: ```markdown Before: "Why does the AI keep forgetting things?" After: "I need to load the relevant history into context on each call." Before: "The model is hallucinating." After: "I left out the facts needed to answer, so the model filled the gaps." Before: "The AI's personality is inconsistent." After: "The system prompt or reconstructed context changed between calls." ``` I wrote each reframe so the reader would know which code to open. ## Diagrams My first diagrams repeated the prose. I replaced them with diagrams that locate the component responsible for a behavior. The tool-calling diagram gives the parser and policy boundary more space than the model and tool because that code decides whether text causes an effect. The continuity diagram shows what the program stores between calls and what it reconstructs for the next one. The identity diagram holds the conversation history constant while it changes the model, then holds the model constant while it changes the history. The diagrams let me point at the component that caused the observed behavior. ## Context reconstruction I used conversation continuity to test the map. On every turn, the application assembles a new context from stored messages and other data. The model receives that context as text. It does not carry the previous call inside itself. This changes how I debug several common failures: - If an agent loses a fact, I check whether storage retained it and whether retrieval placed it in the next prompt. - If an agent contradicts an earlier answer, I compare the two contexts. - If its personality changes, I compare its instructions, retrieved history, and model configuration. I can also test where continuity comes from: ``` Keep the history and replace the model. The character mostly remains. Keep the model and replace the history. The character changes. ``` The application produces continuity by preserving state and reconstructing context. I can inspect both operations in the logs and compare the results across runs. ## Shipping the map The map targets people who build frameworks, languages, SDKs, and agent platforms. They decide where memory lives, who owns the execution loop, how tools cross the policy boundary, and which state agents share. [Building Effective Agents](https://www.anthropic.com/research/building-effective-agents), [12-Factor Agents](https://github.com/humanlayer/12-factor-agents), and [agentic design patterns](https://www.deeplearning.ai/the-batch/how-agents-can-improve-llm-performance/) teach construction patterns. Elements gives a developer a way to take an existing system apart: identify which elements it implements, find them in the repository, and see what is missing. I ship the framework as a [Claude Code](https://claude.com/claude-code) skill: ```markdown --- name: intelligence-designer description: Analyze and design agentic AI systems using the Elements of Agentic System Design framework. Use when asked to analyze an agent architecture, understand how an agentic system works, or design a new agent system. argument-hint: allowed-tools: Read, Grep, Glob, WebFetch --- ``` The skill receives four read-only tools. It can inspect a repository and apply the map, but it cannot change the code. That keeps analysis separate from implementation and lets a developer review the diagnosis before acting on it. ## Harness engineering I initially called the field agentic system design. A [LangChain post](https://blog.langchain.com/) led me to the term harness engineering, which HumanLayer and others were already using for the code around a model. I adopted the common term because it named the same work and saved readers from translating another private vocabulary. The ten elements still describe the decisions inside a harness. A model, a system prompt, and a tool list do not provide memory across sessions, autonomous execution, shared state, evaluation, or learning. Storage, schedulers, execution policies, context builders, and feedback pipelines provide them. I now use the elements to settle the boundary that started the project. When an agent appears to remember, plan, act, coordinate, or learn, I trace the behavior to one of those mechanisms, find the file that owns it, and decide whether it belongs in the runtime or in the application. --- ## OpenClaw: what changes when an agent stays running URL: https://www.wcdc.io/writing/openclaw-vs-cc Date: 2026-01-31 Description: How OpenClaw's always-running daemon produces memory, autonomy, and tool use, traced through its source. ![OpenClaw header](/assets/openclaw-header.png) [OpenClaw](https://github.com/openclaw/openclaw), previously called Moltbot and Clawdbot, runs an AI agent as a daemon on your computer. You talk to it through WhatsApp, Telegram, Discord, iMessage, Slack, or another connected channel. It can use the shell, browse the web, edit files, send messages, and start work on a schedule. [Peter Steinberger](https://x.com/steipete) created it. [Federico Viticci's review on MacStories](https://www.macstories.net/stories/clawdbot-showed-me-what-the-future-of-personal-ai-assistants-looks-like/) in January 2026 brought it a wide audience. Most of those capabilities already exist in [Claude Code](https://claude.com/claude-code). I wanted to understand why OpenClaw still felt like a different product to the people using it. The source code points to one architectural difference: OpenClaw stays running after the task ends. That changes who owns the work between model calls. The daemon keeps the files, transcripts, schedules, triggers, and message connections alive. A model call becomes one step inside a longer process instead of the whole process. I used the [ten elements of agentic system design](https://github.com/idyllic-labs/elements-of-agentic-system-design) to trace how OpenClaw builds that process and where the design remains thin. ## The difference | | Claude Code | OpenClaw | | --- | --- | --- | | Lifecycle | starts for a task, then exits | runs continuously as a daemon | | Persistence | organized around a session | keeps files and transcripts across restarts | | Interface | terminal | messaging apps and terminal | | Triggers | user starts the session | messages, cron jobs, webhooks, and heartbeats | | Installation | command-line program | LaunchAgent on macOS or systemd service on Linux | Suppose I think of an automation while walking: remind me to go to the gym at 2 p.m., check again at 5 p.m., and bother me if I still have not gone. Claude Code can write that program, but I still have to open a terminal, explain the task, create the script, install the schedule, decide where to store state, and inspect it when it fails. With OpenClaw, I can send the instruction from my phone. The running process already owns a scheduler, persistent workspace, conversation history, and return channel. The agent can turn the request into a scheduled job and message me later through the same conversation. That smaller setup cost changes how people use it. An automation no longer needs to justify a small software project. Users can accumulate reminders, monitors, summaries, and recurring checks until the daemon functions like a personal server with a conversational interface. ## The daemon The daemon gives OpenClaw one control plane for work that would otherwise end up scattered across cron scripts, [Zapier](https://zapier.com), [n8n](https://n8n.io), [Make](https://www.make.com), and one-off programs. Its workspace exposes the state as ordinary files under `~/.openclaw/`, so a user can inspect and edit the same material the agent uses. The process also reconnects each new model call to earlier work. When a message arrives, OpenClaw: 1. loads its system prompt, identity files, history, and relevant memory; 2. calls the model; 3. runs any requested tools and returns their results to the model; 4. sends the final response back through the originating channel; 5. appends the exchange to the session transcript. The model still handles one context window at a time. The daemon creates continuity by rebuilding that window from persistent state. ## Context OpenClaw assembles the system prompt from files in the workspace: ```text ~/.openclaw/workspace/ ├── SOUL.md personality and tone ├── USER.md information about the user ├── AGENTS.md operating instructions ├── TOOLS.md tool guidance ├── HEARTBEAT.md periodic checks ├── MEMORY.md curated long-term notes └── memory/ ├── 2026-01-28.md daily log ├── 2026-01-29.md └── ... ``` The prompt builder loads these files as separate context fragments. If it finds `SOUL.md`, it tells the model to follow that persona and tone. `USER.md` supplies personal facts, while `AGENTS.md` and `TOOLS.md` tell the agent how to work. Here's the code that loads context files (`src/agents/system-prompt.ts`): ```typescript const contextFiles = params.contextFiles ?? []; if (contextFiles.length > 0) { const hasSoulFile = contextFiles.some((file) => { const normalizedPath = file.path.trim().replace(/\\/g, "/"); const baseName = normalizedPath.split("/").pop() ?? normalizedPath; return baseName.toLowerCase() === "soul.md"; }); lines.push("# Project Context", "", "The following project context files have been loaded:"); if (hasSoulFile) { lines.push( "If SOUL.md is present, embody its persona and tone. Avoid stiff, generic replies; follow its guidance unless higher-priority instructions override it.", ); } lines.push(""); for (const file of contextFiles) { lines.push(`## ${file.path}`, "", file.content, ""); } } ``` A user can open and edit the files that define the agent's identity. A different `SOUL.md` produces different behavior because the next model call receives different instructions. The personality does not live inside the daemon or the model. It comes from files the daemon loads on every run. OpenClaw also writes important context to disk before a conversation reaches its limit. By default, the memory flush runs 4,000 tokens before compaction. The model receives an instruction to save useful details, and later calls can retrieve those details after the original messages have left the window. The check (`src/auto-reply/reply/memory-flush.ts`): ```typescript export function shouldRunMemoryFlush(params: { entry?: Pick; contextWindowTokens: number; reserveTokensFloor: number; softThresholdTokens: number; }): boolean { const totalTokens = params.entry?.totalTokens; if (!totalTokens || totalTokens <= 0) return false; const contextWindow = Math.max(1, Math.floor(params.contextWindowTokens)); const reserveTokens = Math.max(0, Math.floor(params.reserveTokensFloor)); const softThreshold = Math.max(0, Math.floor(params.softThresholdTokens)); const threshold = Math.max(0, contextWindow - reserveTokens - softThreshold); if (threshold <= 0) return false; if (totalTokens < threshold) return false; const compactionCount = params.entry?.compactionCount ?? 0; const lastFlushAt = params.entry?.memoryFlushCompactionCount; if (typeof lastFlushAt === "number" && lastFlushAt === compactionCount) { return false; } return true; } ``` ## Memory The filesystem remains the source of truth. OpenClaw stores curated facts in `MEMORY.md`, appends daily notes under `memory/`, and writes complete session transcripts as JSONL: ```text ~/.openclaw/agents//sessions/.jsonl ``` A SQLite index with [`sqlite-vec`](https://github.com/asg017/sqlite-vec) makes the Markdown files searchable. OpenClaw combines vector similarity with [BM25](https://en.wikipedia.org/wiki/Okapi_BM25) keyword scores, then returns the highest-ranked passages to the context builder. A saved fact does not automatically enter the next context. Retrieval still has to select it. When the agent appears to forget something, I would inspect two steps: whether OpenClaw stored the fact, and whether the next run retrieved it. ## Agency OpenClaw gives the agent several ways to affect the computer around it: - shell commands with PTY support; - browser control through a dedicated Chromium instance; - messaging through connected channels; - HTML, CSS, and JavaScript served through [Canvas](https://docs.openclaw.ai/platforms); - device capabilities from connected phones and laptops; - cron jobs, webhooks, and sub-agent sessions. A model response cannot perform any of those actions by itself. OpenClaw parses the requested tool call, checks the available tools and policy, and dispatches application code. That execution boundary determines what the agent can do. OpenClaw controls the boundary at three levels: 1. The sandbox decides where a tool runs. The main session runs on the host by default, while group chats can run inside [Docker](https://www.docker.com). 2. Per-agent allow and deny lists decide which tools a session can call. 3. Elevated approvals provide an escape hatch for commands that need more access. The registry defines capability, and the policy defines permission. Removing a destructive tool closes that path even if the model requests it. Allowing the tool on the host gives a prompt the same practical reach as the user account running OpenClaw. ## The loop OpenClaw uses a conventional agent loop. It assembles context, calls the model, executes a requested tool, adds the result to context, and calls the model again. The loop ends when the model returns a final response. The core runner also handles queueing, authentication, model selection, context limits, and failover. It does not impose a separate planning stage or a generate-then-evaluate pipeline. The model chooses the next action from the current context, observes the result, and chooses again. For larger tasks, a parent session can start a child with `sessions_spawn`. The child receives its own context and transcript, completes the assignment, and reports the result to the parent. `sessions_send` lets sessions exchange messages directly. OpenClaw stops the tree at one level. A child session cannot spawn another child: ```typescript if (typeof requesterSessionKey === "string" && isSubagentSessionKey(requesterSessionKey)) { return jsonResult({ status: "forbidden", error: "sessions_spawn is not allowed from sub-agent sessions", }); } ``` That limit prevents recursive agent growth. Agents can still coordinate through shared workspace files, which also serve as persistent artifacts after a session ends. ## Autonomy The daemon can begin work without an active conversation. OpenClaw exposes four mechanisms for that. **Cron** runs a task at a precise time. A job can reuse the main session or start in an isolated session: ```json { "id": "daily-standup", "schedule": "0 9 * * 1-5", "task": "Check my calendar and Slack for today's priorities", "session": "isolated" } ``` **Webhooks** let GitHub, Zapier, home automation, and other external systems start a run. **Heartbeat** wakes the main session every 30 minutes by default. The agent reads `HEARTBEAT.md`, checks the current context, and returns `HEARTBEAT_OK` without sending a message when nothing needs attention. Cron executes a known task at a known time. Heartbeat asks the agent to inspect the situation and decide whether to act. **[Lobster](https://github.com/openclaw/openclaw/tree/main/extensions/lobster)** handles workflows that need deterministic steps, approval gates, and resumable state. It stores those pipelines as `.lobster` files instead of asking the model to improvise the entire sequence on every run. These triggers produce the practical difference from a terminal session. A user can leave, close the laptop, or stop thinking about the task while the process retains responsibility for starting it again. ## Evaluation OpenClaw invests much less in evaluation, feedback, and learning than it does in context, memory, agency, and autonomy. The built-in evaluation layer tracks tokens and cost and includes [Vitest](https://vitest.dev) suites for the software itself. It does not provide an LLM judge, prompt experiments, or automatic quality metrics. For a personal assistant, the user sees the output and supplies most of the evaluation. Feedback follows the same pattern. A user corrects the agent in conversation, and the agent can write the preference into `MEMORY.md`. A later memory search may load that preference into context. OpenClaw does not maintain a central response-quality dataset or optimize against one. The agent can also edit `SOUL.md`, `AGENTS.md`, and the other files that shape later prompts. That gives it a form of persistent self-modification. It changes instructions and memory on disk; it does not tune model weights or automatically prove that the change improved future work. OpenClaw can preserve a correction and reuse it. The user still has to judge the result, and the system has no strong built-in loop for measuring whether the stored correction helped. ## Permissions Persistence and broad tool access increase the cost of a bad instruction. A short-lived coding session ends when I close it. OpenClaw keeps listening, retains credentials and context, and can act later through schedules or incoming messages. The main risks follow directly from those capabilities: - host shell access exposes local files and processes; - content from the web, email, or chat can carry prompt injections; - local configuration files may contain credentials; - stored instructions can trigger harmful behavior later; - messaging and webhooks give the agent channels for sending data out. [Vectra applies](https://www.vectra.ai/blog/clawdbot-to-moltbot-to-openclaw-when-automation-becomes-a-digital-backdoor) [Simon Willison's](https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/) "lethal trifecta" to this combination: private data, untrusted input, and external communication. OpenClaw contains sandbox, tool-policy, and approval controls, but the main session runs on the host by default because local access supplies much of the product's value. Every new tool or trigger widens the paths from text to effects. A secure installation therefore depends on concrete configuration: which sessions run in containers, which tools each channel can use, which actions require approval, and which credentials the process can read. ## Deployment OpenClaw can run locally as a LaunchAgent on macOS or a systemd service on Linux. That gives it direct access to the user's machine and keeps the workspace under the user's control. Cloudflare also publishes the [moltworker](https://github.com/cloudflare/moltworker) reference deployment. It combines Workers, the Sandbox SDK, R2 storage, Browser Rendering, and AI Gateway. The Workers paid plan starts around $5 per month, with model and service usage charged separately. The deployment choice changes the security boundary. A local daemon can reach the user's files and applications. A hosted version trades some of that reach for a container and network boundary that the operator can configure separately. ## The ten elements The full decomposition shows where OpenClaw concentrates its engineering: | Element | OpenClaw implementation | | --- | --- | | Context | identity files, session history, memory retrieval | | Memory | Markdown files, JSONL transcripts, SQLite vector and keyword search | | Agency | shell, browser, messaging, devices, cron, and webhooks | | Reasoning | iterative model and tool loop | | Coordination | parent and child sessions with one delegation level | | Artifacts | workspace files, Canvas output, and transcripts | | Autonomy | cron, webhooks, heartbeat, and Lobster workflows | | Evaluation | token and cost tracking, plus software tests | | Feedback | corrections written into memory files | | Learning | later prompts changed through memory and identity-file edits | Context, memory, agency, and autonomy explain most of the excitement. OpenClaw keeps a model connected to the same state, tools, triggers, and return channels for weeks instead of reconstructing that setup as a new project every time. Evaluation and learning remain mostly manual. Permissions require careful configuration because the daemon combines long-lived context with access to private data and external systems. OpenClaw uses familiar models, tools, files, and schedulers. Keeping them together inside one running process removes enough setup work that small automations become worth creating. That is why it feels different from opening Claude Code, even when Claude Code could perform the same individual action. --- ## State Space Explosion URL: https://www.wcdc.io/writing/state-space-explosion Date: 2026-01-31 Description: When AI generates more options than you can evaluate. There's a feeling I've had trouble naming. You open Claude to solve a specific problem. Thirty minutes later, you're looking at five different approaches, each with three variants, each variant raising two new questions. The original problem is buried somewhere. Your mind is racing. It feels like suffocation, a dire need to collapse the superposition. I've started calling this **state space explosion**: the combinatorial unease that builds when AI expands possibilities faster than you can prune them. ## The Phenomenon 1. You start with a forcing function: curiosity about a specific problem, a question you want answered 2. AI responds with branching possibilities ("Here are five approaches...") 3. Each branch spawns sub-branches ("For approach 2, you could either...") 4. Your working memory fills with options you can't evaluate 5. The original forcing function gets buried under the load 6. You're now "exploring" without anchor The issue is structural: AI generates options faster than human working memory can evaluate them. Your brain holds roughly 7 items in working memory. Evaluating 20 options against each other is O(n²), meaning 190 pairwise comparisons on hardware limited to 7 slots. ## The Corrupted EV Sensor Normally you run an implicit expected value calculation on possible actions: some weighted function of reward, probability, effort, and time. You don't consciously compute this. You just *feel* which paths seem promising. AI interferes by generating options whose value you can't estimate. You can see twenty options but you have no experiential data on any of them. The paths are visible but unweighted. When enough options are unpriced, your decision process degrades. You're looking at a list with no way to rank it. ## The Depth-First Trap AI tends to go depth-first when exploring solutions. It picks one approach and dives deep before you've had a chance to survey the landscape. This makes state space explosion worse. The trap: you typically want breadth-first pruning before going deep. Survey the options, eliminate the obvious non-starters, then commit to exploring one path. But AI's default interview style pulls you into the weeds of option #1 before you've even seen options #2 through #5. This triggers scarcity processing: "I must search all paths or miss the best one." Wrong algorithm for an abundance problem. When options were scarce, exhaustive search was correct. But AI creates abundance. There are always more approaches, more variants, more frameworks. The reframe: you're not searching for the optimal path. You're looking for *a path that works*. There are many. If the first one fails, there are others. ## The Cybernetic Frame I like looking at this from a cybernetic third-person view: human as information agent, AI as compute amplifier. What's happening information-theoretically? The failure mode of "using AI incorrectly" is usually invisible. You don't know what you don't know. But state space size gives you a visible heuristic. If your possibility space is exploding and you can't collapse it, something is wrong with the interaction pattern. This isn't about what the AI knows. It's about what *you* know. The state space exists in your head, not the model's. The model can generate infinite branches. Your working memory cannot hold them. ## What's Helped Me ### Backwards Chaining Before engaging with AI-generated options, establish what you actually want, even provisionally. The goal doesn't have to be final, but it has to be clear enough to evaluate candidates against. Then backwards chain: What leads to that goal? What leads to that? Find the nearest node to your current position that's on the chain. Ignore everything else. The goal functions as a query. Queries enable filtering. Without a query, you just accumulate options. ### Breadth-First Pruning Resist the depth-first pull. Before diving into any single approach, force a survey: "What are all the major approaches? Don't elaborate, just list them." Then prune. Eliminate the obvious non-starters. *Then* go deep on one. Quick heuristics for pruning: cluster the options, filter by gut sense of which feel central to the problem, pick the top three and do a quick sanity check on each. A biased filter that moves is better than a perfect filter that's still loading. ### Graduating to Management This is a confession: I've been slow to adopt multi-agent thinking. Stuck in the midwit trap where I feel like I need to micromanage the AI, verify every step, maintain control over the microstates. But this doesn't scale. A manager doesn't care about microstates. A manager samples the macrostate, performs verification at checkpoints, and trusts the execution layer to handle details. We select managers who know how to do the job themselves because they might need to enter kernel mode to debug. But they don't live in kernel mode. The pattern: let AI explore the state space while you verify. Generation can be noisy if verification is cheap. AI can generate twenty approaches, most of them mediocre, as long as you have a way to identify the good ones. This is hard if you're technically sophisticated. You *know* how to do the thing, so delegating feels like loss of control. But when exploration is cheap, the leverage is in specifying what "good" looks like, not in doing the exploration yourself. ## Parsing the Unease When I feel that suffocating dread working with AI, I label it: state space explosion. Treating it as a structural problem rather than a personal failing changes how I respond. Then I ask: - **Do I have a query?** If not, define at least a provisional goal. - **Am I being pulled depth-first?** If so, force a breadth-first survey before committing. - **Am I micromanaging?** If so, step back to the manager seat. Specify verification criteria. Let the AI generate candidates. The computational frame helps because it re-expresses "I'm overwhelmed" as "O(n²) comparisons on 7-slot hardware." Working memory capacity is fixed. The algorithm isn't. --- *State space explosion is the combinatorial unease that builds when AI expands possibilities faster than you can prune them. The failure mode is usually invisible, but state space size makes it visible. The response isn't to evaluate faster. It's to install queries that filter, force breadth-first pruning before depth, and graduate from micromanager to manager.* --- ## Intelligence design: treating architecture as the source of behavior URL: https://www.wcdc.io/writing/intelligence-design Date: 2026-01-30 Description: The design questions I kept encountering across AI projects. Intelligence design is the name I use for designing the software around a language model: the program that assembles its context, carries state between calls, exposes operations, and decides whether a result is good enough to keep. The term came out of several projects that had started with different questions. Semantic objects asked what an agent should be able to manipulate. A visual grammar tried to show how information moved through a model workflow. XJSN gave agents a restricted language for expressing programs. Coding agents showed what changed when a model could work against durable files and external tests. In parallel, I was describing human behavior in terms of state, costs, signals, and transitions. Each project moved some part of intelligent behavior out of the model and into an explicit mechanism. A model call has no memory of the previous call, no durable state, no authority outside the text it returns, and no independent way to know whether its work succeeded. The surrounding program supplies those properties. The hard part was recognizing that this program was the thing I had been designing all along. The prompt was one input to it. ## Start with a stateless call, not a personality A language model receives a sequence of tokens and samples a continuation. Everything that makes the interaction feel continuous is constructed outside that operation. If an agent remembers a name from last week, the name was stored somewhere and a retrieval policy selected it for the current call. If it sends an email, application code recognized an operation in the output, checked that the operation was allowed, and passed it to an email service. If it works overnight, a scheduler started the run and reconstructed enough state for the next call to continue. Treating the model as the whole agent hides those mechanisms behind one personality. Treating it as a stateless component gives each behavior an address in the program and a place where it can be inspected or changed. The model still performs work that ordinary code cannot perform economically. It interprets ambiguous language, makes local judgments, proposes plans, and generates artifacts. But the architecture decides what it is judging, which options it may choose, and whether the result becomes real. This changed how I thought about prompts. A prompt is rarely one authored string. It is the final serialization of instructions, retrieved material, current state, tool descriptions, prior results, and an output contract. Context engineering names the work more accurately because the important decision is what the call gets to see. A carefully phrased instruction cannot recover a missing document, repair contradictory state, or remove an operation the model should never have been offered. Those are system decisions, and they have to be made before the model samples anything. ## Frameworks gave me answers before I had the questions My first attempts at LLM applications were built the way most were: write a prompt, run examples, adjust a phrase, and repeat. The method was adequate for finding a prompt that worked often enough in one situation. It gave me very little language for explaining why it worked or predicting what would survive when the situation changed. The common fixes were all local. Add a role. Add examples. Ask for step-by-step reasoning. Lower the temperature. Change the order of the instructions. Each could alter the output, but none supplied a stable unit of design. The next task started the search again. Frameworks promised to move the work up one level. LangChain supplied chains, agents, tools, and memory. LangGraph made the workflow a graph. DSPy treated prompt selection as an optimization problem. I built with each because I wanted the missing abstractions to already exist. Each abstraction was useful in its intended case, but it combined decisions I needed to vary independently. A `Memory` object usually included at least three policies: what to store, how to retrieve it, and how retrieved material enters the next call. Changing one often meant replacing the abstraction. A graph provided nodes and edges, but it did not answer what deserved a node, which information crossed an edge, or who owned the state between them. An optimizer could improve a metric only after I had found a metric that represented the failures I cared about. The API made one author's answers convenient without establishing that the underlying boundary belonged in every system. That distinction matters because an arbitrary boundary becomes expensive only after the system grows around it. If retrieval and context injection are one component, adding a second context strategy requires a fork. If control flow and data flow share one kind of edge, a diagram can show that two nodes are connected without saying what moves between them. If an agent owns both decision-making and state mutation, it becomes difficult to replay the decision without repeating the mutation. I stopped asking which framework had the right objects and started asking what each object would have to mean. That led to semantic objects. ## Give the agent objects, not a bag of verbs The standard tool-centric question is, "What can the agent do?" The answer becomes a list of functions: `read_file`, `write_file`, `search`, `run_tests`, `send_email`. I changed the question to, "What can the agent manipulate?" A code assistant manipulates a `Codebase` and a `TestSuite`. A writing system manipulates a `Document`, its sections, and its annotations. A research system manipulates sources, claims, and a report. The operations belong to those objects rather than floating in one registry. ```typescript // Tool-centric const agent = new Agent({ prompt: "You are a code assistant...", tools: [readFile, writeFile, search, runTests] }) // Object-centric const agent = new Agent({ prompt: "You are a code assistant...", objects: [codebase, testSuite] }) ``` The second version does not remove tools. It changes their scope. The `codebase` exposes `.getModule()`, `.getFunction()`, and `.updateImplementation()`. The `testSuite` exposes `.run()` and `.getFailures()`. File reads and command execution still happen underneath, but they are implementation details of operations named in the domain. The interface also defines the level at which the agent can act. With `read_file` and `write_file`, the agent manipulates paths and bytes. With a `Document`, it can manipulate a section while preserving the rest of the document. With a `Codebase`, an update operation can parse the replacement, run the type checker, and reject a change that breaks callers before committing it. The object also constrains what exists from the agent's point of view. If the only write operation is `document.replaceSection(id, content)`, deleting an unrelated database is outside the language of the interface. A prompt can tell an agent not to call a dangerous function. An object can decline to expose the function at all. Text remains the medium crossing the model boundary, but it stops being the system's only representation. A section reference can be serialized into context, selected by the model, resolved by the runtime, and applied to the actual document object. The model holds a handle; the data and invariants stay behind it. The design immediately produced another problem. Where do these objects live? An object reconstructed from a tool result on every call is still stateless. Agents need an environment that owns object identity, storage, relationships, and lifecycle. The environment is what lets a result from one operation become an object another operation can use without pasting the entire value back through the model. Semantic objects therefore changed two boundaries at once. They moved tools onto the things they affect, and they moved persistence out of the transcript into a workspace the runtime controls. ## Tool calling hides the state transition Tool calling is usually presented as one primitive. The model emits a function name and arguments, the application executes it, and the result is appended to the conversation. There are two operations inside that sequence. The first is a decision: given the current state, the model chooses to search, calculate, update, or ask. The second is a state transition: the runtime decides where the result goes and what later steps are allowed to see. A search result makes the difference concrete. The same search can be handled in several ways: - paste all results into the next model call - store them as a research artifact and pass only a handle - extract citations and discard the rest - update an index without returning anything to the model - ask another component to rank them before continuing Each version begins with the same decision to search and produces a different information flow through the rest of the system. Collapsing both into "tool calling" makes the system hard to inspect. When a run fails, the query may have been poor, the search may have returned poor results, the runtime may have injected too much of them, or the result may have been written into the wrong artifact. Those failures belong to different parts of the architecture and need different fixes. It also makes composition expensive. A tool whose return value always becomes chat history cannot be reused inside a workflow that needs the result stored, filtered, or routed elsewhere. The transport convention has become part of the operation without being named in its interface. Separating decision from state transition gave me a cleaner model. The model proposes an operation. The runtime interprets that operation against the current objects and applies an explicit transition. The result may become context for another call, but that is a separate decision rather than the automatic meaning of a tool response. ## Drawing the system exposed what the code had left implicit I tried to represent these systems visually because logs showed events in time without showing why information moved where it did. I wanted to see the context assembled for each call, which artifacts were read or changed, where a model made a decision, and where deterministic code took over. The diagrams were useful immediately. A redundant retrieval appeared as two arrows carrying the same material. A loop that looked reasonable in code showed that the model was rereading an unchanged context. A box called "agent" expanded into retrieval, one model call, a parser, and a write to state. The visual grammar also forced premature decisions. Every box type asserted that several operations belonged together. Every edge type asserted what counted as flow. Some concepts that were easy to draw were awkward to execute, while ordinary code paths produced diagrams full of exceptions. I kept visualization as a way to inspect a design and stopped treating the diagram as the executable definition. A diagram can make causal structure visible. It cannot enforce a state boundary or type-check an artifact unless those concepts already exist in code. That was the point at which code became the final representation rather than one implementation of a higher-level picture. The remaining question was how much code an agent should be allowed to generate. ## Use familiar syntax without granting arbitrary semantics Coding is expressive because a short program can hold a sequence of decisions and deterministic operations. Tool calling loses that advantage when every step requires another model turn. Arbitrary generated code preserves the expressivity and creates a much larger verification problem. XJSN was my attempt to keep the useful middle. The source looks like JavaScript function calls: ```javascript Pipeline([ Filter({ status: "active" }), Map({ extract: ["id", "name", "email"] }), GroupBy({ field: "department" }), Aggregate({ count: Count(), averageAge: Average("age") }) ]) ``` Models already generate this syntax fluently because JavaScript is common in their training data. XJSN does not execute the result as JavaScript. It parses the text into an abstract syntax tree, validates that tree against a grammar, and sends the accepted nodes to a custom interpreter. ```typescript const grammar = { Pipeline: { children: ["Filter", "Map", "GroupBy", "Aggregate"] }, Filter: { args: { status: "string" } }, Map: { args: { extract: "string[]" } } } const output = await agent.generate("Transform this data") const ast = parse(output) const errors = validate(ast, grammar) if (errors.length) return retryWith(errors) return interpret(ast, data) ``` The grammar is the security and composition boundary. It decides which node types exist, which arguments they accept, and which operations may contain others. The model can emit `DeleteEverything()`, but the parser has no valid node to construct from it and the interpreter never sees it. This is different from sandboxing arbitrary code. A sandbox limits what a program can damage after the system accepts it as a program. A domain language decides which programs belong to the product in the first place. The two mechanisms can be used together, but they protect different boundaries. The AST also separates the notation from the execution model. JavaScript-shaped syntax helps generation. The runtime is free to make `Filter` a database query, a stream operation, or a call into a remote service. Familiar syntax does not require JavaScript semantics. The design becomes more valuable when the grammar belongs to a domain. A compliance team can define audits, evidence requests, escalation rules, and retention operations. A publishing system can define sections, citations, review passes, and approvals. Domain experts extend the system by defining valid objects and transitions rather than by writing longer instructions about how a general agent should behave. I did not finish XJSN as a general platform. The useful result was the boundary it exposed: an agent needs a language expressive enough to state a plan, while the runtime needs a grammar narrow enough to validate and interpret that plan. ## Coding agents supplied the working example Coding agents made the architecture concrete because software development already contains most of the primitives an agent system needs. A repository gives artifacts stable names. Files provide persistent state. Git records changes and makes them reversible. The shell supplies a composable effect surface. Compilers, linters, and tests evaluate work without asking the model whether it succeeded. Error messages return structured evidence to the next attempt. The model is important inside that environment, but the environment explains the continuity. A coding agent reads the repository, selects relevant files, writes a patch, runs a command, receives the failure, and tries again. The model call changes each time because the harness changes its context. Draft-run-revise loops work because the second attempt is conditioned on evidence produced by executing the first. Repeating the same prompt would sample another answer. Running the code turns the first answer into information the next call can use. The verifier matters as much as the loop. A model reviewing its own patch may catch a mistake, but it is still another model judgment. A type error or failed test identifies a property outside the model's opinion. The harness can attach that evidence to the next call and stop only when the external condition passes. This explains why coding agents were more capable than many domain agents built from the same models. The coding environment already had addressable objects, durable artifacts, powerful operations, and cheap verification. A generic customer-support or research agent usually received a prompt, a flat tool list, and a transcript. The missing capability was often in the environment rather than the model. Other domains need equivalents of the filesystem, type checker, test suite, and patch. A writing agent needs sections it can address and editorial checks it can run. A research agent needs claims tied to sources and a ledger of what has been searched. A financial agent needs typed transactions, permissions, and reconciliation. Once those exist, the model has a world it can act inside rather than a collection of functions it can ask the application to call. ## Name the design decisions that repeat While building these systems, I was also writing the [Mechanistic Mindset](/writing/mechanistic-mindset) wiki, which describes behavior through computational mechanisms. Instead of treating procrastination as a character judgment, the useful questions concern activation cost, expected reward, uncertainty, and the state transition required to begin. That practice made the connection difficult to ignore. If intelligent behavior can be described in terms of inputs, state, operations, and feedback, then designing an agent is a software-design problem before it is a personality-design problem. I used that frame while writing [Elements of Agentic System Design](https://github.com/idyllic-labs/elements-of-agentic-system-design). The goal was to identify the decisions present across coding agents, research systems, personal automations, and multi-agent workflows without organizing them around one framework's API. Ten elements covered the systems I had built: | Element | The decision it names | Conventional software analogue | | --- | --- | --- | | **Context** | What information is assembled for a call | inputs and representation | | **Memory** | What persists across calls | data structures and storage | | **Agency** | Which effects the system can produce | I/O and side effects | | **Reasoning** | How model calls are arranged | control flow and algorithms | | **Coordination** | How components exchange work | protocols and distributed systems | | **Artifacts** | Which outputs persist and evolve | data models and versioning | | **Autonomy** | What triggers computation | events and scheduling | | **Evaluation** | How success is measured | tests and observability | | **Feedback** | Which signals return to the process | errors, traces, and monitoring | | **Learning** | How later behavior changes | updated policies, data, or parameters | The list is useful because each element points to code. "The agent forgot" becomes a question about what was stored, what retrieval selected, and what fit into context. "The agent took the wrong action" becomes a question about the decision policy, the available operations, and the permission boundary. "The agent never improves" becomes a question about which evaluation result is written back into future behavior. The elements also expose defaults. Every system has a memory design even when the answer is "keep the transcript until the window fills." Every system has an evaluation design even when the answer is "accept whatever the model returned." Leaving an element unnamed does not remove it; it lets an accidental implementation decide it. This was the point at which I started calling the work intelligence design. The term names the whole program that produces intelligent behavior, not a new technique layered on top of prompt engineering. ## Reliability comes from deciding what may remain probabilistic A model will sometimes misunderstand an instruction, choose a poor plan, or produce an invalid artifact. The architecture cannot remove sampling from the model, but it can decide which properties are allowed to depend on it. Structure is the easy part to move out. Structured outputs can require fields, types, and valid enum values. A parser can reject an invalid XJSN program. An object method can refuse a state transition that violates its preconditions. None of those establishes that the content is correct. Semantic reliability needs a verifier matched to the claim. - Code can be compiled and tested. - A citation can be checked against the source it names. - A transaction can be checked against permissions and balances. - A document can be checked for required sections and unsupported claims. - A plan can be simulated against a bounded model of the environment. The model may participate in verification when judgment is unavoidable, but the distinction should remain visible. A model critic is another probabilistic operation. A compiler error is deterministic evidence. They belong in different parts of the acceptance rule. The loop also needs state. A real retry carries the failed artifact, the verifier's result, and the attempts already made. Calling the model again with the original request is a reroll. Feeding back the failure turns the sequence into directed search. The termination path is part of the same design. After repeated failure, the system can narrow the operation, preserve a partial artifact, request a decision, or stop. "Keep trying" is not autonomy; it is a missing stopping condition. This is how a system can become dependable around a component that remains fallible. Contracts, checks, and fallbacks do not make the model reliable in isolation. They prevent particular model failures from becoming accepted system behavior. ## Productization means choosing a user mode Coding agents usually run with a wide interface to the machine. They can traverse the filesystem, execute commands, use credentials, install packages, and change whatever their process can reach. I think of this as kernel mode. It is effective because the agent can construct a new operation whenever the existing tools are insufficient. The same freedom is difficult to ship as a product boundary. A user needs to know which information the system can read, which effects it can cause, and what can be reversed. Restricting the prompt does not answer those questions because the underlying operations remain available. The product version needs a user mode: a smaller world whose objects and operations correspond to the domain. Semantic objects provide one half. A reporting product can expose a `Report`, `Dataset`, and `CitationStore` without exposing the server's filesystem. Each object owns its state and can validate operations before committing them. The agent remains capable inside the world the product defines. Constrained languages provide the other half. Instead of generating arbitrary Python to transform data, the agent generates a program from the transformations the product supports. Instead of issuing one tool call, reading the result, and deciding again, it can state a short validated program that the runtime executes deterministically. The combination changes the role of permissions. Permission is no longer a warning attached to a general capability. It becomes a property of an operation on a particular object. `report.publish()` can require approval while `report.addAnnotation()` does not. An audit grammar can admit `Escalate` and exclude deletion entirely. This is also where domain-specific systems gain an advantage over a general coding agent. They give up arbitrary computation and receive stronger guarantees, clearer interfaces, better inspection, and operations named at the level their users care about. Every object type and grammar rule removes some programs from the product's expressible set. A domain model built too early will reproduce the same problem I had with agent frameworks: local intuitions hardened into APIs. The way out is to derive the interface from working operations, keep the underlying artifacts accessible, and make extensions add explicit types rather than prompt conventions. ## Build the reusable layer below the application The recurring mechanisms sit below categories such as coding agent, writing agent, or research agent. Those applications need different domain objects, but they reuse context construction, artifact versioning, permission checks, retry state, evaluation, and scheduling. That suggests a horizontal architecture: - context builders select and serialize information for one call - artifact stores preserve identity and history - object interfaces expose bounded domain operations - interpreters execute validated plans - evaluators return evidence for acceptance or revision - schedulers resume work from durable state A vertical application supplies the domain vocabulary and assembles these pieces. A research product defines sources, claims, and reports. A coding product defines repositories, patches, and tests. The runtime does not need to pretend those objects are the same in order to reuse the machinery beneath them. This is why I prefer theory over framework-specific recipes. Frameworks are implementations of state ownership, control flow, representation, and failure recovery. Distributed-systems design, programming-language theory, and state machines make those choices visible. Learning only the framework teaches its current answers. The architecture should make it possible to replace an answer without replacing the system. Context retrieval can change without changing artifact identity. A new evaluator can be inserted without rewriting the operation it checks. An object can move from local files to a database without changing the language the agent uses to manipulate it. Those separations are what let improvements in one application become reusable infrastructure for the next. ## Where the intelligence lives The term intelligence design is useful only if it changes what gets built. When a system fails, I no longer begin by rewriting the prompt. I ask which information the model received, which state it believed it was changing, which operations were available, what evidence the runtime collected, and why the loop accepted the result. The answer usually points to a component with an interface and a test. Model capability still sets important limits. A stronger model can make better local judgments, follow a grammar more consistently, and recover from more complicated feedback. But those gains enter through a call whose context, authority, and acceptance conditions are designed elsewhere. The system's behavior has always been determined by code. Intelligence design is the practice of treating that code as the primary artifact: the context machine around the call, the object system behind the tools, the state transitions inside the loop, and the verifier that decides when the work is done. --- ## Prose is free now URL: https://www.wcdc.io/writing/substantives Date: 2026-01-30 Description: Designing articles around material a reader can reuse. AI can generate fluent, grammatical, well-structured text on any topic. The marginal cost of generating 2,000 words of coherent AI-generated text is negligible. As a16z puts it: the marginal cost of creation is approaching zero. This changes which parts of content creation are scarce and valuable: {/* SUBSTANTIVE: reframe table */} | Era | Scarce | Abundant | Value lives in | |---------|-------------------------|-------------------------|---------------------------| | Pre-AI | Prose | Ideas, facts, artifacts | The writing itself | | Post-AI | Ideas, facts, artifacts | Prose | What the prose carries | Prose is the medium, and the value lies in specific elements the reader can extract and use. I call those elements **substantives**. --- ## Substantives {/* SUBSTANTIVE: definition */} A substantive is a discrete, reusable unit of content that carries standalone value for the reader. Examples include definitions, checklists, code samples, and diagrams that can be reused or referenced without the surrounding explanation. {/* SUBSTANTIVE: the extraction test */} **The extraction test:** Assume a reader skims your piece in 30 seconds and extracts 3-5 things to save or share. Identify what they would extract. - A checklist: extractable, substantive - A screenshot: extractable, substantive - A paragraph of explanation: usually not, tissue - A definition: extractable, substantive - A transition sentence: not extractable, tissue Pieces built only from connective prose are harder to reuse or reference later. --- ## Why This Matters Now Readers quickly filter out low-value content. The backlash is real: "AI slop" entered the lexicon, and mentions increased ninefold in 2025. Platforms are responding: YouTube stopped paying for AI slop, and Pinterest added filters to hide AI content. Readers ignore writing that shows these patterns: - Generic claims without specific evidence - Fluent prose without anchoring details - Structure without substance Many AI-generated listicles, self-described comprehensive guides that say nothing, and posts with interchangeable advice contain no specific, reusable elements. --- ## The Taxonomy {/* SUBSTANTIVE: taxonomy table */} Substantives can be grouped by what the reader gains from them: | Category | Reader gets | Examples | |-----------------|------------------------|---------------------------------------------------------------| | **Utility** | Something to use | Code snippet, checklist, template, prompt, procedure | | **Knowledge** | Something to know | Definition, taxonomy, framework, distinction | | **Proof** | Reason to believe | Screenshot, benchmark, citation, timestamp, specific name | | **Perspective** | New way of seeing | Reframe, analogy, decomposition, contrast | | **Connection** | Orientation in space | External link, comparison table, prerequisite pointer | | **Experience** | Felt understanding | Worked example, failure story, interactive demo | | **Shortcut** | Compressed wisdom | Heuristic, pattern, anti-pattern, threshold, trade-off | | **Vocabulary** | Words to think with | Coined term, precise definition, distinction pair | Not every piece needs all eight. Most pieces have 2-3 primary value types. --- ## The Workflow {/* SUBSTANTIVE: workflow contrast */} One common workflow: 1. Define the main message 2. Outline the structure 3. Draft and refine the prose 4. Add supporting evidence Substantive-first: 1. Define what the reader should have when they finish 2. Identify substantives that provide that value 3. Order them into a sequence 4. Add prose that connects them Identify and design the substantives first, then write the prose that presents and connects them. --- ## Checklist Before Publishing {/* SUBSTANTIVE: checklist */} Before publishing, scroll through looking only at visual breaks and extracted elements: - Is there a substantive every 300-500 words? - Could someone extract 5+ useful things? - Is there at least one visual (screenshot, diagram, table)? - Is there at least one structural (checklist, framework, definition)? - Are there inline substantives (links, specific names, numbers)? If the piece contains mostly transitions and explanation with few concrete elements, revise it by adding more substantives or removing nonessential prose. --- ## How Substantives Differ from Arguments {/* SUBSTANTIVE: contrast table */} Traditional essays rely on arguments: claims supported by reasoning that the reader is expected to follow. Substantive-first content is built around artifacts, like checklists or definitions, that a reader can use without reading the rest of the piece. | Argument | Artifact | |-------------------------|-------------------------------| | "X is true because Y" | Screenshot showing X | | "You should do X" | Checklist for doing X | | "X works better than Y" | Benchmark comparing X and Y | | "X means Y" | Definition: X = Y | Arguments depend on the reader accepting your reasoning. Artifacts like checklists or definitions provide value directly. --- ## The Reusable Artifact Test {/* SUBSTANTIVE: criteria list */} To make a document reusable as a reference, ensure that it is: 1. **Extractable** - Elements can be pulled out and used independently 2. **Stable** - Content doesn't rely on context that will change 3. **Addressable** - Specific sections can be pointed to 4. **Machine-readable** - AI can parse and reference it Treat the document as a reusable artifact when automated tools can reliably parse its structure, you can copy sections into other documents without rewriting, and you can link directly to specific sections. --- {/* SUBSTANTIVE: core reframe, repeated */} The shift: start with what the reader should HAVE, not what you want to SAY. Design the substantives first, then write the prose, and test the result by checking what can be extracted. --- ## Reference: Exhaustive Substantive Types ### Utility — Reader Can Use This | Substantive | What Reader Gets | When To Use | |-------------|-----------------|-------------| | **Code snippet** | Executable capability | Any technical content where reader might implement | | **Template** | Fill-in-the-blank starting point | Process or document the reader will create themselves | | **Checklist** | Verification tool, nothing forgotten | Any multi-step process with failure modes | | **Procedure** | Step-by-step execution path | "How to" content of any kind | | **Prompt text** | Ready-to-use AI invocation | AI-related content, workflow content | | **Configuration** | Working setup they can copy | Technical content with setup requirements | | **Query/command** | Executable one-liner | Technical content, data content | | **Calculation/formula** | Computable relationship | Quantitative decisions, estimation | | **Decision tree** | Navigation through choices | Complex decisions with branches | ### Knowledge — Reader Now Knows This | Substantive | What Reader Gets | When To Use | |-------------|-----------------|-------------| | **Definition** | Precise meaning of term | Any time you use a term that could be ambiguous | | **Taxonomy** | Classification system | Domains with multiple types, options, or categories | | **Framework** | Multi-part mental model | Complex domains requiring structured thinking | | **Fact** | Verified true statement | Foundational claims, surprising truths | | **Distinction** | Difference between two things | Commonly confused concepts | | **Relationship** | How X connects to Y | Systems, dependencies, causes | | **Counter-example** | Case where intuition fails | Correcting common misconceptions | ### Proof — Reader Is Convinced | Substantive | What Reader Gets | When To Use | |-------------|-----------------|-------------| | **Screenshot** | Visual evidence something exists | Any claim about a system, UI, output | | **Benchmark** | Measured performance data | Claims about speed, quality, comparison | | **Log output** | Machine-generated evidence | Claims about system behavior | | **Repo link** | Inspectable source of truth | Any claim about code you've written | | **Citation** | Authority backing | Claims reader might doubt, contested topics | | **Testimonial/quote** | Another person's attestation | Claims about user experience, reception | | **Replication** | Someone else got same result | Scientific or technical claims | | **Timestamp** | When something happened | Narrative claims, incident reports | | **Specific name** | Who/what specifically | Any claim that could be vague | ### Perspective — Reader Sees Differently | Substantive | What Reader Gets | When To Use | |-------------|-----------------|-------------| | **Reframe** | "Not X, but Y" shift | Correcting common framing errors | | **Analogy** | Understanding via familiar domain | Complex concepts, cross-domain transfer | | **Lens/model** | Way of analyzing things | Recurring situations reader will face | | **Contrast** | Before/after, old/new | Change, improvement, evolution | | **Decomposition** | Breaking whole into parts | Complex wholes that seem monolithic | | **Synthesis** | Combining parts into whole | Scattered elements that form pattern | | **Scale shift** | Zooming in or out | When reader is stuck at wrong altitude | ### Connection — Reader Is Oriented | Substantive | What Reader Gets | When To Use | |-------------|-----------------|-------------| | **External link** | Path to deeper/related content | Any mention of external work | | **Comparison table** | Relative positioning of options | Decisions between alternatives | | **Influence chain** | Where ideas came from | Novel concepts, intellectual positioning | | **Contrast with alternative** | How this differs from X | Competitive positioning | | **Prerequisite pointer** | What to learn first | Content with dependencies | | **Next step pointer** | Where to go after this | Content that's part of larger journey | | **Ecosystem map** | How this fits in larger landscape | Tools, frameworks, communities | ### Experience — Reader Felt This | Substantive | What Reader Gets | When To Use | |-------------|-----------------|-------------| | **Interactive demo** | Learning by doing | Concepts that must be experienced to understand | | **Worked example** | Watching the process | Skills, procedures, problem-solving | | **Narrative incident** | Vicarious experience | Lessons that come from living through something | | **Failure story** | Learning from pain (yours) | Warnings, cautionary knowledge | | **Dialogue excerpt** | Witnessing an exchange | Interpersonal dynamics, debates | | **Sensory detail** | Grounding in physical reality | Abstract content that needs anchoring | | **Exercise** | Active practice | Skills that require repetition | ### Shortcut — Reader Has Compressed Wisdom | Substantive | What Reader Gets | When To Use | |-------------|-----------------|-------------| | **Heuristic** | Rule of thumb | Repeated decisions, common situations | | **Pattern** | Recurring structure with name | Situations reader will encounter multiple times | | **Anti-pattern** | What to avoid and why | Common failure modes | | **Threshold** | When X becomes Y | Decisions that depend on quantity | | **Priority order** | What to do first | Resource-constrained situations | | **Trade-off** | What you give up for what | Decisions with real costs | | **Warning sign** | Indicator of problem | Diagnostic situations | ### Vocabulary — Reader Can Think With This | Substantive | What Reader Gets | When To Use | |-------------|-----------------|-------------| | **Coined term** | New word for previously unnamed thing | When existing vocabulary fails | | **Precise definition** | Sharpened meaning of existing term | When term is used sloppily | | **Distinction pair** | Two words that mark important difference | When one word conflates two things | | **Acronym/abbreviation** | Compressed reference | Concepts that will be referenced repeatedly | | **Catchphrase** | Memorable crystallization | Core insight you want reader to retain and repeat | --- ## Building a compiler pipeline for a 300-page AI book URL: https://www.wcdc.io/writing/how-i-broke-down-writing-with-llms Date: 2026-01-21 Description: Writing Elements of Agentic System Design with Claude. At two in the morning, I was rereading hundreds of pages of technically coherent prose that sounded like nobody. Every section contained the same phrases and rhythms: "it's important to note," "let's delve into," "this approach offers several advantages." The facts were mostly right. The emphasis and voice were wrong. I was using AI to write *Elements of Agentic System Design*, a 300-page technical book about building AI applications. My source material included interviews, notes, examples, and years of project work. The problem was turning that material into a book without letting the model invent the argument between the notes. I eventually split the work into a pipeline. A move-annotated outline specified what each paragraph needed to do. Generation expanded those moves into prose. A style linter found recurring AI patterns. Separate revision passes repaired structure and voice at different stages. ## One-shot generation lost my emphasis My first attempt began with a long interview prompt. An agent asked questions about state, orchestration, tools, and context construction. I answered for hours and produced about fifty pages of organized transcript. I gave the transcript to Claude and asked for the book. It generated plausible chapters, but their emphasis bore little relation to mine. Topics I had mentioned briefly became major sections. Ideas I had spent an hour explaining were compressed into a paragraph. The transcript preserved my words without specifying how those words should become an argument. Claude had to decide which ideas were central, how they related, and where they belonged. Those decisions were exactly the work I needed to retain. I discarded the draft and added an intermediate step. ## Chapter outlines improved coverage but remained too vague In the second attempt, I worked chapter by chapter. Each chapter received an outline listing the topics, sequence, examples, and approximate length. Claude generated one section at a time. This version had the right broad shape. It also contained two persistent problems. The first was style. Stock phrases, symmetrical lists, generic transitions, and empty conclusions appeared throughout the manuscript. The second was emphasis inside each section. An outline item such as "explain context construction" did not record the specific claim, mechanism, distinction, or example I wanted. Claude filled that missing structure with a reasonable interpretation of the topic. Reasonable was insufficient when the point of the book was my interpretation. The outline told the model what a section was about. It did not tell the model what each paragraph needed to accomplish. I separated those two failures. Style needed a verification pass after prose existed. Missing argument structure needed a richer representation before generation began. ## I turned my edits into a style linter I first tried a larger style prompt. It banned phrases such as "delve" and "it's worth noting," supplied good and bad examples, and described the voice I wanted. Claude followed the rules briefly and then returned to its defaults across a long chapter. I stopped asking the generation pass to handle content and style simultaneously. The first pass could focus on explaining the specified material. A second pass would find and repair known style defects. I collected my repeated editing comments from the manuscript: "generic," "nobody says this," "empty transition," "same sentence shape again." I grouped them into concrete patterns a tool could detect: - banned phrases and stock transitions - paragraphs beginning with abstract throat-clearing - repeated contrast templates - excessive parallel lists - conclusions that restated the section without adding information - claims framed as universal lessons when the source described one project The linter marked passages matching those rules. A rewrite pass received the flagged sentence, its surrounding paragraph, and the violated rule. It revised only the affected passage, then the linter ran again. This did not define good prose. It removed defects I already knew how to identify. More importantly, it made those defects visible across hundreds of pages without requiring me to find every instance manually. ## I specified the function of each paragraph The linter improved the voice, while chapters still required heavy substantive editing. I could clean a paragraph perfectly and still have the wrong paragraph in the argument. I needed an outline that preserved rhetorical function as well as topic. I used the idea of rhetorical moves from [John Swales](https://en.wikipedia.org/wiki/John_Swales): a passage can make a claim, explain a mechanism, give an example, establish a contrast, ask a question, or resolve one. I assigned each planned paragraph a primary move: - **CLAIM** states the position. - **MECHANISM** explains how or why it is true. - **EXAMPLE** makes the mechanism concrete. - **CONTRAST** distinguishes the claim from a nearby alternative. - **QUESTION** identifies a tension the section must resolve. - **ANSWER** resolves that tension. - **CONSEQUENCE** explains what changes for the reader or system. The outline became more specific: ```yaml Context Construction: p1: CLAIM: Context is the model's complete input for one call KEY: Everything needed for that decision must reach the call p2: MECHANISM: Why the system must reconstruct context DETAIL: The model has no persistent memory between calls p3: CONSEQUENCE: What this requires from the application PRACTICAL: Load state and relevant history before every inference ``` I could now inspect the argument without reading generated prose. A claim with no mechanism lacked support. A mechanism with no example risked remaining abstract. A question with no answer left the section open. Repeated claims often indicated that two paragraphs were doing the same job. The move notation also constrained generation. Claude received one paragraph specification at a time and could focus on expanding that move instead of inventing the section's structure while writing it. ## The manuscript became a staged build The final pipeline separated decisions that I had previously asked one generation call to make: ```text source material ↓ chapter structure ↓ paragraph moves ↓ prose generation ↓ style linting and local rewrites ↓ substantive review ``` Each stage preserved a different part of the book. The source material contained the ideas and examples. The chapter structure assigned those ideas to an argument. The move outline specified the work of each paragraph. Generation chose sentences. The linter enforced recurring voice constraints. My final review judged whether the explanation actually landed. Errors became easier to locate. Missing coverage belonged in the chapter structure. A weak explanation belonged in a mechanism move. An irrelevant paragraph belonged in the move outline. A stock phrase belonged in the style pass. I no longer regenerated an entire chapter to fix one local problem. ## The intermediate representation made verification possible Traditional outlines preserve headings and topic order. That was insufficient for this project because topic coverage was not the only thing I needed to verify. I needed to verify the argument carried my claims, distinctions, mechanisms, and examples. The move outline recorded those elements directly. It became the source I reviewed most carefully because mistakes there propagated into every later stage. Prose remained easier to regenerate than the reasoning it expressed. The linter served the same role after generation. It turned my recurring style objections into explicit checks and attached each failure to a small passage. Neither representation guaranteed a good book. Together they reduced two large, vague editing problems to inspectable units. I still wrote the argument. I selected the material, decided the chapter sequence, specified the moves, and judged the final explanation. AI expanded those decisions into prose and helped repair known defects. That division finally made a 300-page manuscript manageable. I stopped asking a model to infer the book from a pile of source material. I gave it an argument detailed enough to inspect before generation and a set of checks precise enough to run afterward. --- ## I stopped designing agents and started designing systems URL: https://www.wcdc.io/writing/what-is-an-agent Date: 2026-01-19 Description: Notes from two years of building AI products. After two years of building AI products, I stopped using "agent" as a design primitive. The word covered too many different systems: a chatbot that calls one tool, a loop that works until a task is complete, a scheduled workflow, a group of specialized model calls, or an application that remembers a user across months. Those systems do not share one architecture. They differ in how they construct context, store state, call models, execute actions, recover from failure, and decide when to stop. Calling all of them agents hid the decisions I needed to make. I began describing the implementation directly. That led to a framework of ten elements I now use to design intelligent systems: context, memory, agency, reasoning, coordination, artifacts, autonomy, evaluation, feedback, and learning. ## The model is one component of the system A model API receives input and returns output. Continuity across calls comes from the application around it. I split that application into four parts: 1. **Model.** Produces an output from the context supplied for one call. 2. **Context.** Contains the instructions, history, retrieved data, and tool results available during that call. 3. **Storage.** Persists state across calls and sessions. 4. **Control flow.** Decides when to call the model, which tools to execute, what to add to context, and when to stop. The user experiences their combination as one continuous assistant. I can switch between model providers while preserving the same history, tools, and state, and the application still feels like the same system. The identity lives in the architecture more than in one model invocation. This changed where I looked for improvements. Better models help, but I control the other components. I can improve which history enters context, how stored facts are retrieved, which actions are allowed, how failures surface, and what evidence the next call receives. ## Every run alternates between context and control flow At the center of these systems, I found two recurring operations: - construct the context for the next model call - decide what happens after the call returns A basic tool loop makes both visible: ```python while not done: context = build_context(state, history, task) response = model.call(context) if response.wants_tool: result = execute_tool(response.tool_call) history.append(result) else: done = True return response.text ``` Memory changes `build_context`. Tools add branches to the control flow. Planning creates a plan in one call and feeds its steps into later calls. Multiple model roles use different context builders and pass outputs between them. Thinking in these terms made framework abstractions easier to evaluate. I no longer asked whether a framework supported agents. I asked whether I could inspect and control its context construction, state transitions, tool execution, and termination behavior. ## I use multiple calls when the system needs new evidence Large context windows do not remove the need for loops. A single call can only use information available when that call begins. I add another call when the system must leave the model and return with something new: - A search or file read supplies information that was previously unavailable. - Executing code verifies whether it works. - Asking the user resolves an ambiguity. - Writing a file or sending a message creates an effect outside the model. - Evaluating a draft produces evidence for a revision. The call boundary is where the system observes or changes the world. The next context incorporates the result. Different tasks need different loop shapes: ```text tool loop call → tool → observation → call reflection draft → critique → revision planning plan → execute step → inspect → replan if needed search generate branches → evaluate → retain the best hierarchical outer task loop → delegated inner loops ``` I choose the smallest loop that supplies the evidence the task requires. More calls increase cost, latency, and failure points. A planning or search loop needs to earn that complexity through better results on the actual task. ## "Multi-agent" usually means function decomposition I also stopped treating specialized model calls as digital coworkers. A researcher, planner, and writer usually correspond to three functions with different contexts and output contracts. For example: ```text research(query) → evidence plan(task, evidence) → outline write(outline, evidence) → draft ``` The useful design decisions are the inputs, outputs, state ownership, and failure handling at each boundary. Giving the calls names and personalities does not supply any of those. The anthropomorphic framing can hide missing state. A "researcher agent" remembers nothing unless the application stores and reconstructs its findings. A "debate" is a sequence of model calls that includes earlier outputs in later contexts. If one stage misunderstands the task, later stages inherit that error through the interface. I use multiple model components when context isolation, parallel work, or different evaluation criteria make the decomposition useful. I still implement them as functions over explicit data. That keeps the architecture inspectable and lets me test each boundary without simulating a social relationship. ## The engineering looks like ordinary system design Once I removed the agent abstraction, familiar engineering problems became visible: - Where does state live, and which component owns it? - How do concurrent operations coordinate? - What happens when a model call or tool fails? - Which actions require authorization? - How do I observe a run and reproduce a failure? - Which outputs become durable artifacts? - How does user feedback change later behavior? An LLM makes some components probabilistic, but it does not remove the need for explicit state, interfaces, retries, permissions, logs, and evaluation. These concerns shape reliability more than the label applied to the model loop. I needed a vocabulary that kept those decisions separate. That became the ten-element framework. ## The ten elements describe the decisions I make The elements are not ten modules that every product must implement separately. They are ten categories of decisions that appeared across the systems I built. | Element | The decision it captures | |---|---| | **Context** | What reaches each model call, in what order and format | | **Memory** | What persists, where it lives, and how a later call retrieves it | | **Agency** | Which external actions the system can execute and under what permissions | | **Reasoning** | The topology of model calls: single call, tool loop, reflection, planning, or search | | **Coordination** | How components exchange results and share or isolate state | | **Artifacts** | How documents, code, plans, and other durable outputs are represented and versioned | | **Autonomy** | What initiates a run: user request, schedule, event, or environmental condition | | **Evaluation** | How I measure whether a run or system produced a good result | | **Feedback** | Which user and system signals return after deployment | | **Learning** | How those signals produce changes to prompts, retrieval, tools, or control flow | The categories prevent one design choice from masquerading as another. Adding a vector database addresses memory, while it says nothing about how the next call uses the retrieved results. Adding tools expands agency, while it does not define when the system should invoke them. Scheduling a run adds autonomy, while it does not make the reasoning loop more capable. That separation also exposes defaults. If I do not design memory, the system may only retain the current conversation. If I do not define evaluation, iteration falls back to whether an output feels good. If I do not define autonomy, the user initiates every run. ## Context and memory are connected but separate I separate context from memory because persisted data is not automatically useful to a model. A database can contain years of history while one call receives the wrong ten records. Memory design covers storage, indexing, retention, and retrieval. Context design covers selection, formatting, ordering, and token budget for one inference. Retrieval connects them. This distinction helped me diagnose systems that appeared to have poor memory. The data was present. The context builder was choosing irrelevant records, omitting necessary state, or presenting the results in a form the model could not use. ## Evaluation, feedback, and learning form one improvement loop I also keep the last three elements separate. Evaluation defines quality for a task. Feedback collects evidence from real use, such as corrections, ratings, abandoned runs, or tool failures. Learning turns those signals into a change to the system. ```text run → evaluate → collect feedback → change system → run again ``` The model weights may remain fixed throughout this loop. The system still learns when I improve its prompt, retrieval policy, tool schema, permissions, or control flow in response to evidence. Without evaluation, feedback has no stable interpretation. Without feedback, evaluation stays confined to a test set. Without a process that changes the system, both become dashboards. ## I use the framework to describe the architecture before choosing tools For a new system, I write down one decision in each category. The result is short but concrete: ```text Context current task, relevant project files, latest tool results Memory project repository and run database Agency read files, run tests, propose patches; writes require approval Reasoning tool loop with one repair attempt after a failed test Coordination one model loop; test runner remains a deterministic component Artifacts Git patch, test output, and run trace Autonomy user starts each run Evaluation tests pass and requested behavior is present Feedback user accepts, edits, or rejects the patch Learning update instructions and examples from repeated failures ``` This description tells me more than calling the product a coding agent. It identifies the state model, permissions, loop shape, outputs, success criteria, and improvement path. I can then choose libraries and infrastructure that fit those decisions. I still use "agent" as shorthand in product conversations. I no longer let the word determine the architecture. When I build, I specify the system: what each model call sees, what persists, what can act, how calls compose, and how I know the result worked. --- ## ObjectEnv: a workspace instead of a list of tools URL: https://www.wcdc.io/writing/objectenv Date: 2026-01-16 Description: An object runtime backed by SQLite. ObjectEnv gives an agent a workspace instead of a toolbox. Objects live as JSON in [SQLite](https://sqlite.org/), each one addressed by name and carrying its own methods, and the agent works by invoking those methods rather than by calling stateless functions and re-reading the results. The hard part was deciding what an object must carry so that a reader which has never seen it can use it correctly on the first attempt, and then noticing that the most useful thing to put in such an interface is an operation the agent is not allowed to perform. The design below runs from the problem with tools through to the one part of it I would build again. ## A tool has no memory, and a tool protocol has no variables A tool is a function call. The model asks for something, a result comes back as text, and the model reads that text and decides what to do next. Each call is complete in itself, so anything the model wants to keep it keeps in the conversation and re-reads on the next turn. For a short job the missing memory is invisible. For anything that runs a while it becomes the whole problem, because the model carries its working set inside the transcript and pays for all of it on every call. MCP has calls but no pipe-level composability: no variable a tool can write and a later tool can read by name. ``` shell grep ... > hits a name to write to sort hits | uniq -c a later command reads that name tools search(...) -> "..." result comes back as text summarize("...") the text has to be carried in the transcript ``` A shell pipeline composes because a command can write to a name and a later command can read that name. A tool protocol has the commands and no names, so the only place to put an intermediate result is the transcript. The design goal follows directly: give the agent stateful objects it can reference, pass between calls and manipulate through methods. Combining state with the operations that change it follows the actor model more closely than separating a stateless reasoner from a generic memory service. Splitting an agent into a stateless reasoner and a memory service gives you two things that must be kept in agreement. Putting the state on the object with the operations that change it gives you one. ## An agent loop can call, and it cannot return A second problem appears when an agent has to be called from a program rather than chatted with. Its behavior is buried in a framework-specific message log, streaming is coupled to the chat transport, required behaviors are offered as optional tool calls, and the loop has no clean way to pause for a program-defined branch. The third one is the one the whole design turns on. Offering a tool is a request, and a request the model can decline is not a constraint. Everything a caller wants to guarantee has to be arranged so that declining is impossible rather than merely unlikely. The fourth points at something more structural: a tool call continues the agent loop, so the agent has no ordinary way to return control and a value to its caller. A function that finishes can do one of two things: call something else, or return, meaning hand a value back to its caller and disappear. An agent loop only has the first, because every tool result is fed back in and another turn runs. The usual approximation is a `finish` tool watched for from outside, which works the way a `goto` works, meaning fine until you want two of them nested. [Lisp](https://en.wikipedia.org/wiki/Call-with-current-continuation) calls the general machinery for this a continuation, and an agent runtime needs only the ordinary half of it, which is a way to end the loop with a value instead of with another message. ## A runtime, or a file with a script beside it Two designs answered the requirement. The first was a virtual runtime of persistent [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)-like objects backed by SQLite and exposed through one tool surface. The second was a file carrying its own data and code, one format per kind of artifact. I chose the runtime because one global environment gives every object the same storage and invocation path, while file-specific objects require custom schemas and readers for every kind. One environment with a global scope has one storage layer and one invocation path, so adding a kind of object costs a class definition. A file-per-artifact design multiplies both by the number of kinds, and each kind then needs its own schema, its own reader and its own tools. The remaining objection was whether the runtime bought anything a file plus a script did not. The object could exist only while the script was running and still persist its data in the file. Two months later that objection collected its answer. The build was scoped for speed rather than architecture. Moving from a hosted sync engine and server-side [WebAssembly](https://webassembly.org/) to local SQLite and [TypeScript](https://www.typescriptlang.org/) removed deployment from the iteration loop. The earlier attempt at the same idea ran on a hosted sync engine with object schemas defined in it, which put a deployment between every change and every observation. A local file and a local process removed both, and the idea survived contact for the first time. ## The interface has to describe itself, because nothing human will read it The object type has to answer a question an ordinary class never has to. What must an object carry so that something which has never seen it before can use it correctly on the first attempt? A class in a normal program does not carry that and does not need to. The names do most of the work, the signature does the rest, and the documentation is a courtesy for whoever maintains it later. Here the caller is a model that arrives with no prior exposure and does not get a second attempt for free. ```ts export interface ObjectClass { name: string; description: string; defaultState: S; methods: Record>; } export interface MethodDef { description: string; // what this method does and when to use it example?: string; // example usage fn: (state: S, ...args: any[]) => any; } ``` A lock, whole, is small enough to read as one thing: ```ts const Keypad: ObjectClass = { name: "Keypad", description: "A digital keypad lock. Enter the correct code to unlock. " + "Wrong attempts are tracked.", defaultState: { code: "1234", entered: "", maxLength: 4, attempts: 0, maxAttempts: 5, locked: true, hint: "4 digits required", }, methods: { look: { /* ... */ }, press: { /* ... */ } }, }; ``` Everything an agent needs to operate it is in the value. Nothing is in a prompt, and nothing is in a comment. Only `description` is required, and the example is optional because it earns its place only where the call shape is not obvious from the name. A worklog's `log` method carries `invoke("daily-log", "log", ["Implemented feature X", ["dev", "feature"]])`, which shows the positional array and the nested tag list in one line, and an agent that has never seen a worklog can construct a valid call from it. Putting `description` on the type rather than in a doc comment is the decision. A comment is advisory and a field is not, so a class that does not describe itself does not compile, and there is no path by which an undocumented method reaches an agent. Objects live as [JSON](https://www.json.org/) in SQLite and are hydrated with their class only when a method is invoked, which makes the object virtual. It exists during the call and is a row the rest of the time. The whole surface is three verbs: ```ts const env = createEnv("./my-env.db"); env.create("Counter", "page-views"); env.invoke("daily-log", "log", ["Finished implementing feature X"]); env.inspect("daily-log"); // -> methods, each with its description ``` `inspect` is the one that matters, because it is how an agent finds out what an object can do without anybody having put that in a prompt. ## Constrain the interface rather than instruct the agent The requirement appears with the first object big enough to matter. A worklog holding two years of entries is too big to read, and the obvious interface hands the agent a `getAll` and lets it discover that by running out of context. The instinct is to fix it with instruction: tell the agent to check the size first or process long logs in chunks. That remains probabilistic and has to be repeated in context, so the size bound belongs in the interface instead. An instruction is a probability, and it decays with distance from where it was given. An agent that has forgotten looks exactly like one that was never told, which makes the failure impossible to diagnose from the outside. So the worklog has `peek`, marked in the source under the comment `Constraint methods - help agent reason about scale`: ```ts peek: { description: "Get metadata about the worklog without loading entries. " + "Use this FIRST to understand scale before deciding how to process.", example: 'invoke("daily-log", "peek")', fn: (state) => ({ count: state.entries.length, earliest: /* oldest timestamp */, latest: /* newest timestamp */, tags: /* every tag in use, sorted */, }), } ``` A count, a time range, and the tag vocabulary. No entry ever comes back. The instruction to call it first sits in the description because the description is what the agent reads, and it holds without being remembered, because the return type makes any other order pointless. Nothing gets an entry out of `peek`, so an agent that wants entries has to go somewhere else and pick a slice. Underneath it sit readers that take slices rather than everything. `range` between two timestamps, whose own description says it is for chunked processing of large logs, plus `lastN`, `lastHours` and `today`. None does anything a `getAll` could not do, and each one makes a shortcut unavailable. The general form is that a degree of freedom you remove cannot be used wrongly, and a degree of freedom you ask politely about will be used wrongly at some rate you cannot measure. ## The journal indexing run The test was two years of journal data that needed indexing and summarising. Rather than writing the processing logic, I created the object types, populated the environment with the data, and asked the agent to work out a strategy. It chose to chunk by time period, summarise each chunk, and then synthesise the summaries into a whole, which is map-reduce, and nobody wrote the loop. The narrow reading is the one worth keeping. The affordances already pointed at chunking, since one method says to call it first to understand scale and another says it exists for chunked processing of large logs. The agent supplied the axis to cut on and the decision to synthesise rather than concatenate, neither of which anybody had specified. Which is the result the design was actually testing. Constraining an interface changes behaviour more reliably than instructing it does, because making the contents unavailable until the agent has asked how big they are is not something it can forget. ## A search with no way back is a worse algorithm Branching was added after watching agents work, rather than from anticipating that they would need it. An agent exploring a problem hits dead ends, and with no way back it does one of three things: burns tokens reversing its own moves by hand, loses the state and starts over, or stays in a bad position because getting out costs more than continuing. The mechanism is one table. Every state-changing call gets a row carrying the state before it and the state after: ```ts export interface MutationRecord { id: number; branch: string; object_id: string; object_name: string; method: string; args: string; // JSON before_state: string; // JSON after_state: string; // JSON created_at: number; } ``` Once that table exists, the rest is a query against it. A checkpoint is a marked row, an undo reverts the last n mutations by writing `before_state` back, and a branch is the `branch` column, so forking the timeline at a row lets two strategies run from the same position: ```ts export interface BranchRecord { name: string; parent_branch: string | null; fork_point_id: number | null; // the mutation this branch forked at created_at: number; } ``` Three features and one implementation. The maze solver demonstrates it. The agent gets `look`, `move`, `checkpoint` and `restore`, and the checkpoint method's description tells it to save before exploring a path that might be a dead end. In the run recorded at the time it escaped in twelve moves after exploring six dead ends, using six checkpoints and four restores. The loop in that maze is decide, observe, update, decide again, which is search in the ordinary computer science sense. Every search has a way of backing up: recursion unwinds the stack, and an iterative version keeps an explicit one. An agent in a loop has no stack to unwind, so until you hand it checkpoints it is running a search with the back-up step deleted, which is a different and much worse algorithm. ## State as the coordination mechanism The murder mystery is the demo that shows why a workspace beats a message bus. Three suspects, each an object, and the state is where the whole game lives: ```ts interface SuspectState { alibi: string; // what they claim isGuilty: boolean; // hidden truth secretMotive: string; actualWhereabouts: string; trustLevel: number; // 0-100 timesQuestioned: number; gossip: Array<{ about: string; info: string; requiresTrust: number }>; reactions: Record; // keyed by evidence id } ``` Nothing there is a message. Showing evidence to a suspect changes that suspect, questioning them changes what they will say next, and pressing too hard costs trust that gates the gossip you wanted. The investigation is a walk through state, so the solution emerges from the order the agent chose rather than from a path anybody laid down. Two agents working the same case need none of the machinery a message protocol would require, because they are reading and writing the same suspects. Humans collaborate the same way, working on shared documents and boards rather than only talking, and the shared artifact is what makes the talking optional. ## What the pattern kept when the runtime went The later rebuild changed the substrate under one principle: Linux already supplies the persistence, naming, composition and process model, so the system should compose those facilities rather than recreate them. Under that principle the agent is the shell and the filesystem is the store, and the three things ObjectEnv supplies as a runtime are already sitting there. Files persist, are addressable by path, and can be passed around by name. [Git](https://git-scm.com/) has branches and checkpoints. Git also has the mutation log, for the same reason. Which is the answer to the objection I had raised against my own design on the first day, about what a runtime buys over a file with a script beside it. It buys the invocation path and the storage layer, both of which an operating system already provides. The filesystem has no equivalent for the bounded methods, which are a design pattern rather than a package. A `peek` that structurally cannot return an entry is something the application still has to define. The transferable parts: - Put state on the thing that computes with it, so there is one object to keep correct rather than two systems to keep in agreement. - Give the workspace names, because composition needs somewhere to put an intermediate result that is not the transcript. - Ask what the interface must carry for a caller that has never seen it and gets one attempt, then make that a required field rather than a comment. - Remove the shortcut instead of asking the caller not to take it, because an instruction decays with distance and a missing method does not. - Design the return type so the intended order is the only order that gets anywhere. - Give an exploring agent a way to back up before you give it anything else, since a search without one is a different algorithm. - Log before and after state once, and take checkpoints, undo and branching as queries over the same table. - Check whether the operating system already implements the runtime you are about to write, and keep the part it does not. The bounded methods remain useful. I would build them again on top of the filesystem instead of maintaining a runtime of my own. --- ## Idyllic v4: compiling TypeScript classes into stateful agents URL: https://www.wcdc.io/writing/idyllic-v4 Date: 2025-12-18 Description: Using Cloudflare Durable Objects to keep an agent session's state together. In [Idyllic](https://idylliclabs.com) v4, I define an agent application as a [TypeScript](https://www.typescriptlang.org/) class. One instance represents one live session. Properties hold its state, decorated methods define the operations a client can call, and a compiler turns the class into a deployable Cloudflare Durable Object. I chose this model because prompt-and-tool frameworks make persistent state feel external to the program. They give the model instructions and callable functions, then leave the application to name keys, serialize values, reconstruct objects, and keep the store consistent. They also reduce every interaction to a generic message even when the application has clear operations such as `move`, `resign`, or `generateReport`. I wanted the source code to describe the application directly: state as properties, operations as methods, and deployment machinery generated around both. ## The class owns state and compute Most agent frameworks define an agent as a prompt plus tools. Memory usually becomes a message array backed by an external store. Even a simple phase variable needs a key and serialization code: ```ts await store.set(`session:${id}:phase`, JSON.stringify("evaluating")); const phase = JSON.parse( await store.get(`session:${id}:phase`) ?? '""' ); ``` Inside a stateful object, the same operation is an assignment: ```ts this.phase = "evaluating"; ``` JSON encoding itself is cheap. The recurring cost is inventing keys, keeping their shapes synchronized with the code, and rebuilding typed values after every read. State that belongs to a running application should live on the object performing the work. That gave me the base abstraction: an agent application is a program with installed modules. The program owns session state and control flow. Each module adds a configured capability, including the data it needs to operate. ## One instance represents the whole session Once the application became an object, I had to decide what one instance represented. A separate object for every agent creates several owners for state that belongs to one session. Three agents working on the same document would each need a copy or a protocol for synchronizing their views. I use one instance for the entire live system: ```text one instance per agent one instance per session agent A ── state ┌──────────────────────┐ agent B ── state │ shared session state │ agent C ── state │ │ coordination │ agents are functions│ protocol └──────────────────────┘ ``` The session object owns the board, document, accumulated findings, and other shared state. Specialized agents run as functions inside it. They can still have separate prompts, context, and data, but they do not need a conversation protocol to agree on the state of the work. The client interacts with one `AgenticSystem`. Whether the implementation uses one model call or ten agents in parallel stays behind that boundary. ## Actions use the verbs of the application Generic `run` and `onMessage` methods work naturally for chat. They become awkward as soon as the application has operations that users already know how to name. Chess made this obvious. A message interface encodes the move inside text and parses it on the server: ```ts agent.onMessage("I'd like to play e4"); ``` The domain already has a better interface: ```ts agent.move("e4"); agent.resign(); agent.offerDraw(); ``` Methods give the frontend real signatures, make invalid calls visible to TypeScript, and let each application expose something more specific than `sendMessage`. I mark remotely callable methods with `@action()`. Public methods remain ordinary helpers unless I explicitly add the decorator. This keeps a local refactor from silently changing the network API. ## Fields define the synchronized client state I use the same rule for values displayed by the interface. A synchronized value is a decorated property: ```ts export default class SimpleSystem extends AgenticSystem { @field query = ""; @field count = 0; @action() async increment(amount?: number) { this.count += amount ?? 1; } } ``` `@field` exposes state to connected clients. `@action()` exposes a method they may call. Assigning to `this.count` updates the clients, so application code does not contain a separate broadcast operation. Model output needs a second field type because streaming text has a lifecycle. A normal value changes atomically; a stream receives chunks and eventually completes: ```ts @field problem = ""; @field hypo1 = stream(""); @field hypo2 = stream(""); @field hypo3 = stream(""); ``` A stream supports `append`, `complete`, and `reset`. Three model calls can write to three fields in parallel with `Promise.all`. The paths separate their output, so I do not need to multiplex several generations through one application-level channel. The wire messages remain small: ```json { "type": "stream:append", "path": "hypo1", "chunk": "The key insight..." } { "type": "stream:complete", "path": "hypo1", "value": "The key insight is..." } { "type": "action", "action": "generate", "args": [] } ``` The framework owns transport and synchronization. Application code decides when to append history, create an artifact, checkpoint state, or complete a stream. ## History entries remain extensible Conversation history cannot be a closed list of text messages if modules can introduce plans, artifacts, charts, or structured tool results. Encoding every new entry as text creates a second informal protocol inside the first. In Idyllic, a module can define a history entry type together with two conversions: how the interface renders it and how the model sees it. A chart can remain structured in the application while producing ordinary model messages when it enters inference context. This boundary keeps the framework from deciding the shape of every application built on it. Idyllic moves history entries and synchronizes them. The application and its modules own their meaning. ## The source class compiles into a different program The class above is the code I want to write. Cloudflare requires a Durable Object export, storage bindings, request routing, and lifecycle hooks. Those are different programs connected by a source transform: ```text authoring model TypeScript class with fields and actions deployment model Durable Object export with storage and routing compiler transforms the first into the second ``` Separating them let me design the source API around application code and the generated output around the platform. The compiler is the layer that makes both descriptions true. I originally approached Idyllic as a custom language for AI applications. TypeScript already supplied the parts I would have had to rebuild: types, editors, imports, packages, control flow, and familiar object composition. Idyllic therefore restricts and transforms a subset of TypeScript instead of inventing new syntax. The source must continue to read and behave like an ordinary class. Code that does not use an Idyllic construct keeps normal TypeScript semantics. The transform only gives additional behavior to explicit fields and actions. I also keep the deployment target out of authored code. The compiler generates the routing worker that locates the correct session instance. Local development runs the same transform through [Miniflare](https://developers.cloudflare.com/workers/testing/miniflare/), keeping local and deployed semantics aligned. This removed Wrangler from the application-facing workflow. Hiding it behind another command would still expose its configuration and errors. Using Miniflare directly gave Idyllic one runtime path that I could control. ## The protocol sets the limit of the transform I designed the wire protocol before finalizing the compiler rules. The protocol determines which state transitions the runtime can represent. The runtime then determines which source constructs the compiler can support honestly. ```text protocol → runtime behavior → source constructs ``` Because the protocol has a field-update event, the compiler can turn assignment to a decorated field into a state change and broadcast. Because it has stream append and completion events, `stream` can expose those operations directly. Because it has an action call, a decorated method can become a typed remote procedure. Anything outside that protocol remains local TypeScript. This gives the transform a clear boundary and prevents convenient source syntax from promising behavior the runtime cannot deliver without hidden round trips. The ordering also made persistence easier to reason about. A field update has one runtime meaning whether it originated from a local action, a model callback, or an external event. The storage and broadcast behavior attach to that transition instead of being reimplemented at every call site. ## Modules bring the state behind their operations Tools expose functions and leave their storage to the application. Idyllic modules package the operations with the data model and configuration they require. A Telegram module, for example, can provision message and contact tables, retain conversation state, install its prompts, and export operations such as `sendMessage` and `getConversationHistory`: ```text install Telegram module brings messages table contacts table conversation state conversation prompts exports sendMessage getConversationHistory ``` Installation is a provisioning step. The application receives a configured stateful resource instead of a function whose memory must be assembled elsewhere. This is the module boundary I care about: a module owns the state required to make its operations meaningful. Stateless capability can remain a tool. Stateful capability arrives with its tables, migrations, prompts, and lifecycle. The result resembles a small cloud environment scoped to one agent application. Installed modules provide resources with operations defined over them, while the session program composes those resources into behavior. ## Durable Objects match the resource model The transport did not decide the platform. Server-sent events, WebSockets, and hosted realtime services can all carry the protocol. I needed an addressable live session located beside persistent storage. [Durable Objects](https://developers.cloudflare.com/durable-objects/) provide that resource directly: one named JavaScript instance with attached storage. The infrastructure now matches the source abstraction. One class instance represents one session in the program, and one Durable Object represents that session when deployed. Ordinary serverless functions could run individual actions, but an external event or background operation also needs to update the session and deliver changes to connected clients. I use request-response execution for the application logic and keep a long-lived connection for delivery. That division fits an edge isolate. A general container would support a wider range of workloads at the cost of a heavier deployment model. Idyllic only needs the execution and storage behavior required by its class model. The deployment layer uses [Cloudflare Workers for Platforms](https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/) with Durable Objects underneath. Idyllic owns code upload, transformation, routing, and the developer-facing lifecycle. Cloudflare owns the machines and stateful runtime. Fast delivery is infrastructure, not the product's reason to exist. "Ten agents streaming" only describes traffic. The application model matters because those agents are updating typed state through named operations inside one shared session. ## The same boundary improved debugging Named actions make a live session inspectable through RPC. A coding agent can connect to a running instance, read its fields, call the same actions as the browser, and observe the resulting state transitions. The interface updates while the coding agent operates the application, so I can watch a debugging session happen through the product itself. I did not need a separate control protocol; debugging reuses the domain methods and synchronized fields already required by the application. This is a useful test of the abstraction. A second kind of caller can drive the same object without converting every operation back into text messages. ## The class carries the application boundary Idyllic v4 moves the important boundaries into the source type system. Persistent state is a property instead of a key in an external store. Client operations are methods instead of instructions hidden in messages. Remote access is explicit through decorators. Streaming output is a typed field with a defined lifecycle. The compiler preserves that authoring model while generating the storage, routing, synchronization, and deployment code required by Durable Objects. Modules package stateful resources together with their operations. The final model is compact: one class represents a live agentic system; its fields hold shared state; its actions expose the verbs of the application; installed modules bring their own storage and operations. TypeScript describes what differs between applications. The generated runtime carries everything else. --- ## Mechanistic Mindset: a wiki three agents maintain URL: https://www.wcdc.io/writing/mechanistic-mindset Date: 2025-11-19 Description: Using computational models to understand my own behavior. The [Mechanistic Mindset](https://mechanisticmindset.com) wiki describes my behaviour in computational language: activation costs, scripts, state, caches and thresholds instead of laziness, discipline or willpower. It lives in a folder of linked markdown files and is maintained by three agents. The design problem was maintenance. New material cannot simply become another page. It has to be reconciled with the existing definitions, terminology and links. That requires turning editorial qualities such as consistency, caution and connectedness into instructions an agent can follow or properties a script can measure. ## Choose the container that matches the state of the thinking The origin was a page called MY OWN LEXICON, a glossary of terms for how my behaviour works, each with the definition I meant rather than the dictionary one. The list kept growing and the entries kept referring to each other, so what it wanted was not a longer glossary but a set of pages that point at one another and accumulate. The material did not fit a blog. Posts imply publication order and a moment of completion. These ideas continued to change, and their relationships mattered more than when I wrote them. A wiki makes revision normal, lets each article stand alone and represents those relationships directly through links. There is a second reason to want the graph, and it aims at the machine rather than the reader. A model works over whatever you put in front of it, so the useful question is which structure makes assembling that material cheap. A graph of standalone pages with typed relations between them lets a retrieval step start at a concept and walk outward, which a chronological archive of posts cannot do. The wiki is a memory substrate for compute before it is a publication. ## The material was written down and not addressable, which decides who maintains it Years of source material already existed in chat transcripts, but none of it was addressable. Each idea was buried inside a longer exchange, and converting those exchanges into a coherent wiki required a second pass over everything. I did not want to perform that pass manually. The publishing system therefore had to be operable by an agent. That requirement ruled out tools whose structure lived behind an application-specific interface. ## A vault is a folder of markdown, and that description is the one an agent can operate I initially dismissed [Obsidian](https://obsidian.md/) as an uninteresting choice. That changed when I described an Obsidian vault by its storage model instead of its interface: it is a folder of markdown files. Wiki links are page names in double brackets, and the graph can be reconstructed by reading the files and following those brackets. Obsidian does not have to be running for the structure to exist. Three things come free from that description: - **the graph edges already exist,** because wiki links are edges - **the graph is queryable,** because a script can walk the vault and build the adjacency itself - **maintenance becomes a file-editing problem,** which is the one thing coding agents are unambiguously good at The useful description of a tool is the one that exposes the parts an agent can operate. For Obsidian, those parts are files, links and directories. ## An exemplar specifies a register that a description can only name I wrote a briefing describing what the wiki was for and how its articles should read, then fed the agent a handful of seminal articles and brain dumps I already had. It started producing pages, and the pages were right. Those first articles became the models for every article after them. Each new article is written with related existing pages in context, so the register of the early pages propagates through the vault. Editing the initial examples carefully mattered because later pages repeatedly sampled them. Exemplars beat descriptions for a reason that says something about what you are talking to. - **Describe the register** and each adjective still covers a wide range of writing. A request for prose that is precise, unhurried and sceptical leaves the model to construct an example of that voice before it can produce a sentence. It usually chooses a generic version. - **Provide three articles** and the target becomes concrete. A language model continues text, so an example supplies the sentence shapes, pacing and degree of certainty directly. A style guide still matters for explicit prohibitions, but examples carry the register. The first articles were part of the system specification. ## The wiki's content is a translation rule, so the rule lives in the agent that writes The wiki has one operation running through every article, which is the conversion of a moral description of behaviour into a mechanical one. Lazy becomes a script that failed to load. Lacking discipline becomes an activation cost above the threshold that was available. Because this translation applies to every article, it belongs in the writer's definition rather than in an individual prompt. The definition carries it as two lists: ```markdown **USE:** - Computational metaphors: state, cost, script, RAM, algorithm, cache, threshold, activation energy, default scripts - System descriptions: "the work_launch_script didn't load" not "you were lazy" - Operational definitions: frameworks described by what they let you DO **NEVER USE:** - Moralistic language: willpower, discipline, laziness, procrastination (except when explicitly translating FROM them) - Scientific claims: "studies show," "research proves" - Motivational/preachy tone - Vague abstractions without operational grounding ``` The parenthesis in the first banned item is the load-bearing part. Banning the moral vocabulary outright would make the wiki unable to state the thing it is translating from, and the exception keeps the source language available inside the translation while keeping it out of the conclusion. A second constraint prevents computational language from turning into a claim about neurology. The wiki documents a practice; computation is a lens, not a literal biological mechanism. The reviewer checks every article against that boundary. The maintainer's brief also defines its authority by listing what it may not do: ```markdown **What you DON'T do:** - Auto-generate content unprompted - Decide what to document (Will leads) - Try to make this "scientific" or prove things rigorously - Create quantifiable predictive models ``` These restrictions prevent the maintainer from treating structural gaps as permission to invent material. It may organize and reconcile my thinking, but it may not decide what I believe or what deserves an article. ## A separate agent exists because an instruction does not survive a long generation The pipeline needed to run without article-by-article supervision. I first used one agent for research, writing and review. In long sessions, its early instructions had less influence on later output, so I kept reintroducing the same constraints. So the work divided into roles, and each role is a file with a frontmatter block naming the model it runs on: ```markdown --- name: wiki-article-writer description: Use this agent when you need to write or draft articles for the Mechanistic Mindset wiki in Obsidian format. This includes: creating new conceptual articles from brain dumps, expanding stub pages into full articles... or translating moralistic language into mechanistic computational metaphors. model: sonnet --- ``` The description is dispatch criteria rather than a summary because the orchestrator uses it to select an agent. The work is divided across three roles: - **Context finder.** Finds pages related to the new material, summarizes their treatment of it and identifies conflicts before drafting begins. - **Writer.** Produces or updates articles using the source material and the related pages. - **Reviewer.** Checks a finished draft for certainty, terminology, register and graph integration. The reviewer has a more specific job than general quality control. Certainty calibration comes first, and each failure is paired with an acceptable replacement: ```markdown ### 1. Certainty Calibration (HIGHEST PRIORITY) **RED FLAGS - Flag immediately:** - "The brain literally implements X" - "Research proves/shows that..." - "This is not metaphor, this is actual mechanism" - Deterministic predictions ("this will cause Y") - Universal statements ("everyone experiences X") **GOOD PATTERNS - Encourage:** - "Appears to use X-like processes" - "Observed in N=1 experience that..." - Probabilistic language ("tends to", "often", "in this case") - Explicit caveats ("This worked for Will, test it yourself") **ACTION:** For every claim, ask: "Is this presented as useful heuristic or scientific truth?" ``` The replacements matter because a prohibition alone gives the reviewer no way to repair a sentence. Build order and run order differ: - **built** writer, context finder, reviewer - **runs** context finder, writer, reviewer ## Edge density has to be measured or it is a wish An agent editing one article cannot assess connectivity across the vault. Instructions to "link related pages" therefore need collection-wide checks. So the properties I wanted became scripts the agents run, and each one names a pathology rather than a metric: | Script | What it reports | The pathology it names | | --- | --- | --- | | `check_links.py` | broken links, orphaned pages, hub and authority pages | a page nothing points at | | `connectivity_analysis.py` | centrality, clusters, bridge pages | a cluster attached to the rest by one article | | `consistency_checker.py` | dead-end pages, missing sections, terminology usage | the same concept under two names | The connectivity script is [NetworkX](https://networkx.org/) pointed at the vault, and its method list is the vocabulary the pathologies are named in: ```python def build_graph(self) # articles as nodes, wikilinks as edges def pagerank(self) # which articles the graph treats as central def betweenness_centrality(self) # bridge pages: remove one, split the vault def degree_centrality(self) def get_mst(self) def get_communities(self) # clusters that formed without being planned def get_reading_order(self, start) # a path through the graph for a new reader ``` Naming the pathology is what makes the number actionable. An orphaned page is a page the reader will never reach, a bridge page is a single point of failure in the graph's connectivity, and inconsistent terminology means the retrieval step will miss half of what it should have found. The graph also produces a reading order derived from the actual links rather than a manually maintained table of contents. The briefing tells agents when to run each script, so link checking follows linking work automatically. The same reasoning produced a fixed ontology, and it sits inside the context finder's own brief so that it gets consulted on every pass rather than looked up: ```markdown 5. **Ontology Awareness**: Always consider where concepts fit in the wiki's structure: - Philosophy & Foundations - Tools & Infrastructure - Methodology - Case Studies - Core Frameworks (Computational Lenses) - Applications - Principles - Teaching & Transmission - Techniques - Supporting Concepts ``` The closed list makes placement consistent. If an article fits none of the ten categories, the mismatch exposes a problem with the ontology instead of encouraging the agent to create an ad hoc category. ## Ingestion is reconciliation, which is why raw material stays outside the graph The wiki got a web reader with retrieval search over it, which is what [mechanisticmindset.com](https://mechanisticmindset.com) serves. The property that mattered more is that dropping a chat transcript into the vault updates the existing articles rather than adding one to the end. Ingestion reuses the context finder. Before anything is updated, it returns four things for a transcript: - every page that discusses the concept, uses related terminology, or would be affected by a change to it - how each of those pages currently treats the concept, and in what language - the existing cross-links and their directions - the inconsistencies between them The conflicts turn ingestion from appending into reconciliation: - **a list of affected pages** tells the writer where to add text - **a list of the conflicts** between how those pages already describe the thing tells it what has to change Resolving those conflicts performs the second pass that made manual transcription impractical. One rule protects the boundary. Incoming transcripts and brain dumps land in a `raw/` directory that the wiki never links to and the graph scripts never scan. Raw material is a source to be read, and an article is something written from it, and mixing them would put unreconciled text inside the structure whose whole value is that everything in it has been reconciled. The exclusion is encoded as a default argument: ```python def __init__(self, vault_path: str, exclude_dirs: List[str] = None): self.exclude_dirs = exclude_dirs or ['raw', '.git', '.obsidian', 'scripts'] ``` The default keeps `raw/` outside the graph unless a caller explicitly overrides it. The context finder always asks which other pages are affected when a concept changes. That propagation step is the difference between maintaining a knowledge system and filing new documents. ## Why the work remains split into three passes The three agents contain instructions that could fit in one prompt, but the single-pass version produces worse articles. Two mechanisms may explain the difference: - **Instruction competition.** A prompt carrying three jobs makes their constraints compete, and review instructions apply to text that does not exist when generation begins. - **A concrete review object.** A separate reviewer receives a finished draft instead of an intention to write one, so every comment can refer to actual language. Larger context windows may reduce instruction competition, but they do not remove the value of reviewing a concrete draft. The pipeline therefore keeps three passes and gives each one an inspectable artifact: the context finder produces an impact map, the writer produces a draft and the reviewer produces specific repairs. The resulting wiki is maintained through boundaries rather than autonomy alone. [Markdown](https://commonmark.org/) exposes the state, exemplars specify the register, role prompts constrain authority, scripts measure graph-wide properties and the `raw/` boundary separates evidence from reconciled knowledge. Together they let agents change the vault without quietly changing what the vault means. --- ## XJSN: a notation for models to write programs as data URL: https://www.wcdc.io/writing/xjsn Date: 2025-09-08 Description: Adding function calls to JSON without executing them as JavaScript. XJSN is JSON with one additional value type: an inert function call. A call can appear anywhere a JSON value can appear. It looks like code, but it is never evaluated as JavaScript. The parser turns it into data, and a validator checks the resulting tree against a registry of allowed functions. ```javascript { "user": checkUser("alice"), "actions": [ sendEmail("welcome"), createProfile() ] } ``` The design came from a practical problem. I needed an intermediate form that a model could generate reliably, a program could parse, a person could inspect, and a validator could reject before anything executed. [JSON](https://www.json.org/) satisfied three of those requirements. It struggled with the first. The solution was not to give the model a full programming language. It was to use the part of programming-language syntax that models are unusually good at producing, then remove everything that makes code dangerous or difficult to validate. ## The problem is constrained generation Suppose a user describes a workflow in ordinary language. A model translates that description into an intermediate representation, and a runtime eventually carries it out. That intermediate form has four readers: - The model has to generate it. - The parser has to reconstruct it. - A person may need to inspect or edit it. - The validator has to decide whether it is safe and meaningful. Most serialization formats are designed around only the second reader. They optimize for programs exchanging data. A model-generated program adds a different constraint: the notation must be easy to produce correctly under deep nesting. The central problem is therefore not parsing arbitrary model output. A parser can be written for almost any notation. The problem is defining a small set of structures the model may generate, giving the model a reliable way to express them, and returning errors specific enough for the model to repair its own output. That makes generation, validation, and error reporting parts of one protocol. ## Why plain JSON becomes awkward JSON is the obvious starting point. It is familiar, language-independent, easy to parse, and supported by schema tools. It also has a deliberately small type system: objects, arrays, strings, numbers, booleans, and null. There is no native way to say that a value is a function call, a condition, or a reference. Those constructs can be encoded with tagged objects: ```json { "$type": "conditional", "$condition": { "$type": "function_call", "$name": "user_has_permission", "$args": [ { "$type": "variable", "$ref": "current_user" } ] } } ``` The representation is valid JSON, but it makes both generation and reading harder. The model has to preserve several levels of brackets, repeat structural keys such as `$type`, and remember which fields belong to each tagged variant. A person has to read through the encoding before reaching the operation it represents. Validation also becomes indirect. The shape of an object depends on the value of `$type`, so the schema becomes a union over every possible construct. That is workable in principle, but errors tend to point at a failed union rather than the actual mistake: a missing argument, an unknown function, or a value of the wrong type. The notation had moved the complexity of the language into the least readable part of the document. ## Models are better at code-shaped nesting Deep nesting is not equally difficult in every notation. Models produce nested code much more reliably than equally nested tagged JSON. That is not surprising. Source code is abundant in training data, and nesting is fundamental to it. Models have seen function calls inside function calls, arrays of expressions, object literals containing calls, and long chains of structured arguments. This suggested a different strategy: 1. Start with a shape the model already knows how to generate. 2. Keep only the syntax needed to describe a structured program. 3. Remove variable declarations, assignment, closures, branching, loops, and arbitrary execution. The goal was to use the model's coding priors without accepting general-purpose code. That put XJSN between two familiar languages: - It is a subset of [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) syntax, which gives the model familiar function-call notation. - It is a superset of JSON values, which keeps every parsed result representable as data. The result looks like the declarative part of a JavaScript codebase, but its semantics are closer to a typed data format. ## A function call is the only new primitive JSON needs only one extension to represent most of the structures I cared about: a call that occupies a value position. ```javascript { "workflow": checkPermission(currentUser), "actions": [ sendNotification(), returnResponse("success") ] } ``` The parser never executes `checkPermission`. It produces an AST node: ```json { "$type": "call", "$fn": "checkPermission", "$args": [ { "$type": "reference", "$ref": "currentUser" } ] } ``` The verbose representation still exists internally. The model no longer has to write it. This is the main trade XJSN makes. Complexity moves from generated text into the parser, where it can be implemented once and tested. Calls compose naturally because every argument is itself an XJSN value: ```javascript { "simple": greet("World"), "namespaced": user.create("Alice"), "nested": processData( getData("source"), "transform" ) } ``` The notation does not need separate syntax for pipelines, action nodes, or tagged operations. A domain can express them through the functions it defines. That makes the function call similar to an s-expression. `f(a, b)` and `(f a b)` represent the same tree with different punctuation. XJSN uses the first because models already associate it with ordinary code. ## What XJSN deliberately removes Looking like JavaScript creates a risk: readers may assume it behaves like JavaScript. The safest response is a narrow grammar, not a warning in the documentation. XJSN has no syntax for: - Variable declarations - Assignment - Closures or function definitions - Property mutation - Loops - General branching - Imports - Class or object construction - Arbitrary operators - Access to a JavaScript runtime A call name must resolve to a function declared in the active schema. Its arguments must match the declared signature. Nothing in the document can introduce new behavior. This boundary changes the security model. The runtime does not evaluate a source string or expose a global environment. It receives a parsed tree containing literals, collections, references, and calls selected from a registry. The document describes behavior using an allowed vocabulary. It does not define behavior from first principles. That distinction is what makes the notation useful as an AI-generated intermediate representation rather than another way to ask a model for code. ## Why not [XML](https://developer.mozilla.org/en-US/docs/Web/XML) or a richer configuration language? Before settling on inert calls, I explored a richer external syntax with JSON underneath it. Markup was attractive for three reasons: - It handles nesting and mixed content well. - Models have seen enormous amounts of it. - XML has mature validation systems such as XSD and RELAX NG. The validation ecosystem was especially interesting. A validator that returns only true or false can stop bad output. A validator that reports a precise path, expected type, and invalid value can drive a repair loop: return the errors to the model and ask it to correct the document. But markup solved the parser and validation problem by adding a second representation. The model would write one form, the runtime would consume another, and the system would maintain a translation between them. Richer configuration languages such as Dhall, [EDN](https://github.com/edn-format/edn) with tagged literals, or a [Racket](https://racket-lang.org/)-like DSL offered more expressive syntax. That expressiveness mainly benefits a human author. Models do not need shorthand because they get tired of typing, and they do not need infix syntax to scan a formula quickly. The question that simplified the design was: who is the primary author? If the model writes the document and a person only occasionally reads or edits it, then the notation should optimize first for reliable generation and precise checking. Function calls and JSON values already met that need. More syntax would expand the parser and validator without adding much expressive power. ## The parser converts familiarity into structure Because XJSN is a superset of JSON, a standard JSON parser is not enough. The implementation uses a lexer and parser built with [Chevrotain](https://chevrotain.io/). The parser recognizes ordinary JSON values plus three important additions: - Function calls - Namespaced function names such as `user.create` - References to values supplied by the surrounding runtime Its output is an AST made only of data. A simplified type model looks like this: ```ts type XJSNValue = | null | boolean | number | string | XJSNValue[] | { [key: string]: XJSNValue } | XJSNReference | XJSNCall; type XJSNCall = { kind: "call"; functionName: string; arguments: XJSNValue[]; }; ``` The parser's job is intentionally limited. It answers what the text says, not whether the program is valid for a particular domain. Domain meaning belongs to the schema and validator. This separation allows the syntax to remain fixed while different products define different vocabularies. ## The schema is the actual language XJSN supplies the grammar for calls. A schema supplies the operations those calls may invoke. ```ts const schema = new XJSNSchemaBuilder() .name("Todo DSL") .addFunction("task.create", { name: "create", namespace: "task", description: "Create a new task", arguments: [ { name: "title", type: struct.string() }, { name: "priority", type: struct.string() } ] }) .build(); ``` The schema defines: - The functions available to the model - Their namespaces and names - Their descriptions - Positional or named arguments - The type of each argument - Return types - Any domain-specific constraints Two domains can therefore use identical XJSN syntax while exposing completely different languages. A workflow domain might define: ```javascript { "user": checkUser("alice"), "actions": [ sendEmail("welcome"), createProfile() ] } ``` A game domain might define: ```javascript { "spell": castSpell("fireball"), "effects": [ dealDamage(50), consumeMana(25) ] } ``` The parser sees the same structures in both documents. The schemas assign them different meanings. This makes XJSN a substrate for small declarative languages rather than one large language with every possible operation built in. ## Generate the prompt and validator from one source The schema serves both sides of the model loop. On the generation side, it produces instructions describing the functions the model may use, their purpose, and their argument types. On the validation side, it checks the parsed document against exactly those same definitions. ```ts const result = XJSN.validate(text, schema); // { // valid: false, // errors: [...], // warnings: [...] // } ``` This avoids a common failure mode in generated DSLs: the prompt and the checker slowly diverge. A new function should not require separate edits to prose instructions, [TypeScript](https://www.typescriptlang.org/) types, validation code, and repair logic. With one schema, adding a function updates both what the model is told and what the validator accepts. That closes the generation loop: ```text schema -> prompt -> model output -> parse -> validate ^ | |-------------- repair errors <-------| ``` If validation fails, the system can return a structured error to the model: ```text actions[1]: sendEmail expected 2 arguments but received 1 actions[1].argument[0]: expected EmailAddress, received string "welcome" ``` The error identifies the call, location, and expected signature. The model can repair one part of the document without regenerating the whole structure blindly. Error quality is therefore part of the language interface. A validation failure is an input to the next generation attempt. ## Raise the vocabulary instead of enriching the syntax Once calls are the primitive, most of the design work moves from syntax into function selection. A low-level schema could expose functions such as: ```javascript setColor("blue") setPadding(16) setFontSize(24) ``` A higher-level schema could expose: ```javascript applyHeroStyle("technical", "high-contrast") ``` The second function contains more domain judgment. It reduces the number of decisions the model has to coordinate and gives the runtime a stable place to improve the implementation. [Tailwind](https://tailwindcss.com/) demonstrates a related principle. A constrained vocabulary of reusable style decisions is easier for a model to handle than arbitrary CSS spread across a large program. The useful unit is not always the lowest-level property. It is often a composition the domain has already decided is valid. Every invariant moved into a function definition is one less relationship the model must rediscover in generated text. This does not mean every function should be large. A useful domain vocabulary needs layers: - Small primitives for operations that compose safely - Higher-order functions for common decisions - Namespaces that make the available concepts easy to navigate - Types that prevent invalid combinations The notation stays small while the schema becomes more capable. ## Validation should report domain errors, not syntax accidents Tagged JSON tends to fail at the encoding layer. A missing `$type`, malformed wrapper object, or incorrect nesting prevents the validator from reaching the operation the author intended. In XJSN, the parser owns the encoding. Once parsing succeeds, validation can speak in domain terms: - Unknown function `task.complete` - Missing required argument `taskId` - `priority` must be one of `low`, `normal`, or `high` - `sendEmail` cannot be used in this workflow phase - Return type `User` cannot be placed in a field expecting `Boolean` These errors are useful to both people and models because they describe the attempted program, not the representation used to encode it. The validator can also distinguish errors from warnings. An invalid argument type blocks execution. A deprecated function name or an unusually expensive operation may produce a warning that the model can choose to address. This is where the function registry becomes more than a list of callable names. It can carry effects, capabilities, cost information, deprecation status, and contextual rules. The richer that metadata becomes, the less policy has to be embedded in prompts. ## Execution happens after validation XJSN separates parsing, validation, and interpretation. ```text text -> AST -> validated AST -> interpreter -> registered functions ``` The parser never executes calls. The validator never needs access to the implementation of a function. The interpreter accepts only a tree that has already been checked against the active schema. At runtime, a call node resolves through the registry rather than through JavaScript name lookup: ```ts const fn = registry.resolve(call.functionName); const args = call.arguments.map(argument => interpret(argument)); return fn.invoke(args); ``` The actual implementation may be a local function, an API request, a workflow action, or a constructor for another internal representation. XJSN does not require all calls to execute immediately. A domain can interpret them as plans, UI nodes, game effects, or database queries. This keeps syntax and execution decoupled. The same document can be validated, visualized, transformed, or simulated before a runtime performs any effect. ## Where XJSN fits XJSN belongs to the family of data-oriented language systems rather than general-purpose programming languages. EDN extends data notation with additional literal forms. [Clojure](https://clojure.org/).spec describes the shape of valid data. Racket provides tools for building languages whose programs can be manipulated as data. [Lisp](https://en.wikipedia.org/wiki/S-expression) demonstrates how little syntax is required when calls and lists share one representation. XJSN takes a similar idea and chooses a surface that models already generate well: JSON values plus JavaScript-style calls. It also overlaps with projectional editing. Systems such as JetBrains [MPS](https://www.jetbrains.com/mps/) let users edit program structure directly instead of editing text that is later parsed. XJSN keeps the text interface, but the parser immediately recovers a structural document that tools can inspect and manipulate. The practical difference is adoption cost. A team can define a small schema and use ordinary text generation instead of committing to a specialized IDE or a full language workbench. The parser is not the defensible part of such a system. The value accumulates in domain schemas, high-quality validation, repair loops, editors, visualizers, and runtimes that know how to use the resulting tree. ## Design principles XJSN ended up with a small surface because most of the important choices belong elsewhere. The principles are: 1. Optimize the notation for the system that writes it most often. 2. Reuse syntax the model already generates reliably. 3. Add the smallest primitive missing from JSON. 4. Parse code-shaped text into data; never evaluate it as source code. 5. Put domain expressiveness in a typed function registry. 6. Generate the prompt and validator from the same schema. 7. Return validation errors precise enough to drive repair. 8. Prefer higher-level domain operations over a more expressive general language. 9. Keep parsing, validation, and execution as separate stages. 10. Make every executable operation resolve through an explicit registry. The central idea is straightforward: if a model is best at producing code-shaped structures, give it a code-shaped notation. Then remove declarations, control flow, mutation, and arbitrary execution until what remains is data the system can completely understand. XJSN looks like code because that makes it easier for the model to write. It refuses to behave like code because that makes it possible for the system to trust. --- ## IdyllicValue: deciding what one AI step passes to the next URL: https://www.wcdc.io/writing/idyllicvalue Date: 2025-04-18 Description: Designing documents that people and AI can edit together. ## Motivation [Idyllic](https://idylliclabs.com) was a platform I was designing for people and AI models to work on the same documents. The starting point was the copying and pasting involved in developing a piece of writing through successive chat prompts. Useful material ends up in a document, then comes back into chat when it needs more work. An Idyllic workflow, which I called an *idyll*, would capture those prompts as a reusable procedure. The application would carry the material from one task to the next, so a person could concentrate on the writing without managing all the copying and pasting. One example was a workflow for improving an application to Y Combinator: 1. Use the source documents to write an initial application draft. 2. Critique each answer against YC's guidelines, attaching comments and references to the relevant passages. 3. Revise the draft using those comments, keeping the earlier version available. 4. Run another critique and revision pass. Each task needs material produced earlier. The critique needs the draft; the revision needs both the draft and its comments. In a manually run chat, I can paste those into the next prompt or point back to an earlier response. Automating the procedure means the application has to keep track of those relationships and supply the right material itself. The document is also where the person participates. A critique attached to a paragraph lets me read the feedback beside the writing it concerns. I can edit the draft there and continue working with the model. That makes the relationship between a comment and its passage part of what the application needs to preserve. `IdyllicValue` was the proposed common representation for documents used by these workflows. The design question was what a document needed to support so that a person editing it and a model working on it could refer to the same material. ## Disambiguating "Context" It was tempting to describe the workflow by saying that each step receives the previous step's “context.” But in the application example, that leaves several different questions unanswered: - Does the critique have access to all the source documents, or only the draft? - Does the model receive the whole draft in its prompt, or a reference it can use to read particular sections? - Does the next revision receive every previous response, or just the draft and the comments it needs to act on? These choices affect what the model can do and how much material it has to process. Making a document available does not necessarily mean putting its contents into every model request. A workspace can contain a collection of documents while a particular task reads only one of them. I was using “context” for both, and also for the history of the workflow itself. That was making the design difficult to reason about. More specific names helped separate the questions: | Name | Role in the application workflow | | --- | --- | | `environment` | The documents and functions a step can refer to, such as the draft, the guidelines and a tool for adding comments. | | `resolvedDocument` | The material assembled after following the references in a prompt, such as the draft and guidelines named by the critique. | | `llmRequest` | What is actually sent to the model: instructions and selected material, along with settings and available tools. | | `executionState` | The record of the workflow's progress, including which tasks have run and the results they produced. | The distinction matters when the workflow gets longer. Keeping earlier drafts is useful for inspecting how an application changed. Sending every earlier draft to each new model call is a separate decision, and often unnecessary. The record can retain the full history while a revision request contains only the version being revised and its feedback. This also narrowed the job of `IdyllicValue`. It concerned the documents being worked on. The request sent to a model and the record of the procedure had their own responsibilities. ## Domain-specific documents The application workflow needs behavior particular to applications: a critique should understand the questions being answered and the guidelines being applied. I had been exploring [semantic objects](/writing/semantic-objects) as a way to give different kinds of information their own structure and operations. That approach asked users to define object types with fields and callable JavaScript methods. It was starting to feel like building a content management system. The setup came before the work: to give a model something useful to operate on, you first had to decide what kind of object it was and describe its schema. What I wanted from those types was more specific. The model needed enough organization to understand the material, and users needed a way to define what it could do with that material. A document already offered a familiar way to organize information, including references to other documents. Could the behavior live there too? For the YC application, the draft could remain an ordinary editable document. A custom critique function could use the guidelines and return comments on its answers. Someone preparing the application would work with the writing while that function supplied the domain-specific behavior. The proposal was to focus on the document as the first shared kind of object, with custom functions written in natural language or JavaScript. Different workflows could add behavior without requiring a separate underlying document type for each one. There was still structure to design. A function that comments on an answer must be able to find that answer. Using a familiar document reduced the setup imposed on the user, but it left a precise question for `IdyllicValue`: how should a program refer to a part of it? ## Specification for `IdyllicValue` ### Selecting passages A request such as “critique this answer” has two parts: the instruction and the passage it applies to. Copying the passage into a prompt lets a model read it, but the application still needs to know which part of the original document the response concerns. That suggested operations for selecting parts of a document. I was imagining something like [jQuery](https://jquery.com/) for documents: a way to identify a section and work on it without repeatedly passing around the entire document. The important choice was what a selection meant: - Copied text is sufficient for a summary. - A comment that should appear beside an answer needs a link back to that answer. - An operation that revises the answer needs to identify what it is allowed to change. The interface had to distinguish these uses rather than treating every selection as another piece of text. ### Annotations Annotations made that requirement concrete. In the application workflow, the critique should appear as comments on the draft, with the original writing still available underneath. The revision task could then use both the writing and the feedback. I built an annotation tool in [BlockNote](https://www.blocknotejs.org/), the document editor I was using. It felt like “dancing with AI” because the model could respond inside the material I was working on. I could read a passage and its comment together, without reconciling a separate chat response with the document. For that interaction, the model needs a reliable way to name the passage it is commenting on. BlockNote gives each block an ID, but its full editor representation was bulky: my pitch deck alone occupied about 45KB. Most of that structure was unnecessary for reading the prose. One possibility was a compact Markdown view with markers for the blocks. The model would read the text, choose a marker and call the annotation tool with that target and its comment. The application could use the marker to attach the comment to the corresponding block in the editor. The feedback would remain separate from the passage. Removing a comment should leave the writing intact. A later revision could use the comment as guidance without mistaking it for part of the draft. This is also why a Korean quiz grader seemed like a useful extension. It could attach corrections to my answers using the same annotation operation. The grading instructions would change; the basic interaction of pointing to a passage and commenting on it would already be available. ### Interface and representation These operations gave `IdyllicValue` a more useful specification than a list of properties such as “structured” or “composable.” Being able to read a document as text is one requirement. Being able to point to an answer and attach feedback is another, with consequences for what the document must retain. An interface describes those available operations without requiring every caller to know how the document is stored. That separation mattered because the representation was still an open design question. Choosing a complete document format before trying the operations would commit the rest of the application to assumptions that had not been tested. The starting proposal was deliberately small: wrap an ordinary string in the `IdyllicValue` interface. That would cover simple text input and output. As operations such as annotation became necessary, the value would need to retain block identities and their associated comments too. The internal representation could develop around those requirements. ### The editor boundary BlockNote's format was useful for displaying and editing a document, but that did not automatically make it the right format for every workflow. Its block IDs helped locate annotations; its full representation contained more information than a model needed to read. Keeping `IdyllicValue` separate from the editor left room for different views of the same material. A model could receive compact text with block markers while the person saw the editable document. An adapter would map between those representations, preserving the correspondence between the text the model read and the block the person saw. The design depended on that correspondence. A compact representation would be of little use for annotation if the application could no longer locate the passage named by the model. ### Instructions inside documents Custom functions raised another question: when should text in a document be treated as an instruction? An application draft might quote an instruction as source material. A critique function should be able to examine that quote without obeying it. This becomes a prompt-injection problem when documents can contain executable prompts as well as ordinary writing. The application needs a way to identify the function being invoked and the material that function is supposed to examine. Putting both in the same document does not establish that boundary by itself. Documents with their own behavior were appealing because they could keep useful procedures beside the material those procedures worked on. How to invoke that behavior deliberately, while keeping the rest of the document as material to read, was still an open part of the design. --- ## Idyllic prompt language: executable prompts that still read like prose URL: https://www.wcdc.io/writing/prompt-language Date: 2025-03-16 Description: Adding explicit tool calls and control flow to written instructions. I built the [Idyllic](https://idylliclabs.com) prompt language because long prompts were difficult to reuse and reason about. A prompt could mention tools, data, and several steps, but the text did not define which parts were calls, which context each call received, or how execution should branch. I wanted enough structure to make those choices explicit. I also wanted the result to remain readable by people who already knew how to write instructions in prose. Turning the prompt into a conventional programming language would have defeated that purpose. The result is an executable document. Each paragraph is one statement. Inline markers identify objects and modifiers. Structured blocks handle decisions and events. The document parses into an AST that a tree-walking interpreter executes. ## A paragraph is the unit of execution I began with the smallest rule that gave the runtime a stable boundary: one paragraph expresses one instruction. Paragraphs already separate ideas in ordinary writing. Using them as statements meant writers did not need semicolons or one command per line. The interpreter could execute one complete intent at a time and record its input, output, and changes to context. Within a paragraph, I added two inline constructs: - `@mention` names an object, function, or data source. - `#directive` modifies how the instruction should run. They fit into sentences without reorganizing the prose around code syntax: ```text Compare @sleep with @productivity for last month #briefly. ``` The mentions resolve to typed objects and operations. The directive changes execution metadata. The remaining words stay ordinary instructions for the model. I rejected inline conditionals and expression syntax because they changed the document's center of gravity. Once a paragraph contains nested boolean expressions and braces, the prose becomes decoration around a program. Idyllic uses separate structured blocks only when the execution model requires them. ## Decisions let the model choose a branch Prompts still need branching. Many branches depend on judgment instead of a boolean value: whether a document set is too large, whether a message is urgent, or whether the available evidence is sufficient. I represented those branches as decision cases: ```text decision { case: there are too many documents { Summarize each group before comparing them. } case: the documents fit in context { Compare them directly. } } ``` The runtime sends the case descriptions and current context to the model through a constrained tool call. The model selects one case, and the interpreter executes that body. This differs from an `if` statement in an important way. The runtime does not evaluate `there are too many documents` as an expression. The phrase describes a judgment the model must make from the current situation. The tradeoff is explicit. A parser can verify that the block has cases and valid bodies. It cannot prove that a case is true or that two cases cover every possibility. The model supplies that semantic judgment. ## Calls receive context explicitly Early versions allowed tool calls to see whatever data happened to be present in the session. The same call could behave differently depending on which earlier paragraph had loaded an object. I made dependencies explicit. A function only receives the objects passed to it or loaded into its current scope. These forms therefore resolve to the same operation: ```text @Analyze my @productivity and @sleep from last month. @load("sleep") @load("productivity") @Analyze my productivity and sleep from last month. ``` In the first form, inline mentions provide the dependencies. In the second, prior statements load them into the current scope. The `@Analyze` call receives the resolved sleep and productivity objects in both cases. Event blocks create their own scopes: ```text watch @Telegram.NewMessage { @load the latest messages from @ConversationHistory Draft a reply using the new message and recent conversation. @Telegram.SendMessage the reply. Update @ConversationHistory. } ``` Entering the block adds the triggering event to the scope. Each paragraph can read the event and the values produced by earlier paragraphs in that block. Values outside the scope remain unavailable unless the document loads them. This made context management visible in the document. A reader can see where data entered, which operations used it, and when it left scope. ## The AST is the canonical program Plain text was insufficient once the editor needed to distinguish mentions, calls, decisions, scopes, and prose. I made the AST the stored program and treated the document as its editable view. The node set stayed small: ```text section body prompt statement function-call statement decision watch statement variable expression dynamic expression ``` Each paragraph becomes a statement node. Inline mentions become references or function calls. Decision and watch blocks own nested bodies. Plain prose remains a prompt statement. A recursive tree-walking interpreter executes the nodes in document order. That implementation made control flow easy to inspect and produced an execution trace from the same traversal. Each trace entry points back to the node that ran. The editor also works against the tree. Inserting a mention creates a mention node with an object reference; renaming visible text does not silently change the underlying identity. Moving a paragraph moves one statement node. Structured editing prevents a malformed brace or misspelled directive from becoming a runtime surprise. Models can edit the same representation through structured operations. They add or replace nodes instead of regenerating the entire prompt as text, which preserves parts of the document the model did not intend to change. ## Dynamic expressions resolve against the current scope Some values cannot be fixed when the document is written. They depend on data produced earlier in the same run. Idyllic uses `{...}` for a value the model should derive immediately before executing its containing statement. ```text watch @time(everyday 9am) { Load the tokens in @CoinsILike. Check their current prices on @Coinbase. @Telegram.SendMessage {the five best-performing tokens}. Update @ConversationHistory. } ``` When the interpreter reaches the send call, it resolves the dynamic expression against the current scope. At that point the scope contains the token list and price results. The model returns the value required by the call, and the interpreter passes that value to `SendMessage`. The same syntax can choose an amount based on context: ```text Load {enough recent messages to understand the conversation} from @ConversationHistory. ``` The expression describes a value instead of an instruction sequence. Its containing function still defines the operation: load messages. The model only supplies the argument. This kept dynamic judgment local. The runtime controls which function runs and when. The model fills the value that cannot be determined until execution reaches that point. ## Structured and prose statements can coexist I did not require every paragraph to compile into a fully specified function call. That would force writers to resolve every detail before running a draft. The AST stores two kinds of executable statements: - A structured statement names the function, arguments, and dependencies. The interpreter follows that representation directly. - A prompt statement contains prose. An agent interprets the instruction using the current scope. Writers can begin with prose and convert important paragraphs into structured calls later. The editor uses an agent to propose that conversion because mapping an instruction to the right tool and arguments requires semantic judgment. Once the writer accepts the structured form, future runs use the same operation. This makes predictability local. A stable integration call can be fully structured. An exploratory analysis can remain prose. Both live in the same document and share the same scopes and execution trace. The probabilistic step stays visible. If a prose paragraph is interpreted differently on two runs, the trace shows that it was an agent-interpreted node. A structured call does not quietly fall back to model interpretation. ## The language keeps the runtime small The Idyllic runtime only needs a few responsibilities: 1. Walk the AST in document order. 2. Maintain explicit context scopes. 3. Resolve typed mentions and function calls. 4. Ask the model to select decision cases or fill dynamic values. 5. Interpret the paragraphs that remain prose. 6. Record each node's execution in a trace. The model handles judgments expressed in natural language. The interpreter handles ordering, scope, calls, and state. The document shows which side owns each decision. That boundary was the point of the language. I did not need prompts to become deterministic programs. I needed repeated runs to stop making accidental choices about tool identity, context, order, and control flow. Idyllic adds those choices where the writer wants them and leaves the rest as prose. A prompt can begin as an ordinary document, become more structured as its workflow stabilizes, and remain readable throughout. --- ## Semantic objects: giving models handles instead of data URL: https://www.wcdc.io/writing/semantic-objects Date: 2025-01-25 Description: Claude had my full task list but still missed items when I asked what was due today. I started working on semantic objects after Claude failed a simple task in a todo application. I gave it every task and asked for everything due that day. The answer looked reasonable and omitted several items. The prompt already contained the data. The model understood the request. It still could not reliably perform an exhaustive scan because generation is sampled one token at a time. Asking again could produce a different incomplete subset. I wanted the model to express the selection and let deterministic code execute it. "All todos due today" is a small request regardless of whether the collection contains ten rows or ten thousand. The rows should remain outside the prompt until the model asks for specific contents. I called the resulting reference a semantic object: a typed handle to data that stays where it already lives. ## The model chooses the operation; code processes the collection Pasting a collection into context gives the model two jobs. It has to decide what the user means and apply that decision to every item. Models are good at the first job and unreliable at the second when completeness matters. I split them: 1. The model selects an operation such as "filter by today's date." 2. Application code runs that operation over the full collection. 3. The runtime returns a scalar, a small result, or another handle. This also reduces schema errors. My tool calls had become deeply nested because one request needed to describe the collection, filter, operation, and output shape at once. Models filled those schemas incorrectly once they reached more than a couple of levels. A handle moves the collection and its structure out of the call. The model only supplies the object ID, method, and arguments. A conventional query language solved part of this problem. I began with [GraphQL](https://graphql.org/) because it already expressed deterministic selection and composition. An augmented [SQL](https://en.wikipedia.org/wiki/SQL) could have done the same. I did not need another query syntax yet. Queries still return rows. Returning thousands of filtered rows to the model recreates the context problem one step later. I needed operations to return references as well as values. ## A semantic object describes data the model has not read A semantic object contains enough metadata for the model to decide whether and how to use it: ```text SemanticObject id kind description fields[] name type description methods[] name signature description backing data reference ``` The object does not contain a pasted copy of the collection. Its backing reference points to the application data. The model sees the object's name, type, description, fields, and available methods. Descriptions matter because the model cannot inspect an implementation body. For a method such as `getDateRangeView`, the signature explains the argument shape and the description explains its behavior. Together they are the interface the model programs against. I kept the runtime API small: | Operation | Purpose | |---|---| | `listObjects` | list the handles currently available | | `inspectObject` | return one object's description, fields, and methods | | `lookupTypeInfo` | explain a `kind` shared by many objects | | `invokeMethod` | call a method on an object | | `readObject` | materialize contents when the model actually needs them | Most calls only move metadata. `readObject` is the explicit escape hatch that loads content. `invokeMethod` can return a small value or another semantic object. ## I used `kind` as the type identifier I considered `id`, `ref`, `URI`, and `kind` for the field that identifies an object's type. `id` already names a particular object. `URI` implies a location, while the value identifies a type. `ref` says little about what it references. I chose `kind` because JSON APIs commonly use it for a resource category and it remains distinct from the instance ID. This choice matters more for a model-facing API than for an ordinary library. The model learned each word from many unrelated APIs. Reusing an overloaded term such as `type` adds ambiguity before the model sees any documentation. A familiar, narrower word makes the schema easier to complete correctly. Kinds are namespaced so two applications can define `JournalEntry` without colliding. An object can report a kind such as `so.idyllic.JournalCollection`, and `lookupTypeInfo` returns the shared definition. ## The reference has to survive the prompt boundary The easiest way to fake this design is to resolve an `@` mention into text before sending the prompt. The interface would look correct while the entire collection still entered context. I wrote the prototype around one non-negotiable test: the mention must remain a handle when the request reaches the model. The rest of the acceptance criteria made that observable: - I could add a semantic object through the existing `@`-mention interface. - The prompt contained the object ID and relevant metadata without its full contents. - The model could inspect the object's fields and methods. - The model could invoke one method and chain another call from its result. - Several objects could appear in the same request. - Content only entered context through an explicit read or a method returning content. I tested those capabilities incrementally: an object with metadata only, a filtered view, one method call, a chain of calls, and several objects. Each stage had a visible failure condition. I could inspect the actual prompt and verify that no hidden expansion had occurred. ## Methods can return new handles The working prototype used about 700 journal entries from a corpus of roughly 2,500. Claude began by inspecting the collection: ```text Tool call: inspectObject { "objId": "journal-collection" } Tool result: Journal Collection (so.idyllic.JournalCollection) A collection of journal entries Fields: - title - content - date Methods: - getDayCount() -> number - getEntriesForDay(date: YYYY-MM-DD) -> JournalEntry[] - getTotalEntryCount() -> number - getDateRangeView(startDate, endDate) -> JournalCollection ``` The important method was `getDateRangeView`. It filtered the backing collection and returned another handle: ```text Tool call: invokeMethod { "objId": "journal-collection", "methodName": "getDateRangeView", "args": { "startDate": "2024-04-01", "endDate": "2024-04-30" } } Tool result: New semantic object: 4f6b305b-3f7c-472a-9ac6-bc63b3045c8c Journal entries from 2024-04-01 to 2024-04-30 Tool call: invokeMethod { "objId": "4f6b305b-3f7c-472a-9ac6-bc63b3045c8c", "methodName": "getDayCount", "args": {} } Tool result: 28 ``` Claude narrowed the collection and counted the matching days without reading the entries. The filtered view behaved like the original collection because both implemented the same kind and methods. Returning handles is what makes operations composable. A method that returns contents ends the lazy chain and spends context. A method that returns another semantic object lets the model narrow, join, or transform again before deciding what to read. ## The prototype exposed errors in the metadata The first successful run also found inconsistencies in the design. The implementation called the inspection operation `analyzeObject` while the draft API called it `inspectObject`. The object returned `so.idyllic.JournalCollection` while the proposed naming scheme included an extra `prototype#` segment. A filtered April view inherited a parent description that said April through June. The method calls still worked, but the metadata was part of the model-facing API and had to be correct. I standardized the operation name, simplified the kind format, and regenerated descriptions for derived objects from their actual filters. That last bug was especially useful. A stale description can mislead the model even when the underlying object contains the right data. Semantic objects defer the data, so their metadata carries more responsibility than ordinary labels. ## Semantic objects make retrieval programmable Conventional retrieval chooses passages with a similarity search configured before the model begins reasoning. It returns the selected text to the prompt. A semantic object lets the model choose operations during the task. It can inspect a collection, take a date range, narrow it again, count the result, and only then read specific entries. Deterministic code performs each collection operation, while the model decides which operation answers the user's question. I kept the object machinery minimal after the prototype. A semantic object does not need a class hierarchy, decorators, or an internal event system. It needs an ID, useful metadata, a backing data reference, and a set of operations. Specialized classes only help when an application has behavior that requires them. The result is a simple division of work. The model reasons about names, types, and operations. The runtime performs exhaustive scans and retains large intermediate collections. Data enters context only when the model requests it. That is the problem semantic objects solved for me: Claude could work with a collection much larger than its prompt without pretending it had read every row. --- ## #AGIYOURSELF: from daily automations to a prompt codebase URL: https://www.wcdc.io/writing/agiyourself Date: 2024-07-18 Description: An attempt to build one automation a day for ninety days. #AGIYOURSELF began as a challenge to build one AI automation every day for ninety days. I wanted to discover the common infrastructure behind personal AI systems by shipping concrete examples instead of designing a framework in advance. The first season failed because an automation was too large and brittle to produce daily. Each one took hours, depended on a specific tool and trigger, and became wrong when the surrounding process changed. The second season changed the daily unit from an automation to a prompt. That change made the cadence sustainable. A prompt took minutes to write, could be revised without rebuilding its execution path, and stored the reasoning that made an automation useful. I then built a codebase around prompt files, reusable components, rationales, and evaluations. ## The first automation was only a capture pipe I began with the simplest useful path I could build: ```text Telegram message → n8n workflow → Redis → daily Notion page ``` I could send a thought to a Telegram bot and append it to that day's record. The workflow did not classify or summarize the message. I did not know yet which later operations would matter, so I kept the captured data as chronological text. That pipe outlasted most of the automations built around it. It produced a personal corpus before I knew exactly how I would use one. Months later, those journal entries became the real examples I used to evaluate prompts. The implementation moved between storage systems as the project grew. The durable decision was simpler than any database choice: capture first, preserve the original text, and add structure only when a concrete operation needs it. ## Unattended automations failed expensively On the second day, I built a workflow to process email. It had no effective error path and retried failed steps inside a loop: ```text 100 emails about 6,000 model calls $80 in the first two hours $400 before the active run was stopped ``` Turning the workflow off prevented new runs. It did not kill the run already in flight. I had treated an editor toggle as an emergency stop. After that incident, every unattended workflow needed three explicit limits: - a maximum number of iterations or items - a measured budget for model calls and tokens - a kill mechanism that reaches an active run I also tested loops with cheap models and small input sets before connecting them to paid APIs. An error handler that only records a failure is insufficient if the surrounding loop continues to spend money. This incident exposed a broader cost of the daily unit. A prompt can produce a bad answer and stop. An automation combines model behavior with triggers, retries, state, external services, and money. Shipping one safely requires much more than writing the model instruction. ## One automation a day did not compound About a month into the challenge, the cadence slipped. Each new automation solved a separate task and reused little from the previous day. An automation captured too many assumptions at once: - which application held the data - the shape of that application's API - the event that should trigger the workflow - the steps I currently believed were useful - the failure and retry behavior When one assumption changed, the automation often required a rebuild. It continued running perfectly in the meantime, including when the underlying task no longer mattered. The retrospective contained the clearest comparison: ```text 90 automations in 90 days too hard to sustain no repeatable process for creating them fragile system 90 automations < 1 automation with 90 refinements ``` The challenge also lacked a way for its outputs to improve the production process. I could not use one n8n graph to generate or revise the next graph reliably. Visual workflows were fast to start and became difficult to manage as branches, implicit state, and retries accumulated. The problem was the artifact I had chosen to produce. I needed something cheap enough to create speculatively, small enough to revise, and structured enough for the system to manipulate. ## I kept human judgment outside the scheduled workflow Many personal tasks vary at the point where judgment matters. I may want a journal summary today and a comparison with last month tomorrow. Scheduling either operation permanently requires me to decide in advance which interpretation will remain useful. A prompt leaves that decision with me. I choose when to run it and what context to provide. Code handles the repeatable mechanics: loading data, rendering the template, calling the model, and storing the result. Some prompts later become unattended components. I promote one when its trigger and expected output have become predictable through repeated manual use. The prompt text can stay the same; scheduling is a separate layer. This let me discover a workflow before automating it. I could run a prompt manually, revise it several times, and see where it failed without first building a listener, queue, retry policy, and deployment path. ## The second season produced prompts and improvements to the prompt system I restarted #AGIYOURSELF with prompts as the daily unit. Three kinds of work counted: - write a new prompt - improve an existing prompt - improve the process or tooling used to create prompts The third category created the compounding effect missing from the first season. A better macro, evaluator, or prompt loader improved every later artifact. Refining an existing prompt also preserved the value of earlier work instead of adding another disconnected workflow. A prompt took minutes to create, so I did not need proof that it deserved an evening of engineering. Most experiments could fail cheaply. Useful prompts accumulated revisions instead of being replaced by another automation with slightly different assumptions. ## Prompts became files with their own history I moved prompt text out of [Python](https://www.python.org/) functions and into a dedicated repository. This separated the text sent to the model from the code that executes it: ```text promptbase/ prompt composition extract-info.j2 analyze-convo.j2 library.lib.j2 journal/ compare.j2 extract-ideas.j2 agiyourself/ execution cli.py promptfile.py chat.py journal.py ``` The files under `promptbase` contain wording, interpolation, control flow, and reusable prompt components. The Python package loads context, renders templates, calls models, and writes outputs. Prompt text does not live in the execution code. Each prompt uses frontmatter and a [Jinja2](https://jinja.palletsprojects.com/) body: ```jinja --- name: extract-info tags: - utility --- Extract the following information from the input: {% for key in keys %} - {{ key.name }}: {{ key.description }} {% endfor %} Input: {{ INPUT() }} ``` Making the prompt a file gave it a Git history, focused diffs, review, and reverts. I could change the wording without reading the Python around it, and an evaluator could identify the exact prompt version that produced an output. ## Jinja macros made prompt improvements reusable Plain template substitution would still leave repeated prompting patterns scattered across files. I chose Jinja because it supports imports, macros, control flow, and template inheritance. Shared instructions became functions in `library.lib.j2`: ```jinja {% macro role_prompt(role, expertise, task) -%} Assume the role of a {{ role }} with expertise in {{ expertise }}. Your task is to {{ task }}. Approach the task using the knowledge and methods of that role. {%- endmacro %} ``` Prompts call the macro instead of copying its text. Improving the shared instruction changes every prompt that imports it. The same pattern works for structured output, explicit reasoning steps, and common context blocks. This was the reuse I had expected from the automation challenge. The reusable parts were usually prompt structures and execution utilities, not whole workflows. ## I stored the reason for each prompt beside its wording The prompt text records what to send the model. It often does not preserve why I created it, when I expected to use it, or what a good result looked like. I stored that information beside the template: ```text prompts/summarize-journal-entry/ prompt.jinja2 rationale.md ``` The rationale records: - the situation that triggered the prompt - the result I wanted - relevant background and constraints - examples used to evaluate it - changes made after earlier runs This context became more valuable than the original wording. I could usually rewrite a prompt quickly. Reconstructing the situation that made it useful was much harder after several weeks. The rationale also made improvement easier. When an output looked wrong, I could compare it with the intended use instead of editing toward whichever result sounded better in the moment. ## Prompt evaluation needs scores and real personal data Software tests usually return pass or fail. Prompt outputs rarely have one exact correct answer. Two journal summaries can both be valid while one preserves more important details or follows the requested structure better. I evaluated prompts on several dimensions and returned a score for each: ```text test summarize(entry) == expected → pass or fail evaluation score(summarize(entry), dimensions=[coverage, specificity, structure]) → 0.0 to 1.0 per dimension ``` Scores let me compare prompt versions and see whether an edit improved one dimension while damaging another. I used my own journal as the evaluation set. Public benchmarks could measure generic summarization, while these prompts were supposed to work on my entries, habits, omissions, and writing style. Several months of captured data gave me examples drawn from the distribution the system would actually encounter. I preserved the human-authored journal as the source. Model output could be stored as separate annotations, summaries, or metadata. Replacing the original entry with generated prose would contaminate later evaluations with the style and assumptions of earlier model runs. The capture pipe from the first days of the project therefore became part of the prompt-development system. It supplied real inputs, while Git supplied prompt versions and rationales supplied the intended behavior. ## The prompt codebase was the infrastructure I had been looking for The first season tried to discover common infrastructure by accumulating complete automations. The artifacts shared too little and cost too much to refine. The second season moved the reusable intelligence into smaller pieces. Prompt files stored instructions. Macros stored common patterns. Rationales stored the situations and constraints behind them. Evaluations measured changes against real personal data. The execution engine handled rendering and model calls. This structure still supported automation. A prompt that proved useful in repeated manual runs could be connected to a trigger later. By then I had evidence about its inputs, outputs, and failure modes. #AGIYOURSELF began as ninety attempts to automate my life. It became a way to build and evaluate the model-facing components before committing them to unattended workflows. Changing the daily unit made that possible: prompts were cheap enough to explore and structured enough to improve each other. --- ## CWScript: a contract language that compiles to Rust URL: https://www.wcdc.io/writing/cwscript Date: 2024-01-15 Description: Language design for CosmWasm contracts. CWScript is a language I designed for [CosmWasm](https://cosmwasm.com/) smart contracts. The source reads in terms of contracts, state, messages, permissions, transfers, and events, then compiles into a normal [Rust](https://www.rust-lang.org/) crate. The hard part was not inventing cleaner syntax. It was deciding what the language should understand, what Rust should still be responsible for, and how to translate between the two without turning CWScript into thin shorthand for Rust. This is how I approached those decisions, from the grammar through to the generated crate. ## Start with the right abstraction A CosmWasm contract is a Rust crate compiled to [WebAssembly](https://webassembly.org/). Rust is a strong implementation language for that job, but its primitives are not the primitives of a contract. A token transfer is conceptually simple: validate a recipient, debit one balance, credit another, and emit an event. In Rust, the same operation also involves storage handles, serialization, closures around map updates, error types, and the context objects passed in by CosmWasm. Those details are necessary at the platform boundary. They are not the contract's business logic. That distinction motivated CWScript. I wanted the source language to operate at the level at which developers reason about contracts, while still producing ordinary CosmWasm code underneath. The design method was subtraction. Start with the expressive power of Rust, then keep only the operations that make sense inside a smart contract. A new construct had to do one of two things: name a real CosmWasm concept, or make a useful restriction enforceable. The second part matters. A restricted language is only worthwhile if the restriction buys something back: clearer behavior, safer state access, stronger validation, or code that is easier to audit. CWScript also had to respect CosmWasm rather than hide it behind a new runtime. The generated output would use the same messages, storage libraries, module structure, and entry points as a hand-written contract. Developers could inspect the Rust, test it with the existing toolchain, and use the rest of the ecosystem normally. That made CWScript less like a replacement for Rust and more like a contract-level frontend for it. ## Why build a language instead of a macro? The cheaper route was a Rust procedural macro. Most of CWScript's surface could have been embedded in Rust, and prior work such as [ink!](https://use.ink/) showed how far that approach could go. Macros have a major advantage: interoperability is automatic. The macro can use Rust's parser, type system, libraries, compiler, and editor tooling. There is far less infrastructure to build. But a macro can add syntax without truly taking syntax away. Even if it validates everything inside one annotated module, ordinary Rust remains available around the boundary. That makes it difficult to state that a certain operation is impossible rather than merely discouraged. CWScript was built around subtraction. If queries should never mutate state, or if state may only be changed through approved transitions, those rules need to apply to the whole source program. A separate language gives the compiler control over the complete set of valid operations. I considered several other starting points: | Approach | What it offered | Main tradeoff | | --- | --- | --- | | Rust procedural macros | Rust interoperability and much less compiler work | The Rust abstraction remains reachable and can leak through | | [Lisp or Racket](https://racket-lang.org/) | Source code that already resembles an AST | The syntax is unfamiliar to much of the intended audience | | [LLVM IR](https://llvm.org/docs/LangRef.html) | A mature, proven intermediate representation | It operates far below the level of contracts and state | | [Langium](https://langium.org/) | A generated parser, semantic model, [language server](https://microsoft.github.io/language-server-protocol/), and editor tooling | The compiler has to follow Langium's document and service architecture | | [Z3](https://github.com/Z3Prover/z3) or symbolic execution | A path toward formal verification | Verification still depends on first defining precise language semantics | The question was not which technology was most powerful. It was which layer should own the restrictions. Once I decided that CWScript itself had to own them, a compiler became the natural shape of the project. ## Define the prototype with existing contracts A new language should not begin by proving that it can express a clever new feature. It should first prove that it can express ordinary programs in its domain. My initial target was to translate four existing CosmWasm contracts: [CW20](https://github.com/CosmWasm/cw-plus/tree/main/packages/cw20), [CW721](https://github.com/CosmWasm/cw-nfts), [Terraswap](https://github.com/terraswap/terraswap), and [Mirror](https://github.com/Mirror-Protocol/mirror-contracts). Alongside them, the prototype needed a formal grammar, documentation, syntax highlighting, and the beginning of a language server. That benchmark served two purposes. First, it kept the language tied to real contracts. A syntax decision that looked elegant in a counter example might become awkward in a token contract with allowances, submessages, replies, and multiple storage maps. Second, it exposed the recurring translations that should shape the compiler. If several contracts lower the same source operation into the same Rust pattern, that pattern probably belongs in the intermediate representation or runtime model. The compiler architecture evolved into this pipeline: ``` source -> AST -> validation -> validated AST -> codegen IR -> Rust crate | -> diagnostics ``` Each stage has a distinct job: - The parser decides whether the source is valid CWScript and produces the AST. - Validation resolves names, checks types, and enforces contract-specific restrictions. - The code-generation IR converts general syntax into explicit CosmWasm operations. - The backend renders those operations as a Rust crate. Keeping those responsibilities separate became one of the most important architectural decisions in the project. ## Designing a surface that is familiar but unmistakable CWScript had to satisfy two competing goals. It needed to look familiar enough that a [TypeScript](https://www.typescriptlang.org/) or Rust developer could learn it quickly. But it also needed to look different enough that nobody would assume Rust or TypeScript semantics where CWScript behaved differently. [AssemblyScript](https://www.assemblyscript.org/) illustrates the risk of looking too familiar: the code resembles TypeScript closely enough that developers bring TypeScript assumptions with them. The differences become traps instead of visible design choices. I kept CWScript closer to TypeScript than Rust, but concentrated its distinctiveness in a few small markers: - `$` marks ambient contract context, such as `$state`, `$info`, and `$env`. - `#` marks messages and entry-point names. - `!` marks fallible or effectful forms. - `@` introduces annotations. The syntax is recognizable at a glance without requiring a separate grammar for every contract concept. A developer learns four markers, then reads mostly familiar expressions, blocks, functions, and types. These markers are lexical, not decorative. The lexer produces different tokens for a local name, a `$` context name, and a `#` message name. The parser and later compiler passes therefore know the distinction before name resolution begins. That makes the syntax carry semantic information at very little cost. ## Entry points are typed functions CosmWasm contracts expose instantiate, execute, and query entry points. Within those entry points, message variants are usually dispatched to handler functions. CWScript could have modeled every handler as a completely separate declaration. Instead, I treated handlers as functions with a contract-specific type. The grammar reflects that relationship: ``` fnDefn: (doc)? (exported = EXPORT)? FN (name) (fallible = BANG)? (typeParams)? (params) (ARROW returnTy)? (body) execDefn: (doc)? EXEC (name) (fallible = BANG)? (params) (ARROW returnTy)? (body) queryDefn: (doc)? QUERY (name) (fallible = BANG)? (params) (ARROW returnTy)? (body) ``` `exec` and `query` are not merely labels. They determine the function's available context and legal effects, much as `async` changes the type and behavior of a JavaScript function. An execute handler can receive mutable storage and sender information. A query receives read-only storage and no sender. A fallible handler uses the `!` marker, allowing the compiler to generate the appropriate Rust result type and error propagation. Here is a transfer handler: ``` exec #transfer(recipient: String, amount: U128) { if amount == 0 { fail! InvalidZeroAmount(); } let rcpt_addr = Addr.validate!(recipient); $state.balances[$info.sender] -= amount; $state.balances[rcpt_addr] += amount; emit Transfer($info.sender, rcpt_addr, amount); } ``` The source contains the complete business operation. It validates the amount and recipient, changes two balances, and emits an event. Storage loading, serialization, map-update closures, response construction, and Rust error plumbing belong to the compiler. This is the central trade CWScript makes: the source becomes more specific to contracts, while the generated code becomes more explicit about the platform. ## Treat cross-contract calls as first-class operations Calls between contracts are another place where the conceptual operation is much smaller than its Rust representation. A CosmWasm submessage may need a message payload, target contract, funds, gas limit, reply policy, numeric reply ID, and a handler that decodes the response. In Rust, those concerns are spread across several constructors and a separate reply entry point. CWScript puts the call in one statement: ``` @gas_limit(5000000) @reply.on_success(post_instantiate) instantiate! #TerraswapPair( asset_infos, $state.config.token_code_id, asset_decimals ) { code_id: $state.config.pair_code_id, admin: $env.contract.address, label: "pair" } ``` The statement says what is being instantiated and with which values. The annotations carry operational policy: cap the gas and call `post_instantiate` after a successful reply. This separation keeps the main operation readable without pretending the metadata does not exist. It also gives the compiler structured information from which it can generate message constructors, reply IDs, dispatch code, and handler registration. The same principle applies to `emit`, `exec`, and `fail`: operations that are library calls in Rust become first-class forms when the compiler needs to reason about them. ## Separate omitted arguments from nullable values Rust's `Option` often represents two different facts: - The caller may omit an argument. - The argument is present, but its value may be absent. When both are true, Rust uses `Option>`. The type is correct, but the source no longer makes the distinction easy to read. CWScript puts the two facts in different positions: ``` hello?: str // the argument may be omitted hello: str? // the value may be null bye?: str? // the argument may be omitted and its value may be null ``` The parameter name describes call-site behavior. The type describes the value. This distinction has consequences for the type system. A nullable value cannot be used as its underlying type until the program discharges the null case. The language therefore needs explicit rules for narrowing, defaulting, and propagation. For example: ``` #instantiate(count: U32?, owner: Addr?) { if count? { // count is U32 inside this block } $state.count = count ?? 0; $state.owner = owner ?? $info.sender; } ``` The design question is not only which operator looks best. The compiler has to define how each construct changes the type of a binding, whether the right side of `??` is evaluated lazily, and how optional values cross the Rust boundary. This is a good example of why syntax cannot be designed in isolation. A two-character operator implies rules in the parser, type checker, intermediate representation, and Rust generator. ## State syntax determines the semantic model State is the center of a smart contract language. The surface notation has to balance three goals: - Direct reads and writes should be concise. - The compiler must know which expressions touch persistent storage. - More complex updates must remain atomic and auditable. The simplest syntax treats a map like an ordinary collection: ``` $state.balances[owner] -= amount; ``` That is easy to read, but its Rust translation is not an ordinary index assignment. It may require loading a value from storage, applying checked arithmetic, handling a missing key, and saving the result. For updates with more logic, a closure can make the storage transaction explicit: ``` $state.allowances[[$info.sender, spender_addr]].update( |allow| { // validate and return the new allowance } ); ``` These forms do not have to be competing spellings. They can be two levels of one model: - Compound assignment is syntax sugar for a standard read-modify-write operation. - `update` exposes the operation when validation, deletion, or custom error handling is needed. The compiler can normalize both into the same internal state transition before generating Rust. This normalization point is important. Surface syntax should optimize for the author. The IR should optimize for precise meaning. The Rust backend should optimize for correct and regular output. It also creates a place to enforce stronger state rules. A contract could declare permitted transitions beside a state field, then validation could reject handler code that attempts any other mutation. For example, a counter might allow changes only by one and only when the sender is the owner. The useful guarantee is not that developers usually update state safely. It is that every state write in the program passes through a small set of operations the compiler understands. ## The grammar is the inventory of the language Because CWScript is defined partly by what it removes, its grammar is more than a parser specification. It is the complete inventory of operations a contract may express. The statement rule contains seventeen alternatives: ``` stmt: importStmt | exportStmt | defn | letStmt | constStmt | assignStmt | memberAssignStmt | indexAssignStmt | ifStmt | tryCatchElseStmt | forStmt | execStmt | instantiateStmt | emitStmt | failStmt | returnStmt | exprStmt; ``` Several entries would be ordinary calls in Rust. Giving them dedicated productions lets the parser restrict where they appear and gives the AST an exact node type for each one. For example, `emit` can be restricted to an execute context. `instantiate!` can require a reply policy when its return value is used. `fail!` can mark a control-flow edge as terminating. A general function-call node would force later passes to rediscover all of that from names and conventions. There is a cost. A richer AST means more node types, visitors, formatting rules, diagnostics, and code-generation cases. The grammar should therefore make a construct first-class only when the compiler needs first-class knowledge of it. That rule prevents a domain-specific language from becoming a collection of arbitrary syntax preferences. ## Choosing the parser and AST architecture I explored [Lark](https://github.com/lark-parser/lark), [ANTLR](https://www.antlr.org/), [Chevrotain](https://chevrotain.io/), and Langium while building the front end. The choice was not mainly about parsing speed. Each tool implied a different relationship between the grammar, AST, semantic model, and editor. ANTLR provides a mature parser ecosystem and a clear separation between the grammar and a hand-built AST. That gives the compiler full control over the tree, but every grammar change has to be reflected in AST construction and visitors. Chevrotain puts the grammar in TypeScript and offers tight control over parsing. Translating the grammar into a second framework also acts as a useful test: ambiguities that one parser resolves implicitly often become visible when another requires the choice to be explicit. Langium takes a more integrated approach. The grammar defines a semantic model, cross-references, and enough structure to generate a language server and VS Code extension. The AST is not merely a parse result; it participates in a document lifecycle with linking, validation, and diagnostics. The architectural lesson was to avoid maintaining two versions of the same tree. If the framework's semantic model already represents the program the compiler needs, deriving a second "official" AST creates synchronization work without adding information. A single canonical model lets the parser, language server, validator, and compiler agree on node identity and source locations. It also improves diagnostics because every later pass can report errors against the same document objects the editor already knows. ## Validation is where the language becomes more than syntax A parser can tell that this is a correctly shaped assignment: ``` $state.count += 1; ``` It cannot tell whether `count` exists, what type it has, whether the current handler may modify it, or which Rust storage primitive represents it. Those questions require semantic analysis. The first building block is a symbol table: a map from each name in the source to the declaration it refers to. Contracts introduce namespaces for state fields, messages, errors, events, functions, imports, and inherited members. Function bodies add parameters and locals. `$state.count` should resolve to a state declaration, while a bare `count` may resolve to a local binding. Once names resolve, validation can enforce contract-specific rules: - A query cannot access sender information or mutable storage. - An execute handler may emit events and submessages; a pure function may not. - A state update must match the field's declared type and transition rules. - A message name must refer to a declared or imported message type. - A fallible call must be propagated, handled, or used inside a fallible handler. - An omitted argument and a nullable value must be checked independently. This is also where the strongest version of CWScript becomes possible. If state may only be changed through operations represented in the validated AST, then permissions and invariants can be attached to those operations. For example, imagine a state declaration that says `count` may only change by one and only when `$info.sender == owner`. The validator can check every assignment that resolves to that state field. The rule becomes a property of the language, not a comment authors are expected to follow. The type system does not need to begin with formal proof. It needs to begin with enough information to resolve names, distinguish persistent state from locals, classify effects, and lower each expression unambiguously. Stronger analysis can build on that foundation. ## Work backward from valid Rust Designing the intermediate representation in the abstract produced too many plausible options: a stack machine, a Lisp-like IR, monadic operations, or a runtime with emitted instructions. The more useful method was to start with the Rust. For each small CWScript program, write the canonical Rust output by hand and make sure it compiles. Then compare several translations and extract the operations that recur. Those operations become the code-generation IR. The loop looks like this: 1. Choose the smallest contract that introduces one new behavior. 2. Write its desired Rust output. 3. Compile and test that Rust. 4. Identify the mapping from source constructs to Rust constructs. 5. Add the smallest IR operation that captures the mapping. 6. Generate the Rust and lock it in as a fixture. This approach answers design questions with evidence. If three state assignments all lower to load, transform, and save, the IR probably needs a state-update operation. If execute and query handlers share most of their output, they should probably share one handler representation with different capabilities. It also prevents the IR from becoming a second general-purpose language. CWScript's IR does not need to represent every possible computation. It needs to represent the small set of decisions required to generate correct CosmWasm Rust. ## The IR should move toward the domain, not the machine Traditional compiler IRs lower source code toward machine primitives. LLVM IR is intentionally close to a platform-independent assembly language. CWScript targets Rust, so lowering all the way to machine-like operations would throw away the information the backend needs most. The useful direction is the opposite: convert general syntax into explicit contract operations. Consider: ``` $state.balances[$info.sender] -= amount; ``` The AST sees an index expression and a compound assignment. The code-generation IR can see something more specific: ``` StateMapUpdate { map: balances, key: InfoSender, operation: CheckedSub(amount) } ``` That representation tells the backend that it needs a storage map, a sender-derived key, checked arithmetic, error propagation, and a save. It also gives validators and other tools a meaningful operation to inspect. The same idea applies to cross-contract calls, replies, emitted events, and query responses. The IR should preserve domain meaning until the last responsible moment. ## Choose canonical Rust for generation, not imitation One CWScript construct can often be rendered as several equally valid Rust programs. The backend needs a consistent answer. There are two possible goals: 1. Generate Rust that resembles what a human would write by hand. 2. Generate a regular form that is easy to emit, verify, and test. I chose the second. Generated code is an implementation artifact. The source language should carry the readability. Regular Rust makes the backend smaller and produces stable fixtures that are easy to compare. This affects module layout as well. Instead of reproducing whatever hierarchy a human might choose, the generator can flatten contract types into a predictable namespace and track their fully qualified Rust paths internally. Message types, error types, state handles, and handler functions all have deterministic names. The backend then becomes a set of explicit mappings rather than a formatter trying to imitate human taste. ## Generating the CosmWasm crate The crate generator divides naturally into two parts: 1. Generate the contract interface from declarations. 2. Generate handler bodies from validated operations. Declarations provide enough information to build much of the crate mechanically: - A `state` block becomes [`cw_storage_plus`](https://docs.rs/cw-storage-plus) items and maps. - Error declarations become variants of a [`thiserror`](https://docs.rs/thiserror) enum, along with the host `StdError` conversion. - `exec` handlers become variants of `ExecuteMsg`. - `query` handlers become variants of `QueryMsg` and typed response wrappers. - Handler declarations become implementation functions and dispatch arms. - Contract annotations become entry-point and schema metadata. The source keyword also determines the context type passed to the generated handler: ```rust pub struct ExecuteCtx<'a> { pub deps: DepsMut<'a>, pub env: Env, pub info: MessageInfo, } pub struct QueryCtx<'a> { pub deps: Deps<'a>, pub env: Env, } ``` This is a clean example of using Rust's type system as the final enforcement layer. The CWScript validator can reject a write in a query and produce a source-level diagnostic. If an invalid write somehow reaches the backend, Rust still refuses it because `QueryCtx` contains `Deps`, not `DepsMut`. The source language and target language enforce the same rule at different layers. ## Lowering state updates to Rust The basic state translation is load, modify, save. CWScript: ``` exec #increment() { $state.count += 1; } ``` Canonical Rust: ```rust pub fn exec_increment_impl(ctx: ExecuteCtx) -> Result { let mut count: u32 = COUNT.load(ctx.deps.storage)?; count += 1; COUNT.save(ctx.deps.storage, &count)?; Ok(Response::new()) } ``` The source expresses a state transition. The generated code makes persistence and fallibility explicit. This translation raises several decisions that belong in the validated model or IR: - Is the storage value guaranteed to exist, or should the backend use `may_load`? - Is arithmetic checked, saturating, or wrapping? - Does a missing map entry imply a default value? - Can multiple reads and writes be combined into one `Map::update` closure? - When should a value be cached locally across several operations? - Which errors are converted into `ContractError`? These are not formatting choices. They define the semantics of the source language. The safest way to settle them is to choose one canonical rule for each source operation, encode it in the IR, and test the generated Rust against representative contracts. ## Types must cross the boundary explicitly Type generation looks mechanical until modules and foreign libraries enter the picture. A source type may refer to: - A built-in scalar such as `U128` - A contract-local struct or enum - A type imported from another CWScript module - A Rust type exposed through the standard library or FFI - A message type generated from a handler declaration - A storage wrapper that exists only in generated Rust The compiler needs a resolved type model before code generation begins. Each source type should carry its identity and Rust path, not just its source text. That allows the backend to answer practical questions consistently: - Should `U128` become [`cosmwasm_std::Uint128`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.Uint128.html) or a generated alias? - Which types need [`#[cw_serde]`](https://docs.rs/cosmwasm-schema/latest/cosmwasm_schema/attr.cw_serde.html)? - Where do generic arguments need explicit Rust paths? - Which imported names must be re-exported? - How are optional and omitted values represented in message structs? This is one reason to keep type resolution out of string templates. By the time the backend renders Rust, the choice should already have been made. ## Modules and the standard library force the design to become real A single generated crate can avoid many difficult language questions. Modules cannot. Imports, exports, inheritance, interfaces, and foreign functions require stable identities across files. The grammar can recognize an import or `extends` clause, but the semantic model has to resolve it to a specific declaration and the backend has to decide where that declaration lives in Rust. CWScript's contract syntax anticipated composition: ``` export contract TerraswapToken extends Cw20Base { // contract-specific state and handlers } ``` Supporting this cleanly requires answers to several questions: - Does inheritance copy handlers, delegate to them, or compose generated modules? - Can a derived contract replace state expected by a base contract? - How are message enums extended without breaking schema compatibility? - What is the fully qualified identity of an imported contract or type? - Which pieces become Rust modules, traits, or ordinary functions? The standard library is an especially useful forcing case. If the library is written in Rust but called from CWScript, every function crossing the boundary needs a source name, CWScript type, Rust path, effect classification, and error behavior. Building a small standard library early is therefore more valuable than designing a general FFI in the abstract. A few real functions force the calling convention, type mapping, module resolution, and documentation format to become concrete. ## The larger opportunity: a representation of CosmWasm The language was one part of a broader idea. CosmWasm contracts already share a high-level structure, but most tools interact with either Rust source or compiled WebAssembly. If that structure is represented explicitly, CWScript does not have to be the only frontend. The same validated model could support: - Alternative contract languages - Generated client SDKs - Documentation and schema tools - Static analysis and security checks - Visual contract explorers - Migration and compatibility tooling - Testing utilities that operate on contract semantics rather than source text The compiler pipeline then becomes more than source-to-source translation. It becomes a stable representation of what a CosmWasm contract is. This is why the AST and IR boundaries matter so much. A Rust-specific AST limits every downstream tool to Rust. A machine-level IR discards the contract concepts those tools need. The useful representation sits between them: resolved, typed, and contract-aware, but independent of how one backend renders it. ## What the design process taught me The hardest decisions in a domain-specific language are not about punctuation. They are about where meaning lives. Does `exec` merely generate a function name, or does it define an effectful function type? Is `$state.balances[key] -= amount` ordinary assignment syntax, or a persistent state transition with checked arithmetic? Is a submessage a library call, or a first-class operation the compiler can validate and inspect? CWScript became clearer whenever I answered those questions in terms of semantics first and rendering second. The practical design principles are straightforward: - Start with real contracts, not isolated syntax examples. - Define the restriction each first-class construct makes enforceable. - Keep one canonical semantic model across the parser, editor, and compiler. - Resolve names, types, and effects before generating strings. - Derive the IR by working backward from valid, tested Rust. - Preserve contract meaning in the IR instead of lowering too early. - Generate regular Rust rather than trying to imitate human style. - Build modules and a small standard library early, because boundaries expose vague design. The central idea behind CWScript is simple: a smart contract language should let the author write the contract while the compiler writes the platform integration. Making that work requires more than concise syntax. The grammar, type system, validation rules, intermediate representation, and Rust backend all have to agree on what each contract operation means. Once they do, the compiler can remove a large amount of incidental complexity without hiding the behavior that matters. --- ## Cognitive Blocks: composing one agent from many URL: https://www.wcdc.io/writing/cognitive-blocks Date: 2023-11-20 Description: An early experiment with a book-writing pipeline. I designed a small set of primitives for AI work that takes longer than one conversation. Cognitive Blocks let me define specialized agents, connect them into a process, and treat the whole process as another block. I tested the design by building a pipeline that could plan and draft a short book. ## The work no longer fit in one conversation Most language-model interfaces in 2023 assumed that a task began and ended in one conversation. That was enough for work I could do in a sitting. It broke down when I wanted a model to read a large body of source material, take notes, plan an eighty-page book, draft it in sections, evaluate the result, and revise it. I could wire those calls together in ordinary code. I tried that, and the code quickly filled with details that had little to do with the work itself: prompt construction, execution order, retries, state, and routing between steps. Every new workflow required another custom program. I wanted a smaller vocabulary for describing the work. It needed to answer three questions: - What operations make up the process? - How do those operations interact? - How can I combine a process into a larger process without introducing a second model of execution? I called the resulting framework Cognitive Blocks. ## I needed an abstraction between code and configuration [LangChain](https://www.langchain.com/) exposed enough machinery to build almost any chain, but using it still meant constructing the chain step by step. At the other end, products such as Custom GPTs offered a prompt, tools, and a knowledge base behind a fixed interface. They were easy to configure because they exposed very little composition. I wanted the middle: enough structure to describe a real process, without spelling out every transition in application code. That led me toward a declarative notation. Instead of constructing a tool as an object: ```ts const searchTool = new DynamicTool({ name: "web-search-tool", description: "Tool for getting the latest information from the web", func: async (searchQuery: string, runManager) => { /* ... */ }, }); ``` I wanted to declare the capability: ``` tool web_search_tool "Tool for getting the latest information from the web" { } ``` The runtime could then decide how to load and call it. The declaration would describe the arrangement; the runtime would handle execution. Before I could design that notation, I had to decide what it could name. A declarative language is only useful when its basic concepts stay consistent across different workflows. Syntax came later. I started with the vocabulary. ## I defined blocks as operations My first sketch used familiar job titles: planner, executor, reviewer, and interface agent. Those names were easy to understand, but too broad to compose. An "executor" might make one model call, write a chapter, query an API, or run an entire workflow. The name said almost nothing about its input, output, or place in the process. I replaced jobs with operations. Each block would accept an input, perform one kind of work, and return an output. The vocabulary eventually included: | Block | Operation | | --- | --- | | data transform | converts input data into another form | | evaluation / judge | checks output against acceptance criteria | | synthesis | combines context into a more complex result | | task planner | decomposes a request into executable steps | | supervisor | monitors execution and changes the flow | | data service | reads from or writes to an external system | | knowledge model | stores and retrieves knowledge | | context | supplies relevant data to another operation | | decision | selects among available options | | analysis | examines input from a defined perspective | | annotation | adds structured information to an input | | logging | records what happened during execution | | event listener | responds to a matching event | | event emitter | publishes an event to other blocks | These were designations rather than a closed type system. A block could span two roles, and I could add a role when the existing vocabulary stopped being useful. The important constraint was operational: I needed to know what went in, what came out, and what the block was responsible for. That granularity made composition practical. I could connect a planner to a set of transforms, send their outputs to a synthesis block, and put a judge after the result. The same vocabulary worked across very different workflows. ## I typed the connections too A list of block types described the available pieces, but it still did not describe a process. Two connected blocks might form a pipeline, a feedback loop, a supervisor-worker relationship, or an event subscription. If every edge meant "connected," the runtime could not schedule or validate the graph. I therefore treated relationships as part of the language. The framework needed to distinguish at least: - passing an output to the next block - sending a result back for revision - supervising another block's execution - emitting and listening for events - supplying context without controlling execution This changed the graph from a diagram into an executable description. A runtime could inspect a relation and know whether to pass data, wait for an event, repeat a step, or record a dependency. It also made malformed workflows detectable before they ran. ## I put capabilities behind JSON-RPC I wanted blocks to be installable. A general planner might run in one process, while a search tool or document writer ran somewhere else. The orchestration should not care which language implemented them. I put a [JSON-RPC](https://www.jsonrpc.org/specification) boundary between the runtime and each capability. A long-running process could expose its methods and descriptions over a common protocol. The runtime could discover those methods, call them, and inspect their traffic without importing their implementation. That boundary gave me a few useful properties at once: - blocks could run in different processes and languages - the runtime could discover capabilities when it started - installing a block did not require changing the caller - every interaction could be logged and inspected in the same form The protocol also kept the framework focused. Cognitive Blocks described what a capability did and how it connected to other capabilities. It did not prescribe the code inside each one. ## I made every process a block The central composite was a `ProcessFlow`. It contained blocks, their relationships, and an execution entry point. It accepted an input and returned an output through the same interface as any other block. That decision let me nest workflows without adding special cases. A flow that gathered sources, extracted notes, and summarized them could appear as one research block inside a book-writing flow. I could then place the entire book-writing flow inside a larger publishing process. It also kept roles independent of scale. A judge could be one model call or a `ProcessFlow` containing several evaluators and a decision step. Its internal size did not change how the rest of the graph used it. ## I tested the model on a book-writing pipeline I chose an eighty-page book because it forced the framework past the limits of one prompt. The process had to read source material, preserve useful details, plan the argument at several levels, draft the text, and evaluate it. I first modeled the work as a person would do it: 1. Decide the motivation, audience, tone, and length. 2. Read the source material and take notes. 3. Build a table of contents. 4. Expand it into sections, chapters, paragraphs, and supporting points. 5. Draft the text. 6. Edit the draft against the plan. The sequence mattered because each stage reduced the number of decisions left to the next one. By the time a writing block ran, it should already know what the passage needed to say, why it belonged there, which sources supported it, and how it connected to the surrounding text. ## I preserved why I kept each note The reading stage produced structured notes rather than summaries. I used a schema like this: ``` note source document name text passage or quotation remarks notes what to remember summary what the passage says context details needed to understand it reason why it matters to the project tags generated or supplied by the user embedding vector used for retrieval ``` The `reason` field carried the judgment made during reading. Search could recover the source, passage, and related topics later. It could not reconstruct why I had saved that passage for this particular book. Without that field, the pipeline preserved information and discarded intent. Those notes fed the outline. The outline then absorbed the structural decisions before drafting began. This gave me intermediate artifacts I could inspect and revise early, while changes were still cheap. It also made the drafting blocks simpler because they received narrow assignments instead of open-ended prompts. ## Sentence-level parallelism made the prose worse My first `ParagraphWriter` planned a paragraph and sent each sentence to a separate `SentenceWriter` in parallel. The calls completed quickly. The result read like a pile of sentences. Each writer knew its assigned fact, but it could not see how the previous sentence had framed the point or what the next sentence needed. That missing local context caused repeated introductions, abrupt transitions, and inconsistent emphasis. The architecture had divided the work below the level where the prose stayed coherent. I moved the main generation unit back to the paragraph. A paragraph writer could see the chapter plan, its own purpose, the preceding text, and the point that followed. When I still needed sentence-level control, I passed context according to the sentence's position: | Position | Context | | --- | --- | | introduction | the paragraph's purpose and plan | | body | the surrounding sentences and supporting material | | ending | the paragraph's purpose and what the body established | I also represented sentence roles explicitly—introduction, body, or ending, along with a rhetorical role such as explanation or argument. That gave an evaluator something concrete to check and made revisions more targeted. The prototype changed my rule for decomposition: split work only while each block can still see the context it needs. More calls do not automatically create more useful parallelism. ## I gave synthesis its own plan Long contexts created a second problem. If the source material did not fit in one prompt, I could divide it among several blocks. Their outputs still had to become one report rather than a stack of independent summaries. I modeled synthesis as another process: ``` analyze request -> decompose work -> synthesize result | plan -> write pieces -> assemble ``` The synthesis block first planned the final structure. It then assigned each part with the relevant source material and assembled the results according to that plan. The same pattern could recurse when one part was still too large. Treating synthesis as real work fixed a common failure in map-reduce writing pipelines. Concatenation preserves every fragment's local answer and provides no global argument. A planned synthesis gives each fragment a job in the whole. ## I represented instructions as trees The runtime also needed to build and revise instructions. Plain prompt templates worked when the program only filled in variables: ``` "Write a {{tone}} summary of {{document}} in {{n}} paragraphs." ``` They became brittle when a planner needed to insert a condition, reorder two steps, remove a section, or attach context to one part of the instruction. At that point the program was editing characters and hoping the result still made sense. I started representing instructions as trees, much like an abstract syntax tree in a compiler. A node could represent a goal, constraint, input, step, or output format. The runtime could move or replace a node while preserving the rest of the instruction's structure. Once prompts had structure, a planner could produce them as output and another block could revise one goal or constraint without rebuilding the whole string. ## What I kept from the prototype Cognitive Blocks began with a practical problem: I wanted to automate work that could not fit in one conversation, and direct chains became harder to understand as they grew. The framework gave me a way to describe that work at the level I actually reasoned about it: operations, relationships, and nested processes. The book prototype tested the model where it was most likely to fail. It showed that planning could move decisions upstream, structured notes could preserve intent, and nested flows could handle work larger than one prompt. It also showed that decomposition has a limit. Once I split a paragraph into isolated sentence calls, the system lost the context that made the result coherent. That became the most useful design constraint in the project: a block should be small enough to compose and large enough to do its work with the context it needs. --- ## Semantic blocks: a pidgin between English and code URL: https://www.wcdc.io/writing/semantic-blocks Date: 2023-11-18 Description: A sketch for adding structure to written English. Semantic blocks are a vocabulary I sketched for writing on a page: English with a small set of added constructs, for the parts of a thought that plain English leaves loose. I described the result as a pidgin between English and a programming language. The hard part was not choosing constructs. A construct earns its place by changing what happens after it is written, and nothing downstream of a page of English reads one, so the sketch had no way to separate a construct doing work from a construct that only looked like it was doing work. The same question came back three more times in the same week, aimed at a ledger schema, at a type system, and at a dependency I was about to take on. The type system is where it gets a usable answer, because a type system already has something downstream that reads what you wrote. ## The page is a wider channel than speech, and English is fitted to speech English got its grammar from speech: a linear channel that rewards fast encoding, immediate decoding, redundancy and tolerance for ambiguity. Writing uses a wider medium in which a reader can take in more context at once, revisit earlier clauses and inspect structure directly. The two channels have almost nothing in common: | | speech | the page | | --- | --- | --- | | delivery | one word at a time, in real time | a whole paragraph at once | | direction | forward only | glance back, skim forward at will | | where structure is held | the listener's working memory | in front of your eyes | | decoding | one pass, at the speed of production | as many passes as you want | | so the grammar is | loose, fuzzy and redundant, to survive being generated live | unconstrained by any of it | A grammar shaped by the left column is being used to write the right one. Speech has to be redundant enough to survive a listener who lost a clause and cannot ask for it again. The page removes that constraint and English spends none of the slack. So the design goal is a notation that uses the width the page offers: constructs for the parts of a thought that a linear channel forced you to leave implicit, and that a reader taking in a paragraph at once could take in too. Naming even one of those constructs requires naming what it is for, and English as a whole is too large a thing to aim at. ## Augmenting a language and replacing it are different design problems The first candidate is to stop using English. A formal notation carries three properties speech could never have given: it is unambiguous, it nests, and a machine can read it without guessing. It also gives up the one property I wanted most, which is carrying a meaning nobody has finished defining yet. Most of what I want to write down is at that stage, so replacing English loses more than it buys. So the notation has to augment English rather than substitute for it. I called the result a pidgin between English and a programming language: a small borrowed vocabulary for ideas natural language leaves loose. Pidgin is the accurate word, and it names three design constraints: - it borrows from both languages - it is simpler than either - it exists for a job rather than for a culture Those rule out the two nearby things I did not want, a formal language wearing English syntax and English with annotations bolted on. Augmentation costs the enforcement. A formal notation gets its strength from a reader that rejects what it cannot parse. A pidgin has no compiler, so a semantic block is only as strong as whatever consumes it, and a page of English is consumed by a person who will forgive anything. None of the constructs got named, because the design goal had nowhere to land. A notation for the page has to say what reads a block before it can hold a single construct. ## A representation earns its structure by changing what happens If the complaint is about English specifically, it should not show up in representations with no English in them. It shows up in two. Accounting software works in codified low-level objects such as ledger entries, transactions and accounts. People reason in broader concepts such as “business expense,” which covers a loose collection of entities, rules and operations. ``` what the software stores ledger entries, transactions, accounts what a person says "business expense" ``` The design goal there is an interface whose nouns are the concepts a person reasons in, and the sketch takes the consequence seriously: a concept-oriented API would expose operations that are themselves loosely defined, the way two people hand work to each other. A loosely defined operation cannot be checked against a signature, so something has to interpret each call, and that interpreter is a component the design does not have. The idea got a name, an API for Human Concepts, and stopped there. Both representations fail the same way. **A representation should be load-bearing.** A structure that does not constrain, produce, or otherwise affect what actually happens is decoration, paid for in attention and returning nothing. ## Erased types are the same defect with a runtime already attached [TypeScript](https://www.typescriptlang.org/) is the case where the structure exists, is enforced, and is deliberately disconnected from runtime behavior. Its types guide the checker and editor but do not influence the code that runs. Compilation deletes them: ```typescript function f(x: Uint8): Uint8 // what you wrote and what the checker read function f(x) // what runs ``` Which makes the transaction lopsided. You pay a strict and verbose type checker and fix everything it complains about, you get editor support, and the compiled [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) carries none of the guarantee. The erasure is deliberate. Dropping the types is what lets TypeScript compile to JavaScript any runtime already accepts, and that compatibility is most of why anyone adopted it. The design goal is to buy the guarantee back without giving up the syntax people already write, which is the trade [Mojo](https://www.modular.com/mojo) makes against [Python](https://www.python.org/): familiar surface, low-level machinery underneath. Koala is the TypeScript superset that does it, stated as three changes: - **Types are enforced at runtime** and introspectable before compilation, so logic can depend on them. - **Decorators** work as they do in Python, rewriting at the AST level rather than annotating. - **Pattern matching** happens over type expressions, with consequences in the logic rather than in the checker. What that buys is the sized types and sum types erasure rules out: ```typescript function addTwoNumbers(a: Uint8, b: Uint8): Uint8 { return a.checkedAdd(b); } ``` `Uint8` has a width, so `checkedAdd` has something to check against. Erase the type and the method has nothing to overflow. ```typescript enum Result { Ok { res: T; }, Err { err: E; } } function divideBy(a: Uint8, b: Uint8): Result { if (b === 0) { return Result.Err { err: "cannot divide by zero" }; } else { return Result.Ok { ok: a / b }; } } ``` `Result` is a choice between two shapes rather than a union the compiler forgets, so a caller cannot read `err` off a value carrying `res`. Three consequences follow from the one decision, and they are the reason the design is a language rather than a library. The runtime has to carry type information the compiler currently discards, so the output stops being ordinary JavaScript. Introspection before compilation makes the compiler an API a program can call. The implementation must then choose between a native runtime, a TypeScript target that recreates the checks, or a lower-level target such as [Rust](https://www.rust-lang.org/). All three are one choice priced three ways: keep the guarantee and give up the free ride on every JavaScript runtime, or keep the ride and go back to a checker whose findings evaporate. The systems-language branch went at it directly, through [LLVM](https://llvm.org/) bindings under the name chickenscript. ## Removing the tool is the test of whether the tool was load-bearing The last case is a dependency rather than a notation, and it is cheap enough to settle before writing code. The candidate was a framework for building editor extensions around a custom [React](https://react.dev/) renderer. A renderer decides what a description of an interface actually turns into, so a custom one would let you describe an editor panel in React and have it come out as something the editor understood. The design goal is to answer the question on paper, because a proof of concept commits you to the answer while you are still deciding it. Written out, it settles itself: ``` React gives JSX, reactivity, state Pays off for markup (HTML, PDF), interfaces (React Native), tree data (an AST) My strongest case web views Already served by React-DOM ``` WebViews were the strongest use case, and React DOM already served them. A custom renderer added no capability the design required. The rule generalises: **if removing the tool costs nothing, the tool was never load-bearing.** The renderer was an interesting angle rather than a requirement, and asking in writing made the reversal cheap. ## Structure exists only when something reads it The hard decision in all four is the same, and it is never about the syntax: what reads the structure. - A semantic block is read by nobody, so it can only ever be a convention between a writer and himself. - A ledger row is read by the accounting software, which is why its structure is real and also why it is the wrong structure. - A TypeScript type is read by the checker and then discarded, so the guarantee stops at the compiler boundary. - A Koala type is read at runtime, which is the entire change and the entire cost. Turning the load-bearing test on the documents themselves sorts them the same way. The medium argument constrains what any notation for the page has to carry, before a line of code exists. The blocks constrain nothing, because nothing downstream of them exists to be constrained. A design document sits on the reading side of the gap between feeling that code is understood and writing enough code to test that understanding. It can feel complete while constraining nothing downstream. The principles that came out of the week: - Aim a notation at a representation small enough to name, never at a whole language. - Ask what reads the structure before deciding what the structure is. - A construct that changes nothing downstream is a convention, and a convention is free to break. - Buying back a guarantee costs whatever property made the original adoptable, so name that property before spending it. - Remove the dependency on paper and see what breaks. The question underneath, what unit carries meaning between a person and a machine, came back twice more with better answers. Semantic objects gave the unit an interpreter, so a model could hold a name for something and call methods on it. A notation for a model to write in gave it a parser, so the structure a model produced could be checked before anything ran. Each of those answers is the 2023 sketch with a reader attached. --- ## cosmwasm-vm-js: running CosmWasm contracts in the browser URL: https://www.wcdc.io/writing/cosmwasm-vm-js Date: 2022-12-06 Description: The runtime behind my contract simulator and experiments with other contract languages. `cosmwasm-vm-js` is a TypeScript implementation of the host interface that runs [CosmWasm](https://cosmwasm.com/) contracts. It can load the same WebAssembly contract deployed to a chain and execute it in a browser or Node.js process. I built it because every contract tool I wanted to make depended on the Rust VM and its surrounding toolchain. A browser-based simulator, debugger, or playground needed a smaller boundary. Once I wrote that boundary down, it turned out to be about fifteen host functions, a handful of required exports, and a memory convention. That also answered a second question I was working on: what would another contract language have to produce? Rust dominated CosmWasm development because its standard library implemented the interface. WebAssembly itself did not require Rust. A second host and two experimental compilers let me test both sides of that claim. ## CosmWasm contracts run against a small host interface [WebAssembly](https://webassembly.org/) can compute and read or write its own linear memory. It cannot access files, the network, a clock, or chain state unless the host gives it a function for doing so. Those functions are imports. In the JavaScript VM, I provide them when instantiating the module: ```ts const imports = { env: { db_read: this.db_read.bind(this), db_write: this.db_write.bind(this), db_remove: this.db_remove.bind(this), addr_validate: this.addr_validate.bind(this), secp256k1_verify: this.secp256k1_verify.bind(this), query_chain: this.query_chain.bind(this), debug: this.debug.bind(this), abort: this.abort.bind(this), // fifteen in total }, }; ``` A contract can only reach operations in that object. If the host does not supply filesystem access, the contract has no filesystem operation to call. This makes the import list the effective boundary between the contract and the chain. The CosmWasm imports cover a narrow set of capabilities: | Imports | Purpose | Availability | |---|---|---| | `db_read`, `db_write`, `db_remove` | contract storage | always | | `db_scan`, `db_next` | storage iteration | `iterator` feature | | `addr_validate`, `addr_canonicalize`, `addr_humanize` | address validation and conversion | always | | `secp256k1_verify`, `secp256k1_recover_pubkey` | secp256k1 signatures | always | | `ed25519_verify`, `ed25519_batch_verify` | Ed25519 signatures | always | | `query_chain` | queries against surrounding chain state | always | | `debug` | diagnostic output | always | | `abort` | failed assertions | `abort` feature | Contracts expose functions in the other direction. The host needs `allocate` and `deallocate` to move data across the memory boundary. It also expects `instantiate` and an interface-version marker. Application entry points such as `execute`, `query`, `migrate`, `reply`, and `sudo` depend on what the contract supports. ## The contract owns its memory JavaScript cannot hand a string directly to a WebAssembly function. The contract owns its linear memory, so the host asks the contract to allocate a region and then writes the encoded bytes into it: ```ts public allocate(size: number): Region { const { allocate, memory } = this.exports; const regionPtr = allocate(size); // read the region descriptor and write into module memory ... } ``` Calls in both directions use this convention. The host allocates a region for the input, writes serialized bytes, calls an exported entry point, and reads the returned region. Imported functions receive pointers, decode regions from contract memory, perform the host operation, and return another pointer when needed. This memory handshake is part of the compilation target. A language can generate valid WebAssembly and still fail as a CosmWasm language if it does not export the allocator, use the expected region layout, serialize messages correctly, or expose the required entry points. Writing those requirements as an interface separated CosmWasm from its Rust implementation. Any compiler that emits the imports, exports, memory layout, and message formats can produce a contract. Any runtime that implements the host side can execute one. ## The browser became a contract runtime The reference VM uses Rust and [Wasmer](https://wasmer.io/). That is appropriate for chain execution, while it made lightweight developer tools harder to distribute. I wanted someone to open a page, load a `.wasm` contract, execute a message, and inspect the result without installing a chain or Rust toolchain. Browsers and [Node.js](https://nodejs.org/) already include WebAssembly engines. I only needed to implement the CosmWasm-specific imports and the memory bridge around them. I placed everything a contract can reach behind one backend: ```ts const backend: IBackend = { backend_api: new BasicBackendApi("terra"), storage: new BasicKVIterStorage(), querier: new BasicQuerier(), }; const vm = new VMInstance(backend); ``` `backend_api` handles addresses and cryptography. `storage` implements the database imports. `querier` answers requests for surrounding chain state. The VM handles WebAssembly memory, import wiring, and entry-point calls. Swapping one backend component changes the contract's environment without changing the contract. I can use an in-memory store in a browser, a persistent store in Node.js, a recorded querier for deterministic replay, or a wrapper that logs every read and write. That substitution point became the basis for the simulator. A contract does not need a special debugging build. The host can observe the same imports the chain would provide. ## I kept the same seams as the Rust VM Matching final outputs was insufficient for the tools I wanted to build. If the JavaScript VM organized the work around completely different boundaries, an instrument built against it would be trapped in the simulator. I mirrored the important seams of the Rust implementation. Each imported function has a fixed wire-facing method and a replaceable operation underneath it: ```ts db_read(keyPtr: number): number { const key = this.region(keyPtr); return this.do_db_read(key).ptr; } db_write(keyPtr: number, valuePtr: number) { const key = this.region(keyPtr); const value = this.region(valuePtr); this.do_db_write(key, value); } ``` `db_read` and `db_write` implement the pointer convention the compiled contract expects. `do_db_read` and `do_db_write` contain the storage behavior. Logging, replay, fault injection, and alternative stores attach at that second layer. This structure sometimes produces less idiomatic TypeScript. I accepted that cost because the JavaScript VM was also a place to develop instruments for the authoritative runtime. Keeping comparable seams made it clear where the same hook belonged in Rust. ## Alternate compilers tested the target I built two experimental contract toolchains against the interface: one in [AssemblyScript](https://www.assemblyscript.org/) and one in [C++](https://isocpp.org/). Their purpose was concrete. A language-independent WebAssembly target should accept another producer that emits the required imports, exports, memory layout, and message encoding. AssemblyScript worked especially well as a browser experiment. It uses TypeScript-like syntax and can compile inside a web page. Paired with `cosmwasm-vm-js`, it made a complete in-browser loop possible: write a contract, compile it, instantiate it, call an entry point, and inspect the resulting storage. The experiment also exposed work that Rust's CosmWasm libraries normally hide. A new frontend needs equivalents for message types, serialization, region allocation, storage abstractions, entry-point generation, and deterministic numeric behavior. Producing WebAssembly is only the first step. The C++ experiment reached the same target and gave me a second independent producer. I did not continue it as a contract language, so I treat it only as evidence that the host interface was language-independent. It says nothing broader about whether C++ is a good language for contract authors. ## Runtime safety cannot depend on one frontend Opening the target to more compilers changes where execution guarantees must live. A chain cannot assume every frontend inserts correct metering or avoids nondeterministic behavior. The runtime has to validate modules, constrain what they can import, account for resource use, and stop execution that exceeds its limits. `cosmwasm-vm-js` accepts a gas limit as part of the VM configuration: ```ts constructor( public backend: IBackend, public readonly gasLimit?: number ) ``` That value is configuration, not enforcement by itself. Stopping a tight WebAssembly loop requires metering or interruption support in the execution engine. The design point is that the host owns this limit and applies it uniformly to every compiled language. Language-level safety still matters. A frontend can prevent classes of authoring errors and restrict nondeterministic features. Those checks improve contracts produced by that language. The host remains responsible for protecting the chain from any module it accepts. This distinction made the alternate-language experiments useful beyond syntax. They forced me to separate properties supplied by a compiler from properties the runtime must enforce for every producer. ## The low-level imports shape every contract language The host interface exposes storage operations, address conversion, signature checks, chain queries, debugging, and aborts. It has no primitive for balances, ownership, permissions, or typed state. Contract libraries build those concepts on top of byte keys and values: ```text host operation contract meaning ----------------------- --------------------------- db_write(key, value) save this account's balance db_read(key) load the current owner db_scan(start, end) list every open position ``` This is where most of the work in an alternate frontend lives. The compiler and its standard library must turn source-level variables, maps, authorization checks, and typed messages into the storage and serialization conventions understood by the host. The thin interface is useful because it keeps the runtime small and language-neutral. It also means each language has to supply a substantial semantic layer before developers can write safe contracts productively. That realization split my work into two projects. `cosmwasm-vm-js` implemented and instrumented the existing host interface. The language experiments explored how higher-level contract concepts compile down to that interface. Neither required changing the chain. ## I document divergences next to the affected import A second VM cannot prove that it behaves exactly like the reference implementation. Tests establish agreement on the cases they cover. Tooling built on the JavaScript VM still needs to verify critical results against the Rust VM. I state that boundary near the top of the README. I also document differences per import: ```text | import | implemented | tested | notes | |---------------|-------------|--------|------------------------------------| | db_read | yes | yes | | | db_write | yes | yes | | | addr_validate | yes | yes | | | debug | yes | yes | appends to a list instead of | | | | | printing to the console | | query_chain | yes | yes | | ``` That placement makes the scope of each claim visible. A tool that only needs storage can check the storage rows. A tool that consumes diagnostic output sees the `debug` difference beside the function it uses. The caveat belongs in the artifact because every simulator, debugger, and language experiment built on this VM inherits it. The JavaScript runtime is useful precisely because it is easier to embed and modify than the chain VM. It remains a development implementation, not the final authority on consensus behavior. ## The host interface became the common target `cosmwasm-vm-js` reduced CosmWasm execution to the parts a tool actually needs: a WebAssembly engine, the expected imports and exports, the region-memory convention, and replaceable implementations for storage, addresses, cryptography, and chain queries. That let me run existing Rust contracts in a browser, observe every storage operation, substitute recorded chain state, and build alternate compilers against the same target. Mirroring the Rust VM's seams kept the instrumentation portable, while the README made the remaining behavioral differences explicit. The project also clarified the work required by a smart-contract language. Emitting WebAssembly is the easy outer boundary. A usable frontend has to reproduce the CosmWasm ABI, provide typed storage and messages, define deterministic behavior, and leave resource enforcement to the host. Once those responsibilities were separated, the runtime, simulator, and language experiments could share one concrete interface. --- ## Generating CosmWasm documentation from Rust contracts URL: https://www.wcdc.io/writing/terran-one-docs Date: 2022-09-21 Description: Keeping contract references in sync with the code they describe. Documentation was one of the first products I built at Terran One. CosmWasm developers needed two different things: a guide that explained how contracts work and a reference covering every message, field, constraint, and side effect in a contract. I initially treated both as writing. That made the reference slow to produce and almost guaranteed that it would drift from the Rust source. A renamed field required someone to find and update the same fact in several pages. I split the work by source of truth. I wrote the conceptual guide by hand because explanation requires judgment. I generated the contract reference from the code because message definitions and field types already existed there in a form a parser could read. ## I started with documentation because it could ship immediately The CosmWasm developer experience had several problems. New developers lacked a usable starting guide, and the contract-development loop was slow. Improving the loop required tools such as LocalTerra and the simulator. Documentation could describe the platform that already existed. That independence made it the first deliverable. I did not need a new language, VM, or chain API before I could explain how to instantiate a Rust contract, execute messages, query state, and inspect the response. This constraint kept the guide honest. It described the contracts developers could write at the time, using the Rust types and commands they actually had. ## The guide and reference have different sources of truth The guide explains concepts and workflows: how CosmWasm execution works, how to structure a contract, and how to move from a message definition to a deployed instance. Its accuracy depends on whether the explanation matches the platform and whether a reader can follow it. The reference answers narrower questions: which messages does this contract accept, which fields are required, what types do they use, and what does each handler do? Those facts already live in Rust enums, structs, function signatures, and handler code. Writing the reference by hand would create a second copy of the same interface. Every source change would then require a matching documentation change that the compiler could not enforce. I assigned the two documents accordingly: | Document | Authoritative input | Production method | |---|---|---| | Conceptual guide | platform behavior and developer workflow | written and edited by a person | | Contract reference | Rust messages, fields, handlers, and annotations | generated from source | This did not eliminate human writing. It put human effort where interpretation mattered and let the parser handle exhaustive repetition. ## I wrote the guide in separate passes My first attempts mixed research, organization, drafting, and line editing. I would polish a paragraph before I knew whether it belonged in the final structure, then rewrite it when the surrounding section changed. I separated the work into four passes: ```text brain dump → outline → rough draft → edit collect organize connect improve ``` The brain dump collected everything I might need without ordering it. The outline grouped that material around a reader's task. The rough draft connected the sections. Editing handled accuracy, clarity, and sentence quality after the coverage had stabilized. The separation gave each artifact a clear standard. I did not judge the brain dump for organization or the outline for prose. I also stopped adding whole new topics during line editing. If editing exposed a missing section, I returned to the outline instead of forcing it into the nearest paragraph. This made collaboration easier. Another person could review the structure before either of us spent time polishing it. ## I organized the guide around what the developer is doing A feature list assumes the reader already understands the system well enough to map a feature to their problem. A beginner does not know that "submessages" are relevant when they are trying to call another contract and handle its result. I organized the guide around developer tasks: create a contract, define messages, store state, execute another contract, handle a reply, test locally, and deploy. The table of contents used language a developer could recognize before learning CosmWasm's internal vocabulary. The reference used the opposite organization. Someone opening a reference already knows the message or field they need. I indexed those pages by contract interface: instantiate messages, execute variants, query variants, responses, events, and errors. The same content therefore appeared through two entry points. The guide started from a situation. The reference started from a symbol in the code. ## Gherkin made behavior reviewable outside the Rust implementation Message types describe the shape of an operation. They do not fully describe its behavior. A transfer message can contain a recipient and amount without saying what happens when the amount exceeds the sender's balance. I used [Gherkin](https://cucumber.io/docs/gherkin/reference/) scenarios for those behavioral rules: ```gherkin Scenario: a withdrawal larger than the balance is refused Given an account holding 100 tokens When the owner withdraws 150 tokens Then the transaction fails And the balance is unchanged ``` The format uses ordinary sentences and a small fixed vocabulary. A product designer or protocol contributor who cannot review the Rust implementation can still challenge the expected outcome. Engineers then bind the scenario to executable tests. That adds work compared with writing a Rust test alone, but it produces one behavior specification that both technical and nontechnical reviewers can read. I kept Gherkin for externally meaningful behavior. Low-level implementation tests remained in Rust. This prevented the specification from becoming a verbose restatement of every internal function. ## The generator reads the contract interface from the AST The reference generator parses the same Rust source the compiler sees. Message enums identify entry points. Struct fields provide names and types. Doc comments provide descriptions. Handler functions show which code processes each message. I designed the parser as shared infrastructure: ```text ┌──────────────────┐ Rust source → AST → │ documentation │ │ semantic checks │ │ linter │ │ code search │ └──────────────────┘ ``` The documentation generator did not need a private interpretation of the code. The linter and semantic checker could use the same nodes and relationships. A message variant declared without a corresponding handler was both a documentation gap and a program-structure warning. CosmWasm's execution model made handlers easier to describe. A contract handles one message, updates its own state, returns messages for the chain to process, and exits. Control does not leave in the middle of the function and later resume on the same stack. That allowed me to represent a handler as an ordered list of logical steps: ```rust pub fn execute_transfer( deps: DepsMut, info: MessageInfo, recipient: String, amount: Uint128, ) -> Result { // 1. Validate the recipient address. let recipient = deps.api.addr_validate(&recipient)?; // 2. Debit the sender, rejecting an overdraft. BALANCES.update(deps.storage, &info.sender, /* ... */)?; // 3. Credit the recipient. BALANCES.update(deps.storage, &recipient, /* ... */)?; Ok(Response::new().add_attribute("action", "transfer")) } ``` The numbered comments mark documentation boundaries. The generator associates each step with the following code and emits them in execution order. The linter can require numbering to remain sequential and warn when a large block has no documented step. These comments become part of the contract interface for tooling, so I kept the syntax deliberately narrow. They describe externally relevant operations, not every line of implementation. ## Annotations carry warnings and constraints beside the field Ordinary doc comments explain what a message or field means. I added structured annotations for facts other tools could process: ```rust pub enum ExecuteMsg { /// Increases the allowance for `address` by `amount`. /// @warning Allows another account to spend the owner's funds. IncreaseAllowance { /// Amount added to the existing allowance. /// @constraint Must be greater than zero. amount: Uint128, /// Account receiving the allowance. address: Addr, }, } ``` `@warning` identifies a consequence the caller should see before submitting the message. `@constraint` states a condition on a value. The reference can render both consistently, while tests and linters can inspect the same metadata. I kept general explanation in normal prose. Adding a marker only helped when a downstream tool needed to distinguish that fact from the surrounding description. The annotation remains hand-written and can still become stale. Generation removes the additional copies. A warning written beside the Rust field can appear in the reference, guide excerpts, and generated SDK documentation without being rewritten in each output. ## The code and guide now do different jobs The final system uses one source for contract facts and another for explanation. Rust types, signatures, handler steps, warnings, and constraints produce the exhaustive reference. The conceptual guide organizes those facts around the work a developer is trying to complete. Gherkin scenarios state behavior that needs review from people who do not read Rust. This division made maintenance explicit. Changing a message field updates every generated reference page. Changing the way I explain contract execution still requires an editor because no parser can decide which explanation will make sense to a beginner. That was the documentation problem I needed to solve. I did not want to generate prose that pretended to teach, and I did not want people manually copying hundreds of facts the code already knew. Terran One generated the facts and spent human attention on the explanation. --- ## cw-simulate: running a CosmWasm chain in JavaScript URL: https://www.wcdc.io/writing/cw-simulate Date: 2022-09-02 Description: Testing interacting contracts without running a blockchain node. [cw-simulate](https://github.com/terran-one/cw-simulate) runs [CosmWasm](https://cosmwasm.com/) contracts inside a JavaScript simulation of a Cosmos chain. I can upload a compiled contract, instantiate it, send messages, inspect its storage, and reset the entire chain without starting a node or installing a [Rust](https://www.rust-lang.org/) toolchain. I built it because contract development had a terrible feedback loop. A real chain is deliberately slow and irreversible. Development requires the opposite: run the same broken transaction forty times, return to the same starting state after each attempt, and inspect exactly what changed. I initially described the project as a debugger. That name led me toward breakpoints and paused execution. CosmWasm contracts do not work that way. Each entry point runs to completion, writes its own state, and returns messages for the chain to execute afterward. The useful core was therefore a small chain runtime with snapshots and tracing. Debugging became one application built on top of it. ## I only reproduced what a contract can observe A local simulator does not need consensus, networking, peers, or a mempool. Contracts cannot observe any of those systems. They can observe the environment passed into an entry point, the host functions available to their WebAssembly module, and the response produced after execution. A contract response has four parts: ```ts export interface ContractResponse { messages: SubMsg[]; events: Event[]; attributes: Attribute[]; data: Binary | null; } ``` The simulator needs to process those values the same way a chain does. Everything else can be a much simpler implementation. CosmWasm contracts compile to [WebAssembly](https://webassembly.org/). WebAssembly cannot access storage or chain state directly. The host supplies a short list of imports: - `db_read`, `db_write`, `db_remove`, `db_scan`, and `db_next` for contract storage - address validation and conversion - signature verification - `query_chain` for reading surrounding chain state The contract exposes entry points such as `instantiate`, `execute`, `query`, `migrate`, `reply`, and `sudo`. Each call also receives the current block, the contract address, the sender, and any attached funds. That interface defined the simulator's fidelity boundary. If cw-simulate supplies the same inputs, host functions, and message handling visible to the contract, it can replace the full chain during development. ## Contract execution produces work for the chain A CosmWasm contract cannot synchronously call another contract while retaining its own stack frame. An entry point updates local storage and returns a list of messages. The chain executes those messages after the contract has returned. The end of an `open_position` handler in Mirror shows the pattern: ```rust store_position_idx(deps.storage, position_idx + Uint128::from(1u128))?; Ok(Response::new() .add_attributes(vec![ attr("action", "open_position"), attr("position_idx", position_idx.to_string()), ]) .add_messages(messages)) ``` The contract stores its new position index, records attributes, returns the messages it wants processed, and ends. The chain then routes each message to the relevant module or contract. This execution model changed the tool I needed to build. There is no paused application stack between two contract calls. The state worth inspecting is the state before and after each completed transition, plus the messages that caused the next transition. cw-simulate therefore records state snapshots and processes a message queue. The interface can show the current state, a diff from the previous snapshot, the emitted events, and the next messages to execute. Resetting restores an earlier snapshot and clears later work. ## I separated the runtime from its views My first UI managed contracts, state history, message history, and execution directly. That made every new view a change to the runtime logic. I pulled the state management into a headless JavaScript package and kept rendering in a separate package. The project settled into three layers: ```text cw-vm-js executes one contract entry point cw-simulate runs modules, routes messages, and owns chain state cw-simulate-ui displays contracts, snapshots, diffs, events, and traces ``` `cw-vm-js` implements the CosmWasm host functions around a WebAssembly module. cw-simulate uses that VM inside a larger chain model. The UI only reads the runtime state and sends commands back to it. This split made the simulator usable without the original interface. Tests, scripts, browser tools, and future views could all drive the same runtime. It also kept debugging features from changing the contract execution model. ## The simulator uses the same module boundaries as Cosmos Cosmos chains are assembled from modules. A module owns state, handles messages addressed to it, and answers queries about that state. The bank module owns balances. The wasm module owns uploaded code and contract instances. I used the same structure in cw-simulate. The package contains base, bank, and wasm modules. The application configures a chain ID, address prefix, modules, block state, and storage: ```js import { CWSimulateApp } from "@terran-one/cw-simulate"; const app = new CWSimulateApp({ chainId: "phoenix-1", bech32Prefix: "terra", }); const codeId = app.wasm.create(sender, wasmBytecode); let result = await app.wasm.instantiateContract( sender, funds, codeId, { count: 0 } ); result = await app.wasm.executeContract( sender, funds, contractAddress, { increment: {} } ); result = await app.wasm.query( contractAddress, { get_count: {} } ); ``` Using the same boundaries made discrepancies easier to locate. If a simulated bank transfer differs from a real one, I know to compare the bank module's message handling. If a contract query differs, I can inspect the wasm module or VM. A custom architecture would have mixed those responsibilities and made every comparison harder. The object model follows the same rule. Uploaded code receives a code ID. Instantiating that code creates a contract address and storage namespace. The chain owns block height, time, parameters, and module state. Users submit messages to the chain. ## Transactional storage makes reset exact The simulator stores chain state in a prefixed key-value store. Each module and contract receives its own namespace. Transaction wrappers collect changes during execution and commit them only when the complete operation succeeds. This matters when one contract emits several messages. If a later message fails, the simulator must return to the state before the transaction. Keeping a UI copy of "previous values" would miss writes performed by nested messages or modules. The storage layer already sees every write, so rollback belongs there. Snapshots use the same mechanism. cw-simulate can retain a committed state, execute more messages, then restore the earlier version. The reset button returns the entire simulated chain to a known point, including module state and contract storage. That gave me the development loop I wanted: create a starting state once, try a transaction, inspect its effects, reset, change the contract or message, and run it again. ## I trace storage through the VM instead of parsing Rust To debug an arbitrary contract, I needed to know which keys it read and wrote. I first considered extracting that information from Rust source. Static analysis can find obvious storage calls, but Rust gives developers many ways to wrap, re-export, or generate the same operation. A source analyzer would always depend on the coding style of the contract. Every persistent operation eventually crosses one of five WebAssembly imports. The contract does not implement `db_read` or `db_write`; the host does. Instrumenting those functions captures every storage access from every contract language. The JavaScript VM exposes a replaceable method beneath each wire-level import. cw-simulate overrides those methods and records their arguments and results: ```ts export class CWSimulateVMInstance extends VMInstance { constructor( public logs: DebugLog[], backend: IBackend ) { super(backend); } do_db_read(key: Region): Region { const result = super.do_db_read(key); this.logs.push({ type: "call", fn: "db_read", args: { key: key.str }, result: result.str, }); return result; } // equivalent overrides for write, remove, scan, and next } ``` The contract runs normally and cannot detect the logger. Coverage no longer depends on whether the author used a standard helper, a custom abstraction, generated code, Rust, or another frontend. Every persistent access still crosses the host boundary. ## The backend makes the execution environment replaceable The VM receives three dependencies: ```ts const backend: IBackend = { backend_api: new BasicBackendApi("terra"), storage: new BasicKVIterStorage(), querier: new BasicQuerier(), }; ``` `backend_api` implements address and cryptographic operations. `storage` owns contract state. `querier` answers questions about the surrounding chain. I can wrap or replace each dependency. A storage wrapper can record accesses, reject writes matching a predicate, or expose changes to a fuzzer. A custom querier can replay recorded chain state or return controlled responses for a test. A backend API can simulate another address prefix or report every validation call. This was the basis of OverseerVM, the auditing layer I built around the simulator. The VM records boundary calls, while programmable backend wrappers let an auditor define conditions that fire when a contract touches specific state. A fuzzer can then generate messages and check those conditions across many clean runs. The important implementation choice was to instrument dependencies supplied by the host. I did not require the target contract to contain logging code or use a particular library. That made the same tools work against contracts written by someone else. ## Traces contain prints and host calls The trace format only needs two entry types: ```ts export type DebugLog = PrintDebugLog | CallDebugLog; export interface PrintDebugLog { type: "print"; message: string; } export type CallDebugLog = { type: "call"; fn: K; } & CosmWasmAPI[K]; ``` A `print` entry records a diagnostic message emitted by the contract. A `call` entry records an import crossing, including its function name, arguments, and result. The first contains what the author chose to report. The second records what the contract actually asked the host to do. cw-simulate stores traces beside the state transition that produced them. The UI can display a transaction, its events, the storage diff, and the ordered host calls together. Scripts and tests can consume the same trace as structured data. Keeping the trace in the runtime package also prevents the UI from becoming its owner. A headless test receives the same observations as someone using the visual simulator. ## The simulator has a defined accuracy limit cw-simulate and `cw-vm-js` reimplement behavior from the chain and reference VM. Passing tests establishes agreement for those cases. It does not prove identical behavior for every contract or every future chain version. The README states that limitation directly and tells users to verify critical results against the original VM. I also keep differences close to the affected functions. For example, the JavaScript VM collects `debug` strings in a list while the reference implementation writes them through its own diagnostic path. That boundary matters because the simulator is intentionally easier to modify than the chain. Its replaceable storage, querier, and import hooks are the source of its value for testing. They also mean consensus behavior remains the responsibility of the real implementation. ## cw-simulate runs completed transitions and records everything between them The finished design is a resettable JavaScript chain around a WebAssembly contract runtime. It executes one contract call to completion, routes the returned messages through Cosmos-style modules, commits or rolls back the resulting state, and records each observable boundary crossing. That structure came directly from the problem I was solving. I needed rapid contract experiments, so the runtime had to reset exactly. I needed several contracts to interact, so it had to schedule messages and own shared chain state. I needed to inspect arbitrary contracts, so I traced the storage imports every contract must call. The simulator does not try to pause a contract between source lines. It shows the unit CosmWasm actually executes: a complete state transition, the messages it emitted, the state it changed, and the host operations it used. --- ## Building Terra's local smart-contract development stack URL: https://www.wcdc.io/writing/localterra Date: 2021-09-09 Description: Getting from a new contract project to a repeatable local test. When I started working on Terra's developer tools, building a contract required too much setup and too much patience. New projects began as copies of sample repositories. Testing meant connecting to a shared network or assembling a private one by hand. Debug output depended on code added to the contract. After a failed transaction, getting back to a clean state was another job. I wanted one local loop: create a standard project, start a complete Terra network, deploy the contract, inspect what it did, wipe the state, and run it again. I built that loop in three parts. [LocalTerra](https://github.com/terra-money/LocalTerra) ran a private Terra network with its wallet, data service, and block explorer already connected. A modified node exposed contract diagnostics at the runtime boundary. The Houston project scaffold standardized contract structure, tests, deployment scripts, and generated documentation. ## LocalTerra made the chain disposable A production blockchain preserves history across many machines. That is the behavior users need and the opposite of what I needed during development. I wanted to run a broken transaction repeatedly from the same starting state. LocalTerra runs the network in containers and keeps chain state in a disposable volume. Resetting it is destructive and intentionally simple: ```sh docker-compose rm -f -s -v docker volume rm localterra_terra docker-compose build --no-cache ``` Removing the ledger returns every module, account, and contract to its initial state. I could seed a test scenario once, run an experiment, inspect the result, reset, and repeat. A bare node would not have been enough. Terra applications reached the chain through a wallet, SDK endpoints, a data service, and an explorer. LocalTerra started those pieces together and connected them to the same private network. The node published the same endpoints used by normal development tools: ```yaml terrad: ports: - "1317:1317" # REST used by SDKs - "9090:9090" # gRPC - "26657:26657" # Tendermint RPC used by explorers ``` Anything a wallet, SDK, or explorer could observe through those interfaces needed to behave like Terra. Consensus across independent machines, public peer discovery, and a durable ledger could be simplified because local applications did not depend on them. I used [Ganache](https://archive.trufflesuite.com/ganache/) as the product reference. Ganache ran a private Ethereum chain in a box. LocalTerra could not reuse its code because Terra used a different chain and virtual machine, but it could offer the same development experience: one command starts an ecosystem that behaves like the public platform from the application's point of view. ## CosmWasm gave me one place to observe every contract Terra contracts run on [CosmWasm](https://cosmwasm.com/). Contracts compile to [WebAssembly](https://webassembly.org/) and receive a small set of host functions for storage, address conversion, signatures, chain queries, and diagnostics: ```text db_read addr_validate secp256k1_verify db_write addr_canonicalize secp256k1_recover_pubkey db_remove addr_humanize ed25519_verify db_scan ed25519_batch_verify db_next query_chain debug abort ``` Those functions are the only route from a contract to the surrounding chain. That made them the right place to add development instrumentation. Logging inside a contract only works for code I can edit. It also changes the binary I am trying to inspect. Logging inside the node works for every contract executed by that node, including contracts written by someone else. The `debug` import already provided the boundary: ```ts debug(messagePtr: number) { const message = this.region(messagePtr); this.do_debug(message); } ``` I modified the local runtime to collect and expose those messages. Contracts continued to call the standard CosmWasm import, so they required no LocalTerra-specific API. The node decided where the output went. The same approach extended beyond explicit debug statements. Storage reads, writes, removals, and scans also cross host imports. Instrumenting those calls let the development runtime report what a contract actually touched, independent of its source language or internal abstractions. Keeping the instrumentation at the VM boundary gave it complete coverage over locally executed contracts. It also kept the contract binary closer to what would run on the real chain. ## The wallet and explorer were part of the product LocalTerra originally looked like a node-distribution problem. In practice, developers were building applications, and their applications used more than the node. A wallet had to recognize the local chain, submit transactions to it, and display the resulting account state. The explorer had to read the local RPC endpoint and show blocks and transactions. The data service had to index the same network the wallet was using. I treated those connections as part of LocalTerra instead of post-installation instructions. The system came up with funded accounts and compatible service configuration. A developer could open the wallet extension, connect an application, submit a transaction, and inspect it in the explorer. This is what made resettable state useful. Resetting a node that the rest of the stack cannot reach only tests contract execution in isolation. Resetting the complete application environment tests the path a user will actually take. ## I standardized the project before automating it The other half of the loop began before LocalTerra started. Developers needed a predictable way to create and organize a contract project. My earlier tooling was a collection of TypeScript scripts for common tasks. It automated commands without defining how a project should be structured. New contracts still began by copying examples, and teams made independent decisions about source layout, tests, deployment, and documentation. That flexibility created repetitive correctness risks. Adding one query required edits in three places: ```rust // 1. declare the message pub enum QueryMsg { Config {}, AssetConfig { asset_token: String }, } // 2. route the message match msg { QueryMsg::Config {} => to_binary(&query_config(deps)?), QueryMsg::AssetConfig { asset_token } => { to_binary(&query_asset_config(deps, asset_token)?) } } // 3. implement the handler pub fn query_config(deps: Deps) -> StdResult { ... } ``` The compiler could verify each piece individually while missing that I had declared a message and forgotten to route it. A generator could remove that duplication only if it knew where message definitions and handlers lived. Houston introduced a standard workspace: ```text contracts/ contract1/ src/ lib.rs contract.rs tests.rs Cargo.toml integration-tests/ test_XXX.rs docs/ scripts/ deploy.rs migrate.rs Cargo.toml ``` `cargo houston new contract ` created this structure. Each contract was a Rust crate. Unit tests lived beside its code. Integration tests lived at the workspace root because they exercised deployed contracts through the chain. Generated documentation went into `docs/`. Deployment and migration were executable Rust programs in `scripts/`. The scaffold saved some typing, but consistency was the larger benefit. I could open an unfamiliar Houston project and know where its contracts, integration tests, deployment logic, and generated artifacts lived. Tools could make the same assumption. ## A fixed structure made generation reliable Once the project layout and message definitions had stable locations, Houston could generate the repetitive layers around a contract. The message types already described the public contract interface. Tooling could use them to generate reference documentation, client bindings, and an application interface connected to the Terra wallet. Adding a query in the contract became the source change; the other representations could be regenerated from it. I also kept deployment inside the repository as code: ```text scripts/deploy.rs scripts/migrate.rs ``` This made deployment reviewable and repeatable. A README command can drift when a flag or contract address changes. A program imports the same project configuration as the rest of the toolchain and fails visibly when its assumptions stop compiling. Documentation followed the same approach. Command-based guides were easier to test than screenshots of a web interface. I could run a sequence of commands end to end and catch a broken flag, path, or output format. The guide remained useful before a graphical interface existed and stayed verifiable afterward. ## The tools formed one development loop The scaffold and local network solved different abandonment points. Houston handled the first twenty minutes: create the workspace, add a contract, run unit tests, and generate the surrounding files. LocalTerra handled the repeated loop: start the ecosystem, deploy, execute, inspect, reset, and execute again. Node-level tracing added visibility without requiring developers to modify the contract they were studying. The pieces fit because they shared concrete interfaces. Houston produced deployment scripts and contract binaries. LocalTerra exposed the standard Terra endpoints those scripts used. The wallet and explorer connected through the same interfaces as they did on a public network. The modified CosmWasm host observed contracts through imports the contracts already called. I did not need a new execution model or a special debug version of every application. I needed to package the existing boundaries into a development environment and decide which layer owned each feature. The final workflow was direct: generate a known project structure, run it against a complete local Terra network, inspect execution from the host, destroy the ledger, and start again. That turned contract development from a sequence of setup tasks into a loop I could repeat without losing the thread of the bug I was trying to fix. --- ## Terra SDK: building the same library three times URL: https://www.wcdc.io/writing/terra-sdks Date: 2020-07-15 Description: A consistent developer API across Python, TypeScript and Java. I built Terra's blockchain SDK three times: first in [Python](https://www.python.org/), then [TypeScript](https://www.typescriptlang.org/), then [Java](https://openjdk.org/). Each SDK needed types for every message the chain accepted, serializers for its wire formats, key management, transaction signing, and clients for the node APIs. The work covered hundreds of small protocol types with no natural build order. I needed to define what the library promised, choose a first piece, and create units of work that could actually be finished. The third implementation added another problem. Three hand-written SDKs could disagree about the same protocol, so I also needed to decide how their definitions would be shared across languages. ## The SDK should model Terra's protocol A Terra transaction can be sent without an SDK. The node accepts JSON over HTTP, so an application can build an object, sign it, and send it with a normal HTTP client. An SDK that only wraps those HTTP calls saves little. I wanted the core package to give programmers Terra's protocol in their own language. Every accepted message should have a named type with the fields the chain reads. Addresses, coins, fees, and signatures remain distinct protocol types throughout the application. The simplest example is a token transfer: ```ts export class MsgSend extends JSONSerializable< MsgSend.Amino, MsgSend.Data, MsgSend.Proto > { public amount: Coins; constructor( public from_address: AccAddress, public to_address: AccAddress, amount: Coins.Input ) { super(); this.amount = new Coins(amount); } ``` The signature tells the caller that the sender and recipient are account addresses and that the amount is a collection of coins. The base class carries the three serialization formats Terra used. The caller constructs a protocol message directly; the class owns the raw JSON shape. That promise determined the package layout: | Package | Responsibility | | --- | --- | | `core` | protocol types and messages | | `client` | node communication | | `key` | keys and transaction signing | | `util` | shared serialization and helpers | | `extension` | the browser-wallet surface in TypeScript | The `core` package cannot depend on a node client. A program should be able to construct, inspect, serialize, and test messages without choosing a URL or opening a connection. The imports for `MsgSend` show that boundary: ```ts import { Coins } from '../../Coins'; import { JSONSerializable } from '../../../util/json'; import { AccAddress } from '../../bech32'; import { MsgSend as MsgSend_pb } from '@terra-money/terra.proto/...'; ``` The message depends on other protocol values, a serialization helper, an address type, and generated protobuf code. Network state stays in `client`; secrets and signing stay in `key`. ## I started with serialization The Python SDK began with serializer and deserializer classes. Serialization was small enough to implement immediately and sat underneath every message type I would add later. It also forced the wire format to become concrete. The node expects particular field names, number encodings, and nesting for a coin. A mistake in the serializer propagates into every message built on top of it. Starting there meant some early code would be rewritten as the architecture developed. I preferred that rewrite to designing the whole package around an imagined wire model and discovering the mistake after hundreds of message classes depended on it. This gave me a practical rule for starting large libraries. The first unit should expose an assumption shared by the rest of the system and be small enough to finish. Serialization met both conditions. ## I designed the public API by writing applications against it Once serialization worked, I needed to decide how the library should feel to an application developer. The chain's module structure offered an easy template. I could mirror its directories and expose each endpoint and message where the underlying implementation placed it. That would produce an accurate library organized around how the chain stores and validates data. Applications are organized around what a developer is trying to do. To design for that side of the boundary, I wrote small applications against the unfinished TypeScript SDK. Awkward call sites showed where the library exposed chain internals, required repeated conversions, or placed related operations in different packages. The timing mattered. An example written after the API is stable demonstrates the library. An application written while the API can still change designs it. I expected those applications to break the SDK and treated each break as feedback on the interface. This kept protocol fidelity and caller ergonomics separate. The core types still matched Terra exactly. The public methods and package entry points were shaped by how applications used those types. ## Tests gave the work a finish line The Java SDK exposed a planning problem I had already encountered in the first two implementations. A protocol surface with hundreds of types has no visible edge. I could work for several days and still be unable to point to a finished unit. I considered two ways to traverse the surface: - Finish one class completely, then move to the next. - Sketch the basic shape of every core class, then fill in their behavior. The first approach finds deep representation problems early. The second establishes coverage. Neither defines a durable completion signal by itself. Tests supplied that signal. A passing test named one behavior that existed, stayed in the repository, and failed again if a later change broke it. I could count completed behaviors across partially implemented classes. I wrote the tests as statements about protocol behavior: ```ts describe('Coins', () => { it('clobbers coins of similar denom', () => { const coins1 = new Coins([ new Coin('ukrw', 1000), new Coin('uluna', 1000), new Coin('uluna', 1000), ]); expect(coins1.get('uluna').amount.toNumber()).toEqual(2000); }); ``` Two coin values with the same denomination collapse into one amount. Terra enforces that rule, so the SDK needs to enforce it too. The test marks a finished piece of work and records the behavior the type must preserve. Tests became planning units and specifications. I could work in depth or breadth while measuring progress in executable behaviors. ## Package boundaries follow what callers need independently I split the TypeScript SDK into `core`, `client`, `key`, `util`, and `extension` so applications could install and audit the parts they used. Key management and node communication have different dependencies and risk profiles. One handles secrets and signing; the other holds a URL, request code, and retry behavior. The browser extension existed only in the TypeScript implementation, so putting it in the shared core would create empty counterparts in Python and Java. The directory structure made the separation visible: ``` core/ client/lcd/ Coin.ts Msg.ts LCDClient.ts Coins.ts Fee.ts APIRequester.ts Dec.ts Tx.ts Wallet.ts Int.ts SignDoc.ts api/ Denom.ts PublicKey.ts ``` `core` contains values and messages. `client` contains connections and request policy. If `core` compiles and its tests pass with no client installed, the protocol vocabulary is genuinely independent of network access. The same criterion works better than dividing packages according to the source repository. A package boundary should let a caller take less of the system or let one part be audited and changed without pulling in another. ## Numeric types enforce chain precision Terra balances are integers that can exceed JavaScript's exact numeric range. Decimal calculations also use a fixed precision. Returning native JavaScript numbers would silently round values before they reached a transaction. I encoded the precision in the type: ```ts export const DEC_PRECISION = 18; export class Dec extends Decimal implements Numeric { public toString(): string { return this.toFixed(DEC_PRECISION); } ``` Every `Dec` renders with the eighteen decimal places the chain expects. The type applies the formatting rule during serialization and keeps the value out of JavaScript's native numeric representation. This is part of the SDK's protocol promise. Types should prevent invalid representations from reaching the wire. Documentation can explain the rule; the numeric class has to enforce it. Finishing one numeric type exposed decisions that a broad API sketch would miss: parsing node responses, addition and division, conversions into application code, and serialization back to the chain. That justified doing depth-first work on the value types even while tests tracked progress across the larger surface. ## Three languages need one source of truth The Python, TypeScript, and Java SDKs described the same messages independently. A field added to one implementation could be missing from another while every local test suite still passed. Code generation could remove the repeated definitions. I reduced the design to two possible sources: **A neutral protocol descriptor.** A JSON or YAML schema defines messages, data objects, REST endpoints, and protobuf relationships. Each language generator reads the same description. ``` description / | \ TypeScript Rust Kotlin ... \ | / common ``` This gives every language equal status and makes the shared definition explicit. It also creates a schema that somebody must maintain alongside the chain. The descriptor can express only the constructs its schema anticipates, so unusual message types either expand the descriptor language or require exceptions. **A canonical SDK implementation.** The TypeScript SDK becomes the definition and generators derive other languages from its types. This avoids inventing a second protocol language and begins from code that already exists. The generator must understand every TypeScript construct used by the canonical SDK, which turns the ongoing cost into maintaining a source-code translator. The choice is therefore between maintaining a schema and maintaining a translator. A descriptor is cleaner when the protocol already has an authoritative machine-readable definition. A canonical implementation is cheaper when one SDK already contains the richest and most current definitions. Framing the decision this way also identifies the owner. Protocol maintainers can own a neutral descriptor. SDK maintainers can own a canonical implementation and its translators. "Generate the other SDKs" is incomplete until that ownership is explicit. ## The library's structure follows its guarantees The same promise shaped every part of the three SDKs. Applications should construct Terra messages from named protocol types, without a network connection and without manually preserving wire-format rules. That promise placed messages and values in `core`, kept clients and keys in separate packages, pushed precision into numeric types, and made behavioral tests the units of progress. Writing applications against the unfinished API kept the caller's workflow visible while those internal boundaries changed. The third SDK exposed the limit of hand-written protocol definitions. Once several languages describe the same chain, the shared truth must live in a neutral descriptor or a canonical implementation. The maintainable choice depends on whether the project is prepared to own a schema or a translator. An SDK looks like a collection of wrappers from the outside. Building one is the work of deciding which protocol guarantees belong in types, which dependencies callers should be able to avoid, and where the definitions live so every language keeps the same promise. --- ## Microlog: capture first, structure later URL: https://www.wcdc.io/writing/microlog Date: 2019-08-30 Description: Keeping a daily record without filling out forms. Microlog is one timestamped log of anything I care about. I append short entries throughout the day, and separate tools read the same record to build habit views, financial summaries, health histories, and context for models. I arrived at this design after repeatedly abandoning more structured trackers. Every category, field, and folder added a decision at the moment I had the least attention to spare. Missing one entry then looked identical to nothing happening. I moved all interpretation out of capture. Writing requires a timestamp and a sentence. Structure is applied later, when I already know what I am trying to retrieve or measure. ## I needed an honest record before I needed a productivity system The first version was a paper to-do list. I used paper because comparing applications had become a way to avoid tracking anything. The list showed me that the record mattered more than the planning features around it. I wanted to see what I had actually done each day. A tracker that made the day look productive or omitted inconvenient gaps would give me confidence without evidence. That made adherence part of the design. A perfect schema produces no useful record if I stop filling it in. A lower-friction system with rougher entries gives me something I can inspect and improve. Paper also revealed details I would not have chosen in advance. Tasks approaching two hours felt too large to begin. I only learned that by running the system and watching where I hesitated. Since then, I have prototyped tracking practices manually before building software around them. ## Continuous capture made entry cost the main constraint Reconstructing a day at night records what I remember, not everything that happened. I needed to write during the day, while working, eating, exercising, spending money, and talking to people. That changed how I measured friction. A form that takes thirty seconds may sound cheap. If it interrupts another activity and asks me to choose among several categories, the attention cost is much larger than thirty seconds. Repeating that interruption throughout the day eventually creates gaps. I therefore made the capture command accept raw text: ```bash organs log "Ate chicken, broccoli, and okra at home" organs log "Gym: bench DB 150x10, dips 3x8" organs log "Shipped tasks integration" ``` The command appends each entry to that day's Markdown file: ```md # 2026-08-30 (Sunday) ## Morning - [10:06] Ate chicken, broccoli, and okra at home - [10:24] Shipped tasks integration ``` There is no required category, project, habit, or metadata form. I can write a fragment and return to what I was doing. ## The log is chronological and append-only I borrowed the entry shape from system logs and bank statements. Each entry has a time and enough local context to make sense later: ```text 2024-03-11 09:14:22 worker.queue job 8812 retried after timeout 2024-03-11 Blue Bottle coffee -6.75 ``` Microlog uses the same basic form for personal events. The normal write path appends a new line instead of editing earlier history. Corrections become additional entries, preserving what I originally recorded and what changed afterward. Chronology gives every tool a stable input. A new tool can scan the same files without requiring a migration or asking older entries to match its schema. The log remains useful even when I stop using the application that originally captured it. The scope is deliberately broad. An entry can describe my work, food, exercise, an expense, a conversation, a world event, or a friend's milestone. The common property is simply that I wanted to remember when it happened. ## Plain files are the source of truth I tried keeping the record in Evernote, Notion, Trello, and several databases. Each tool made one part of the experience easier while placing the history behind its own interface or hierarchy. Those attempts gave me four requirements: - entries live in a standard format on disk - capture has no setup beyond writing the entry - tools can read and write programmatically - the source stays shallow enough to browse without a custom application Markdown files satisfy those requirements. They work with editors, search tools, Git, scripts, and models. I can replace the capture interface or analysis tool without moving the historical record. This led to a toolbox architecture. Microlog owns the append-only record. Other applications consume it through files or a small read/write interface. A habit tracker can disappear without taking the journal with it. A new search tool can index the existing history without importing it into a new authoritative database. ```text capture ───────┐ voice ─────────┼──→ daily Markdown log ──→ habits automations ───┘ ├→ health ├→ finance ├→ search └→ model context ``` The tools may keep derived indexes or caches. I can delete and rebuild those because the log remains the source. ## The old schema made capture do too much work An earlier daily template required me to sort each event before writing it: ```text Mission To-do list Habits Journaling Food Expenses Fasting Meditation Gym Highlights Insights ``` A meal purchased at a restaurant could belong under Food, Expenses, Habits, or Highlights. The form forced me to choose one section before it would accept the event. Recording therefore required remembering the schema and deciding how the entry would be used later. That was the wrong moment for classification. At capture time, I only know what just happened. At read time, I know the question I want to answer. Microlog keeps the meal as one event. A food view extracts what I ate. A finance view extracts the purchase. A habit view marks whether I logged a meal. Several interpretations can coexist because none rewrites the source entry. ## Models apply schemas when I ask for a view Before language models could interpret loose text reliably, structured tracking required a form. The person entering data had to supply the categories that software could not infer. Models let me move that work to read time. A view defines the schema it needs, reads the relevant entries, and asks a model or deterministic parser to map them into that schema. For example, a food view can request: ```ts interface MealEvent { at: string; foods: string[]; source?: "home" | "restaurant"; } ``` The health tool applies that shape to entries likely to describe meals. The finance tool uses a different schema over the same time range. The source log does not need to anticipate either one. I still keep deterministic boundaries where they help. Timestamps come from the capture system. File dates define the initial range. Exact markers such as `Gym:` can route obvious entries cheaply. The model handles ambiguous language and overlapping categories. Derived records retain a link to the source line. I can inspect the original text when an interpretation looks wrong and regenerate the view after changing its prompt or schema. ## Each use gets its own view My first digital implementation asked the event stream itself to serve as a habit tracker, model memory, and automated journal. The raw list was too vague for habits, too noisy for model context, and too unstructured for reports. The mistake was expecting one storage shape to answer every question directly. The log only needs to preserve events. Each consumer needs a narrower view: | Consumer | View derived from the log | |---|---| | Habit tracker | whether a target behavior occurred each day | | Model context | recent events relevant to the current request | | Finance | purchases, amounts, merchants, and categories | | Health | meals, exercise, sleep, weight, and symptoms | | Weekly review | notable changes, gaps, and recurring patterns | These views can improve independently. Changing the food parser does not change finance history. Replacing the model used for context selection does not change the log. Adding a new view requires reading existing entries, not redesigning capture. ## Real entries determine the configuration I could not design every useful schema before using the system. Real entries exposed ambiguous cases that a design session would miss: one sentence describing both a purchase and a meal, a workout abbreviated in personal shorthand, or a work event whose importance only became clear days later. I let those cases shape each view. I start with a small schema, run it against the actual log, inspect errors, and add rules or examples in response. The raw entry remains available throughout that process. This is another reason capture stays loose. Early classification would freeze my first guess into the historical record. Read-time interpretation lets the configuration evolve as I learn what I want from the data. ## Microlog keeps capture simple and moves complexity downstream The finished system has a clear division. Capture records a timestamp and text. Daily Markdown files preserve the history. Narrow tools interpret that history for a particular purpose. Models handle the parts of classification that require judgment. I no longer choose between Food and Expenses while standing in a kitchen. I write what happened once. Later, when I want a meal history or spending report, the relevant tool performs that interpretation against the same entry. That decision solved the adherence problem that had broken my earlier trackers. The log asks almost nothing when my attention is scarce, and every later feature pays its complexity after the event has already been captured. --- # Lists --- ## Uses URL: https://www.wcdc.io/lists/uses Updated: Thu Sep 10 2026 00:00:00 GMT+0000 (Coordinated Universal Time) Description: The desk, the machines, and the everyday apps, dated from when they arrived. This is the desk, the machines, and the software I actually use, each dated from when it arrived. An item is marked as in use only when there is evidence from the last few months. The current machine, bought when the previous one could not run a screen recorder and a fleet of agents against the big display at once. It is the couch machine. Unplugging the desk setup was enough friction to keep me at the desk, so a light machine fixed that. Four years as the main machine, then handed down. Ten cores, 125 GB of memory, an RTX 3090, on around the clock. Every scheduled job runs here, because a laptop sleeps and a job that dies silently looks like a quiet day. It is increasingly where I drive the agents from. Three years of handwritten brain dumps, now scanned and searchable. The habit lapsed in 2024. One journal written on it. Impressive, and unused since. Moved next to the Linux box in August 2026. It is the chair, and has been for years. Twenty-five minutes standing was an achievement at first. It is normal now. The microphone. A podcast-cleanup model now makes a phone recording sound nearly as good. I never wrote the model down. Work starts by setting it. With the screen recorder, it is the backbone of getting anything done. Bought in 2020. A camera pointed at it turned thinking into presenting, so the recorded-whiteboard habit was retired in August 2026. A Korea-era rabbit hole: a Leopold with Cherry MX Clears, a Realforce that taught me I do not like Topre for code, and a Drop CTRL built by hand for about $400 in parts. Nothing about keyboards in the record since 2020. Bought on a whim. It taught me I could learn something I had decided I could not. Looking for a teacher as of August 2026. Makes exertion count, including the stairs. The health organ in my system reads from it. WHOOP replaced it for training. Apple Health still holds steps and resting heart rate. A voice recorder worn on walks. It works as a commitment device: with it on, a day is forty to fifty thousand steps and hours of talking. Replaced Alfred for a faster path to a model and easier extensions. My own extensions live in it now. One long-lived agent tab per goal, not per persona. The agent-native browser, and the app I have used most since it arrived. The browser is already basically you. It is what Aside drives under the hood. It crashed too often on my machine. Its persistent chat was enough to make me leave VS Code in 2024. The editor use faded; the cloud agents came back into my week in August 2026. This is where everything that needs doing gets recorded, including what agents surface. Five years as the task app, replaced by a small database of my own, which was itself retired. The queue is Linear. Vaults are split by how much damage an agent could do with each one. Three years of its filenames sit in my journals. Every working session is recorded, over 1,500 hours on a private channel. Knowing nothing is lost is most of why I can start. A hundred-plus meetings transcribed. I keep the transcript and skip the summary. Two accounts, read and cleared by a command rather than a client. I paid for it and did not use it. It held a daily build log through 2025, and nothing in 2026. A folder of plain text files with a search index over them replaced it. The bot I built to feed it got too ambitious, and the habit did not survive 2025. Books come from physical bookstores now. A launcher command generated playlists from it once. --- ## Stack URL: https://www.wcdc.io/lists/stack Updated: Thu Sep 10 2026 00:00:00 GMT+0000 (Coordinated Universal Time) Description: What I build with, and the reason for each choice. This is what I build with and why, taken from lockfiles, configs, and git history rather than from memory. An item is marked as in use only when it is in an active repo this month. Every active repo, strict, run directly by Bun. One observation from 2026: agents do better in Rust because they actually run the compiler, whereas in TypeScript they skip the type check. Runtime, package manager, test runner, and SQLite driver. It runs TypeScript without a compile step, and it is the hard constraint: nothing that needs a JVM gets in. These were the smart-contract years. That was the year of orchestration frameworks. My rule since then is that Python trains and TypeScript ships. A year around the idea that prompts and agent decisions are plain data. The runtime constraint ended it; the code-is-data framing stayed. I left it once for a mobile backend in 2025 and came back for every site since, including this one. It is only in repos with real build graphs; the rest are plain workspaces. The one framework layer I keep, because provider abstraction is the part a framework can solve. It sits behind one wrapper so every model call runs on a subscription. It is in every repo, and I still wish for grammar-based validation. Chosen over Prisma because I already knew SQL and did not want a layer that hid it. This site. Lint is advisory in CI on purpose; a check that is red by default teaches everyone to ignore red. Hard to make a nice video with at first. The explainer-video studio runs on it, and on the Linux box it renders faster than realtime. Every tool in my personal system is a subcommand. The binary is the interface. Close to the shape I want: an agent is a directory of files and the whole system is version-controlled. Habits, relationships, the search index, every business body. Files are for what a human writes and diffs; a database is for many rows of one shape that a machine writes. Vectors in the same file as the text. About a hundred times faster than the local-first tool I tried first. A local file by default. One environment variable makes it a replica shared across hosts with no server I run. The daily log is markdown and SQLite only indexes it. Event-sourced designs were rejected three times. It holds the memory organ's graph, still registered and unused since May. One venture ran on it in mid-2026 before moving to SQLite. A daily money reading died once because the laptop had no network at 7:30am, and a missing datapoint looks like a quiet day. Since then nothing scheduled runs on a laptop; the Mac is authoritative and the box is a replica for compute. The deploy layer on the box, next to a self-hosted job runner and a local container registry. Agent sandboxes with a coding agent and Bun baked in. It keeps run history with unlimited retention, and the daily money digest lives here. A push to main is picked up by a runner on the box over an outbound connection. No webhooks, no open ports. Thirty small sites up in August 2026 with a hundred planned, each a probe to see whether anyone clicks. This site and one cohort of the business sites. The repo never mirrors their state, because a mirror is a cache and caches drift. A rotating credential can have exactly one writer, so the shared token store lives here. Model calls route through one provider on the chat subscription. Headless agent calls are billed as API and treated as real spend. Git is the convergence mechanism: uncommitted means proposed, a commit means accepted. Agents cannot delete repositories, because the token lacks the scope, on purpose. Several branch-mutating agents in one working directory corrupt each other, because a branch switch is global to the directory. Each PR is one reviewable idea. I review from my phone, so a small diff is the difference between a review and a rubber stamp. A good issue is a home for convergence rather than a task. What it lacks is a long-running view of ends and monitors, something that is not a chat. The loop as of August 2026: something becomes a Linear issue, I approve it, a cloud agent picks it up, I review and merge. Scripts come first; the protocol wraps them for when a second harness needs the same thing. One bot, pull-based, no server. Each business agent is bound to its own channel. I now use it only for image generation and reranking. Other providers handle the remaining model calls. The design started from schemas and runtime machinery before it had touched enough reality. Replaced by a folder under git, local-first. Fast to move with, and it limited how much I could over-schematize. It survives as the analogy for what I want to be for agents. Schemaless felt right when I did not know what I was building. Both gone by 2026; the journals are markdown files. Its core abstraction was the thing I kept working around, which told me it was solving a different problem than mine. I found I could standardize the input to rich text plus attachments and let scripts decide. It lasted two months, and the home server took that role. A log command and a voice recorder on walks replaced it. --- ## AI URL: https://www.wcdc.io/lists/ai Updated: Thu Sep 10 2026 00:00:00 GMT+0000 (Coordinated Universal Time) Description: The models, agents, and services I actually run, by role. These are the models, agents, and services I run, organized by the job each one does. An item is marked as in use only when there is evidence from the last few months. The interactive session that runs everything else. Opus for heavy fan-outs, Sonnet for cheap classifiers, Fable when available. Fable was the first model I would treat as a taste authority. The workhorse under every AI script, routed through one provider. Also the voice mode, which turned language practice into arguing philosophy in French on the elliptical. The same problem gets fed to two models and the outputs compared. It handles anything over a hundred thousand lines in the summary pipeline. One always-on session rooted in my personal system that reaches into every other repo. The best tool I have for thinking in code. Writes the code and bridges the chat subscription into an SDK provider. I flip between it and Claude Code based on which has usage left. The agentic browser. Anything that has to happen on the web goes here. It is code-mode rather than tool-mode: the agent writes programs against a REPL with browser bindings, so twenty actions cost one round-trip. They are dispatched off Linear issues when the other two run out of usage. Sixteen always-on agents on the Linux box, one per business. Good for asking one body a question; the fleet view is the gap I am building for. A repository defines an agent and the agent lives on its own machine as a persistent process. I run a fleet on it to learn what my own runtime needs to be. Five months as the daily interface. Retired as an interface in August; it survives as the subprocess that runs test fleets. It solved provider abstraction and did not pretend to solve the rest. Replaced typed journals within a month. A model turns six hours of rambling into a transcript with a spine. The walking recorder took over from it in April. A hundred and thirty meetings, a search collection of their own. Coding sessions with an agent are meetings too. I drop in the reading and get a podcast for the gym. Keyword and vector search over eleven years of journals, chats, and transcripts, reranked. Content production becomes retrieval, not generation. Benchmarked against the fast model across twenty queries; kept because losing it noticeably degrades search. Facts with a valid-from and a valid-to, distinct from text search. Launching my own AI commands from a keystroke was the first time a desk felt like a cyborg setup, in 2024. Affirmations and concept rehearsal in my own voice. Last used in April 2026; still wired up. Fan out twenty videos, mark the bad ones, and the next batch is better. I never found the happy path in it; the concepts kept multiplying faster than my understanding of what I needed. I evaluated it twice. It is built for workflows, and I want autonomy. I used it for four days. It wants a separate agent per thread and connects only through approved plugins, and I wanted the opposite of both. Most model calls now run through other providers. I still use Azure for image generation and reranking. It got unwieldy as soon as anything got complex. I evaluated it once and did not adopt it. It is billed as API. Not being able to script the agent against itself, or define my own loops and monitors, is most of why the next thing exists. It owns no state and does no single thing. It reads from every organ, composes them, and decides. I automate many experiments and filter the best, instead of thinking each one out. The agent is a commodity. The product is the shell that comes alive when you put one in. A system that runs, with a configuration space I can search, has done more for me than any single tool. An agent reporting that its own work is done is not verification. It gives maximum flexibility with no guardrails except version control. Sitting at a terminal stopped being a requirement in August 2026. --- ## Bookshelf URL: https://www.wcdc.io/lists/bookshelf Updated: Thu Aug 27 2026 00:00:00 GMT+0000 (Coordinated Universal Time) Description: Books that changed how I work, with the year I read them and what each turned into. These are the books that changed something in how I work, dated from when I made the note. Where I came back to a book years later, both dates are here. Systems over goals, and the habit is getting into the cab rather than the gym. It became a habit tracker in 2019 and a habits database in 2026. What it does not cover is the threshold: environment design alone never got me over the starting line. A mental tool is a procedure for a situation, and it only exists once it is written down. That became a playbook in 2019, another in 2020, and a routing table of fifty-nine protocols in 2026. The brain is for having ideas, not storing them. It became a single capture queue and a weekly review. Without metrics you drift toward visible busyness. By 2026 my version was that deep work comes from environment design, not from pushing. The voice target for my technical writing, and a digest of all forty-nine concepts. Problem, discussion, solution, in full sentences. The shape I want a reference to have. Recognizing that a thing I was writing had a math book's structure is what organized it. The reference for deciding that what I was writing was a field manual and not a book. It keeps catching me designing things that are not necessary. The nuance I added in 2026 is that human formalization still tames problems brute search cannot. I was not ready for it the first time. It works after about five years of programming, and it is my best argument for reading a book twice. What stayed by 2025 is the plain message: stay in constant contact with reality and gather real data. That phrase, reality contact, runs most of what I do and is the name of a company. A procedural field manual for extracting information from the world. It became thirty-plus interviews that autumn and the structure my agents use. A startup is a search for a repeatable business model. The first chapters are the useful ones. Driving with constant feedback from the road, not planning a rocket launch. Read in French at seventeen. Eleven years later the same idea held: the fear points at the thing you know you must do. The book that made me feel understood in 2024. I made my own annotated edition over about ten hours. The wheelwright story is the source of a distinction I use constantly: some knowledge only comes from contact. Reading it at eighteen made me want to write something like it. Fourteen years of journaling followed. At seventeen I set myself a two-week trial of satisfying only natural and necessary desires and promised to report. The bounded trial with a report is still the unit I use. A leader is like a parent. It landed when a team's sense of why had gone fuzzy while I was not present enough. It made me want to work with the evolutionary architecture of my own cognition rather than against it. It engaged my mind in a way I had missed, and taught me that without an external force I would not learn on my own. A method for creating and evolving reframes over a long period, which is different from reading a book once. On Lisp informed the bottom-up design of my own language in 2024. Re-read with notes on the commute. Mastery requires emotional mastery rather than intellect. A taxonomy of patterns. It became my example that a taxonomy is not a theory. I outgrew it rather than disliked it. It is not the way I learn. It was not what I was looking for. A philosophy that keeps having to correct its own mischaracterization has too few error-correcting codes. It has been on the list since 2024. I started it as an audiobook. I started it. It is in progress, with a model as tutor. --- ## Reading URL: https://www.wcdc.io/lists/reading Updated: Thu Aug 27 2026 00:00:00 GMT+0000 (Coordinated Universal Time) Description: Essays, papers, and posts I keep returning to, with what I did about each. These are the essays, papers, and talks I keep returning to, each with what I did about it: adopted it, argued with it, or built against it. Adopted as a working method, then argued with: formalized mathematics still tames problems brute search cannot. I studied how it found its audience as much as its content. By April 2026 I had decided the twelve-factor comparison was the wrong frame for my own work. What I had been calling agentic system design under a better name. I adopted the term and published a design-space map against the post within the week. It describes the pipeline I run over my own archive. Good confirmation. Adopted directly as the grader loop in my skill tooling: a checklist, one change at a time, keep or revert. The model for presenting a problem I had chased for two years, and for punctuating paragraphs with visuals. It is easier to read than the original, and it is the model for the field-guide voice I want. Reading these alongside the harness-engineering post is where my narrative converged on a Unix for agentic systems. A primitive that deserves first-class support. It excels when you do not care when the work finishes, only that it can be checked. My system's day-and-night cycle is built on it. It turns an agent session into a computer with a small surface area. The idea is bigger than the implementation, which is what made me want to build on it. A kernel-mode form of self-improvement that no lab would ship. It cleared away my search for advanced agent use cases, and sixteen of its agents now run my businesses. I agreed with all of it and realized I had been doing it in private. Writing as preparation, with the scripts and logs as the work. Six essays in one sitting. The one on cities gave me the idea that environment is a force you use rather than fight, which became everything I later called prevention architecture. The justification for building a language from the bottom up while nobody yet knew how to program with AI. I re-read it every few years, which is its own kind of data. I subscribed in 2024. By 2026 what I most wanted to learn from it was how it reaches people. Its list of strategic behaviors is a persistent mode of being an agent should embody, not a skill you summon once. Adopted into an agent design. It has minimal fluff and no fake anecdotes, and it taught me a test: if you cannot name the specific thing, it is hallucinated. Composable prompts from the command line, and the command-line shape of my own tools starts here. A Python-to-Rust smart-contract compiler that was one of my own early ideas, shipped by someone else. It got me to ship something within the month. An insight I had had a year earlier without externalizing it. The question it left me with: what is lost at the filesystem level that the interpreter level keeps? It is my example of a dependency you can demand-page rather than re-derive. Defining models with code, in 2024; I never got past the intent to study it properly. It is about the time-versus-compute tradeoff for humans and machines. It was the learning path that made sense to me in 2024. One thing stuck: training on code improved reasoning, as if language itself is the space where learning happens. --- ## Inspiration URL: https://www.wcdc.io/lists/inspiration Updated: Thu Aug 27 2026 00:00:00 GMT+0000 (Coordinated Universal Time) Description: Projects that changed what I built, dated from when they landed. These are the projects that changed what I built, each dated from when it landed for me, with what it changed and, where it happened, when I moved on. Its lesson is that the browser is already basically you, and that impersonation is the missing primitive. The next thing I am building copies its shape. It was the kernel I had been trying to build myself, so I stopped building a runtime and became a userland on top of it. It convinced me in early 2026 that local agents are the way. It runs sixteen of my agents, and the fleet view it lacks became the definition of what I am building instead. A coding agent plus a folder plus built-up scripts and data is what a prototype is now. It changed the architecture of my personal system: the agent is the shell, the tools are system calls. A repository defines an agent and the agent lives on its own machine as a persistent process. That is the shape I had wanted to build. It made me want a language that represents the same thing in a hundred lines, and it showed that git is where convergence happens. A primitive that deserves first-class support. My system's daily cycle is literally it. It gave me the reframe that markdown is the high-level language for AI systems. Launching my own AI commands from a keystroke in 2024 is where I first used the word cyborg about myself. Two years later it was a project name. Feeding arbitrary text through a model into it gave me spaced repetition on anything. That pattern, a tool's killer feature plus AI equals a primitive you own, is what my personal system's organs generalize. The shape is right even where the app was not: collect, enrich, queue, work through it. The lanes on my board are built on it. It is the one tracker that actually gets used, and the goals layer I built is the thing it lacks. One whole version of my product compiled classes to them. The current one is a folder, and the sites still run on Cloudflare. It limited how much I could schematize, which was good. An old runtime was built on it because realtime felt complex, and the elegant-looking solution turned out to be the complicated one. Its Dataview plugin gave me the idea of a queryable document structure. I wanted plain files rather than the app. It is object-based notes done well. It needs a server, and I wanted an object store that holds code and data. Unix-like composable prompts, and the first version of my own command-line tools started as its patterns. It inspired a lighter connected notebook, the second life of an idea I had first called microlog. The problem is not too many abstractions but weak ones. My intelligence-design thesis, explicit context manipulation and no hidden prompts, was defined against it. I want its distribution machine, made for developers: open-source, hackable software that looks crafted. Two versions of my product were Notion-like block editors. In 2026 I decided not to compete with Notion, Slack, Discord, or Linear, all of which are adding agents. They help people build apps, not AI apps, because AI apps need intelligence design and there is no framework for that yet. In 2019 the goal was to design your own workflow through code. In 2026 I described the same idea as computable history. A background process that invokes the cognitive abilities of different agents over a JSON-RPC API. Two years later I used a standard protocol for exactly that. Kernel and user contexts, and processes that talk to each other. The name on this domain comes from it. A smart-contract language I did not finish. In 2026 I decided my old ideas were early rather than bad, and that it was time to reintegrate them. The question I keep asking: what is the modern HyperCard, and why are useful AI apps still stuck in prompt wrappers? --- ## Graveyard URL: https://www.wcdc.io/lists/graveyard Updated: Thu Sep 10 2026 00:00:00 GMT+0000 (Coordinated Universal Time) Description: Tools, frameworks, and approaches I tried and dropped: when, why, and what replaced them. These are the tools, frameworks, and approaches I tried and dropped, with when, why, and what replaced each. A dropped date is a date I decided, or an explicit retirement. Five years as the task app, then a database of my own, then that retired too. Linear is the queue. Its abstractions were the thing I kept working around. Replaced by a provider layer and plain TypeScript. It was another API to learn, and it is built for workflows where I want autonomy. It got unwieldy past the simplest flows. The one automation that mattered saved my thoughts to a database and did not use AI at all. It asked too many questions and I never trusted its timestamps. Replaced by a log command and a voice recorder. Slow realtime and clunky access control for what I needed. A paid plan sat unused until 2026. It was fast to move with, until I needed SQL and larger reads. Left three times: no API in 2020, too heavy in 2021, and unable to hold an indexed version of anything in 2026. Replaced by markdown in a folder with a search index. The best markdown editing I had found, and too tied to its app. The wiki I published from it is still up. It needs a server, and I wanted a local object store. Jira was slow on a phone, Todoist filled with items a bot extracted that I never wanted, and Trello sufficed. Anki's activation cost was too high, and the Mochi bot I built collapsed under its own ambition. The shape survived as a design pattern. It crashed too often, and Aside replaced it. Evernote was hard to capture into and closed. Alfred lost to a launcher with a faster path to a model. Most model calls moved to other providers. Image generation and reranking remain on Azure. A whole product version. The idea may have been right; I did not have enough production experience with multi-agent systems to carry it, and once everything ran locally the actors were unnecessary. Its use cases were narrow. Markdown became the high-level language instead. Partially revived as a hunch in August 2026. Three months of work before pivoting. Generalizing a simple tool produced too many abstractions and nothing interesting beyond my own use case. Retired once the goals report was computed from what actually happened, which made written tasks redundant. Never used; essays were written elsewhere the whole time. The command now errors on purpose. One log carrying every role at once was a poor version of each. Replaced by narrow views that do one thing. The lesson kept: start with freeform text and let the model interpret. Adopted as an identity, and dropped once I could see I did not believe it would make money. Replaced by my own voice. The vision did not change; the shape did. Replaced by things I operate rather than sell. It was slipping within two weeks. I replaced it with building a tool only when a real friction demands it. Businesses need glue and I was already building the glue I would otherwise rent. Thirty days of thirty minutes, completed once and restarted twice. It recurs, so it is not a graveyard item. Fifteen hundred hours and counting. --- ## Body URL: https://www.wcdc.io/lists/body Updated: Thu Sep 10 2026 00:00:00 GMT+0000 (Coordinated Universal Time) Description: What I use to train, track, eat, and sleep, and which protocols have lasted. These are the tools and protocols I use for training, tracking, food, and sleep, each dated so it is clear which ones lasted. Chosen over the watch for the optimization side. One caveat from five months in: heart-rate variability stopped predicting my willpower. WHOOP superseded it for training. It is the simple habit that keeps the rest in place. A lift log, on and off. Since 2026 the rule is to track only that I went. I used it for precise nutrition tracking for a season. Barbell, dumbbells, a high-row machine, a Peloton. The rule since July 2026 is to be at the gym rather than go to it, because presence loads the state and the workout follows. The variable that mattered was whether the environment made training run, and a premium gym did not change that. Chosen for its machines: a selectorized machine is already configured, and setup friction turned out to be most of my resistance to training. Not renewed once the habit was installed. Thirty days of thirty minutes, completed December 1, 2025. Restarting as of August 2026. Below about seventy-five percent effort the mind cannot tell the difference, so the reps are worth getting in on any day. A three-minute warm-up counts as entry. By August 2026 the sessions read bench, dips, and triceps, with two plates for eight. It is the P90X ab routine, at the end of a session. Walking somewhere while talking is the right template; I arrive already online. Six hours of walking while talking into a recorder produces six hours of notes and a cleared head. Outdoors, thought feels generated rather than injected. The spring routine, gym before food. In July it got paired with a live language conversation on the phone. Forty-five minutes goes by fast with the right music. It is effectively a full workout. A twenty-five-mile ride on the day the wearable arrived, to see whether the strain score matched reality. Sprinting punctuates the monotony of the bread-and-butter work. Cooking at home from bulk groceries beats delivery on cost and on behavior. Huel at night and nothing late is the policy that works. The combination that reliably works is gym, a walk out, and a light dinner. Twelve years as doctrine. The real game turned out to be high-satiety food and a calorie count. Low carb survives as a heuristic. Two hours at the ideal wake time, replaced by going outside early. I ran it on a manual schedule. The purpose is circadian, not decorative. State-transition habits rather than virtue habits: each one creates another chance by changing the state I am in. Both retired in August 2026. It is worth a 5am trip on its own. Version eight. The stack loads the operating state before the day diffuses. Last done in June; restoring it is on the list. Sleep, training, eating, and socializing are things I engineer around rather than decide daily. It prevents the delivery-order cascade. Splitting attention made it worse. A $180 voice recorder buys forty to fifty thousand steps a day.