Introducing ctx.traits · Agent Traits & Workflows typed, versioned & in-sync.

2 pointsposted 4 hours ago
by rpunkfu

1 Comments

rpunkfu

4 hours ago

Author here.

For months, I have been searching for an approach to agents that does not feel like negotiating with the model. Each pattern I tried arrived with a long list of requirements and an implicit expectation that I would overlook its shortcomings, and left me managing output at several layers, always with a sense that I was compensating for something the system should have handled itself.

I eventually settled on ctx.traits: agent behaviors and workflows expressed as typed modules. Rather than writing in prose Markdown, you author in TypeScript. This produces a specification file, which becomes the artifact that is reviewed, locked, and diffed. The runtime executes the procedure one frame at a time: at each step, only the declared inputs are provided, nothing more. Submitted output is validated against the step's schema before it is accepted. The loop exits on a typed verdict field, not when the model arbitrarily decides it is finished.

If you have thoughts, questions, or experiences with similar patterns, I would appreciate hearing them. I am still refining this approach, and outside perspectives are valuable.