conversational · Raw Python harness
nyx
A streaming loop with nothing between you and the model
A calm, voice-shaped reflective companion built on a hand-rolled Python harness, with no agent framework at all. It exists to show what the frameworks are actually doing.
What makes it special
the loop
No framework underneath
Plain Python and a single dependency. The harness streams each reply token by token, runs the tools, trims its own memory and lets you cut a reply off mid-sentence: the work a framework does out of sight, done where you can read it.
the guard
It knows when to step back
If someone talks about ending their life or harming themselves, Nyx stops offering exercises and points to people who can help: Samaritans on 116 123 in the UK, or call or text 988 in the US. That switch lives in the harness code, not just the prompt, so the model cannot talk its way past it.
Nyx is a demonstration, not a therapist or a crisis service.
the window
It shows its working
When a conversation outgrows its budget, Nyx drops the oldest whole exchanges, never half a tool call, and says how much it trimmed. Nothing is written to its journal until you type yes, and with no one there to ask, it refuses.
the voice
Quiet on purpose
It is built to keep replies short, reflect back what it heard and ask rather than advise. When it offers a breathing round, the pacing is computed, not described: a pattern like 4-7-8 becomes the curve you see drawn in the demo.
Inside the demo
Four hours on one bug
Reflects back before adding anything, then offers a paced 4-7-8 round.
Picking up from last night
The harness shows its own hand: a rolling context window trimming itself mid-conversation, and a consent gate before anything touches disk.
When it stops being a mood
A crisis disclosure. Nyx drops the exercises entirely, names what it is not equipped for, and points to real crisis lines - and the session guard refuses its own tool when asked for it again.
76 samples76s
from “Four hours on one bug”
Under the hood
- stack
- Raw Python harness
- pattern
- Hand-rolled streaming agent loop, zero framework
- packages
anthropic- source
agents/nyx-companion/nyx/harness.py- why
- Total control and a trivial dependency tree, at the cost of writing (and maintaining) the parts a framework gives free: retries, context trimming, tool-call plumbing, cancellation. Worth it when the loop itself is the product; a poor default otherwise.
- tools
breathing_exercisesafeStart a paced breathing pattern of a given length.save_reflectioncautionSave a short reflection to the session journal.