mirror of
https://github.com/razzant/ouroboros.git
synced 2026-08-04 08:09:48 +00:00
Context window is no longer a static per-model table: every window claim is sourced, route-fingerprinted Capability Evidence (provider /models metadata, local n_ctx, or an owner acknowledgement) with a status (confirmed/asserted/unprobeable/failed), persisted atomically. Max context mode is fail-closed — it requires >=1M confirmed/asserted evidence for the active route. Changing the model while Max is on stays friction-free: the change succeeds and context auto-downgrades to Low with a plain notice when the new route can't be confirmed >=1M, but a genuine no-connection during the probe is an error (the model is not saved), and a transient provider outage never erases a prior confirmed record. Multi-project: the agent can now CREATE a NAMED project from chat in one LLM-first call (promote_chat_to_task project_name/title; non-ASCII names get a deterministic hash id while the display name is preserved). A main-chat task converts to a project in one click, auto-named from its title/objective (no prompt, no extra LLM call); project-chat follow-up tasks bind to their project so the main chat shows no stray "turn into project" button and instead a calm pointer that opens the project panel; a converted card becomes a calm indigo project identity (no red "error" look); per-project unread dots sort active projects to the top (server-stored last-viewed); the project status/sleep-wake lifecycle was removed. UI: oval (pill) composer with centered controls; per-thread chat scroll restored on tab/ panel switch instead of jumping to the top. Also: real deadline_at finalization + advisory pacing, polyglot tree-sitter code intelligence for non-Python symbols (query_code op=digest; Python stays on stdlib ast), reflection faculty-atrophy doctrine, BIBLE P1 (Capability Evidence) + P8 (faculty atrophy) clauses, and assorted WS9 tool fixes. New surface: POST /api/owner/capability-ack, ouroboros/capability_evidence.py, data/state/capability_evidence.json. Reviewed by triad (gpt-5.5/gemini-3.5-flash/opus-4.8) + scope (gpt-5.5) + claudexor (gpt-5.5) + an independent adversarial multi-agent audit, against the original plans and the owner's raw message transcript; all confirmed defects fixed, remaining findings evidence-rejected or tracked. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
"""WS6: reflection surfaces a tool-usage profile so the LLM can spot under-use."""
|
||
|
||
from __future__ import annotations
|
||
|
||
from ouroboros.reflection import _tool_usage_profile
|
||
|
||
|
||
def test_tool_usage_profile_counts_and_flags_shell_reader():
|
||
trace = {"tool_calls": [
|
||
{"tool": "run_command", "args": {"cmd": "grep -r foo ."}},
|
||
{"tool": "run_command", "args": {"cmd": "cat src/main.py"}},
|
||
{"tool": "search_code", "args": {"query": "foo"}},
|
||
{"tool": "search_code", "args": {"query": "bar"}},
|
||
{"tool": "read_file", "args": {"path": "x.py"}},
|
||
]}
|
||
profile = _tool_usage_profile(trace)
|
||
assert "search_code×2" in profile
|
||
assert "run_command×2" in profile
|
||
assert "read_file×1" in profile
|
||
# grep + cat via run_command are flagged as shell-as-reader/search.
|
||
assert "shell-as-reader/search" in profile
|
||
assert "2 call(s)" in profile
|
||
|
||
|
||
def test_tool_usage_profile_no_shell_reader_note_when_clean():
|
||
trace = {"tool_calls": [
|
||
{"tool": "query_code", "args": {"op": "symbols"}},
|
||
{"tool": "read_file", "args": {"path": "x.py"}},
|
||
]}
|
||
profile = _tool_usage_profile(trace)
|
||
assert "query_code×1" in profile
|
||
assert "shell-as-reader" not in profile
|
||
|
||
|
||
def test_tool_usage_profile_empty():
|
||
assert _tool_usage_profile({"tool_calls": []}) == "(no tool calls recorded)"
|
||
assert _tool_usage_profile({}) == "(no tool calls recorded)"
|