04 · Staying alive and getting smarter
Subconscious memory and self-healing
Corrections and decisions survive the session that learned them, and come back the next time they are relevant. Meanwhile a maintenance layer keeps the whole system alive with no human in the loop.
1 · Remembering
How Valor remembers across sessions
Every session recalls what past sessions learned. The Memory model defines the record schema with embeddings and importance scoring. The memory_search library is the callable API over it: search, save, inspect, status. An MCP server surfaces memory_get and memory_search as tools the agent can call directly mid-session.
Memories arrive from several directions.
- On receipt
- Human Telegram messages are saved as Memory records the moment they arrive.
- After the session
- A post-session extraction pass saves categorized observations: corrections, decisions, patterns, surprises.
- After the merge
- Post-merge learning extraction distills pull-request takeaways into high-importance memories.
- On purpose
- Intentional saves record project-level learnings at the highest importance scores.
2 · Recall
The bloom filter and the <thought> stub
Recall happens inside the PostToolUse hook, on every tool call. The hook checks a bloom filter first, and only when the filter says a relevant memory may exist does it inject compact stubs into the agent's context:
<thought id="…">[correction] Never approve a PR without tests</thought>
The stub is many times smaller than the full memory body. When the agent wants the whole story, it pulls the full content on demand through the memory MCP tools. Progressive disclosure keeps context small without losing depth.
Memory also closes its own feedback loop. Outcome detection strengthens or weakens memories based on whether they helped, dismissal tracking decays the importance of ignored ones, and a nightly consolidation pass merges near-duplicates, marking originals as superseded rather than deleting them. Every memory operation fails silently: the memory system never crashes the agent.
3 · Self-healing
Reflections keep the system alive
Valor maintains itself through scheduled reflections and monitoring, all running out of process, entirely outside the request path.
The scheduler
Ticks maintenance and audit jobs on a cadence: code and docs audits, housekeeping, memory cleanup, session cleanup, briefings.
The loop detector
Clusters recently failed sessions by error fingerprint. When it detects a failure loop, it files one deduplicated GitHub issue instead of a pile of noise.
The watchdog
A standalone health checker that detects zombie processes and crash patterns, and triggers restarts on its own authority.
This is the self-healing layer the README promises. Failures are detected, diagnosed, and either repaired or escalated as a single actionable issue, with no human in the loop.
4 · Observability
The dashboard, a human window
A Flask dashboard makes every moving part observable: live views of sessions, health, reflections, and pipeline stage. The application factory in ui/app.py also exposes /dashboard.json, the full system state as a single JSON document.
5 · If you remember three things
The whole system in three sentences
- A message becomes a self-driving task. The bridge hears you, a durable AgentSession in Redis carries the work, and a worker drives it to done.
- The SDLC pipeline is a guarded graph. Plan through Merge, with failure edges that loop back and loop caps that stop the spin.
- It maintains itself. Subconscious memory carries lessons forward. Reflections and a watchdog keep it alive with no human in the loop.