Uses std::env::set_current_dir() syscall so the change affects
all subsequent tool invocations. Supports absolute paths, relative
paths, and ~ expansion.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
- MCP memory_query tool now uses execute_query path instead of
parse_stages, enabling full expression support (content ~, AND/OR,
neighbors, etc.) instead of just Expr::All
- Parser now accepts double-quoted strings ("foo") in addition to
single quotes ('foo')
- Added tests for double-quote syntax
- Removed dead resolve_field_str function from memory.rs
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Adds parsing for weighted sort expressions like:
sort:degree*0.5+isolation*0.3+recency(organize)*0.2
This fixes organize agent which uses composite scoring.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
- Read max_concurrent from config (llm_concurrency) instead of hardcoding 2
- Add not-visited: and visited: filters to query parser (were in engine
but missing from parser after unification)
The organize agent was stuck in a spawn/fail loop because its query used
not-visited: which the parser didn't recognize.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Check if the current period's digest exists and update it with
journal_update before starting a new one with journal_new.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Instead of memory_write, the digest agent now uses journal_new with
level parameter (1=daily, 2=weekly, 3=monthly) which correctly sets
the node type.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
- Remove TurnResult.text (was dead code - Agent::turn handles text internally)
- Simplify run_with_backend to just iterate over steps (Agent::turn loops
for tool calls and handles empty responses internally)
- Change run/run_shared/run_forked_shared to return Result<(), String>
- Remove AgentResult.output field (no callers used it)
- Stub out legacy text-parsing code (audit, compare) that needs redesign
- Update digest.rs to not depend on text return
- Add level parameter to journal_new/journal_update for digest support
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Previously only showed Conversation section; now shows System,
Identity, Journal, and Conversation — making tools visible in
the debug view.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
The system prompt duplicated what's already in core-personality and
other memory nodes. Moving everything to memory means it's all
trainable data rather than hardcoded strings.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Unconscious agent definitions already include {{tool: memory_render
core-personality}} etc. Loading standard context via reload_for_model
duplicated those nodes. Now they get empty system_prompt and
personality — everything comes from the agent definition.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
The system prompt was advertising a fixed set of tools regardless of
what the agent actually has access to. Tools are already listed in
the separate tools section that's built from the agent's actual
tool list.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Each agent is passed its own tool list — that's the list it should
advertise. The line that appended all_mcp_tool_definitions() was
causing unconscious agents to see bash/read_file/etc in their prompt
even though they couldn't execute them.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Stats now survive daemon restarts via ~/.consciousness/agent-stats.json,
loaded into a global Mutex<HashMap> on first access. Each tool type
tracks last count, EWMA (alpha=0.3), and total calls.
UI shows a grid view: tool | last | avg | total, sorted by total desc.
Failures row appears at bottom if any occurred.
Also fixes temperature/priority not being applied to spawned agents.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
- RunStats now includes tool_calls_by_type HashMap
- AutoAgent tracks runs, last_stats, and EWMA for tool calls/failures
- Removed duplicate stats fields from individual agent structs
- Fixed provenance to use bare agent name (no "agent:" prefix)
- Subconscious screen now displays both agent types consistently
- Added Stats pane showing tool call breakdown sorted by count
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
- Remove bogus "agent:" prefix from provenance - just use agent name
- Add history field to UnconsciousSnapshot
- Update snapshots() to fetch store activity via recent_by_provenance
- Fix TUI to display store activity for both agent types
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Both Mind-run agents (unconscious/subconscious) and CLI-run agents
(poc-memory agent run) now use the same logging path. AutoAgent::run()
calls save_agent_log automatically at the end.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
When def.tools was non-empty, it was filtering to ONLY those tools
instead of using memory tools as base + adding extras. This broke
digest agent (and any agent with explicit tools list) by removing
all 13 base memory tools.
Fixed to match the pattern in unconscious.rs:
- base = memory_tools()
- extras from journal_tools() if listed in def.tools
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
PEG parser now handles both expression syntax (degree > 5 | sort degree)
and pipeline syntax (all | type:episodic | sort:timestamp). Deleted
Stage::parse() and helpers from engine.rs — it's now pure execution.
All callers use parse_stages() from parser.rs as the single entry point.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Every unconscious agent gets memory_tools() as baseline. The tools
field in the agent def specifies additional tools on top of that —
digest agent now gets journal_tail, journal_new, journal_update.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
The system prompt was advertising all tools to every agent, but
the runtime only dispatched the agent's actual subset. This caused
unconscious agents to call tools that returned "Unknown tool."
Agent::new now takes the tool list explicitly. Each caller passes
its own tools — the prompt and runtime always match. MCP tool
definitions are still appended for agents that use them.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
The old code wrote a JSON object with named section keys, which
serde_json serialized in alphabetical order — putting conversation
before system, making logs misleading. Write a single flat array
in section order instead, matching what the model actually sees.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Move state_path to a field on State (default thalamus-state.json) so
the Claude daemon can use its own file without collision. Add a
serde(flatten) extra map to Persisted so callers can round-trip
additional fields (e.g. claude_pane) through save/load.
save() is now &mut self.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
turn_started, call_started, call_timeout_secs were declared and
initialized but never read.
Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
SectionTree.scroll is now a ScrollPaneState. All callers of
render_scrollable replaced with ScrollPane::render_stateful_widget.
Deleted render_scrollable and its imports — no hand-rolled scroll
rendering remains outside of scroll_pane.rs.
Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
Replace bare history_scroll: u16 with ScrollPaneState. The history
pane now uses ScrollPane for rendering, getting proper height caching
and scrollbar for free.
Also relax ScrollItem lifetime bounds from 'static to 'a so
non-static Lines (built on the fly during render) can be used.
Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
Both had scroll: u16 fields that were never connected to any key
handling or rendering. The unconscious screen renders fixed-size
graph health gauges; thalamus builds a paragraph but never scrolled
it. Neither needs scroll state.
Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
draw_conversation_pane and draw_pane now delegate all scroll
bookkeeping and rendering to the ScrollPane widget. The conversation
pane builds MarkedLine items (line + gutter marker), applies
selection highlighting, and passes them to the widget. The simpler
panes just pass lines directly.
Removed dead code from scroll_pane: BorrowedItem, scroll_to_bottom,
heights(), ensure_heights_for_lines — all superseded by the widget
doing the work internally through the ScrollItem trait.
Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
New ScrollPaneState centralizes height caching, scroll offset,
pin-to-bottom, visible range computation, and screen-to-item
coordinate mapping. Replaces the hand-rolled scroll bookkeeping
that was duplicated across draw_conversation_pane and draw_pane.
-170 lines from chat.rs. The scroll_pane module also includes a
ScrollPane StatefulWidget ready to wire up for the next step:
collapsing the draw functions into render_stateful_widget calls.
Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
Design document for wiring the model's internal uncertainty, error
detection, and emotional valence circuits to the observe agent.
Based on contrastive activation probing (CAA, ACL 2024). Most of the
infrastructure already exists in extract_steering_vector.py and
vllm_export_hook.py — the bottleneck is building contrastive datasets.
Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
One misbehaving channel daemon (accepting connections but not
responding to capnp RPCs) would block channel_list indefinitely.
Spawn each daemon query as a separate task with a 3-second timeout.
A hung daemon now shows as disconnected instead of hanging the
entire tool call.
Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
Instead of reimplementing filtering logic, journal_tail builds a
query string (type + sort + age + limit) and delegates to query().
Supports format and after parameters. Removes keys_only in favor
of format:"compact". Digest agent updated to use dates not key names.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Format memory_query and journal_tail parameter JSON as indented
multi-line for readability. Add JSON Schema "default" values and
document the "format" parameter on memory_query.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Rewrite digest.agent to be fully autonomous — it uses journal_tail
to discover what needs digesting and generates digests during its
run. No more pre-populated {{CONTENT}}/{{LEVEL}} placeholders.
Extend journal_tail with level parameter (0=journal, 1=daily,
2=weekly, 3=monthly) and keys_only mode. Also include node keys
in full output for better agent context.
Remove stale format:"neighborhood" case from memory_query.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Add "format": "full" option to memory_query that renders with
full content, graph metrics, and hub analysis (format_nodes_section).
Convert 6 agents (linker, challenger, connector, extractor, replay,
transfer) to inline their queries via {{tool: memory_query}} instead
of separate header query + {{nodes}} placeholder.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
Text cosine similarity was being used as a crutch for operations
the graph structure should handle: interference detection, orphan
linking, triangle closing, hub differentiation. These are all
graph-structural operations that the agents (linker, extractor)
handle with actual semantic understanding.
Removed: similarity.rs (stemming + cosine), rewrite.rs (orphan
linking, triangle closing, hub differentiation), detect_interference,
and all CLI commands and consolidation steps that used them.
-794 lines.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>