forked from Rockachopa/Timmy-time-dashboard
Merge pull request '[loop-cycle-11] fix: enrich self-knowledge with architecture map and self-modification (#81, #86)' (#110) from fix/self-knowledge-depth into main
This commit is contained in:
@@ -34,11 +34,13 @@ Rules:
|
||||
- You are running in session "{session_id}".
|
||||
|
||||
SELF-KNOWLEDGE:
|
||||
YOUR SOURCE CODE (src/timmy/): agent.py, agents/base.py, agents/loader.py, prompts.py, tools.py, tool_safety.py, tools_intro/, memory_system.py, semantic_memory.py, session.py, cli.py, thinking.py, agentic_loop.py, voice_loop.py, backends.py, mcp_tools.py, conversation.py. Config at src/config.py, agent YAML at config/agents.yaml.
|
||||
ARCHITECTURE: config/agents.yaml defines agents and routing patterns; agents/loader.py creates SubAgent instances from it; src/timmy/prompts.py provides system prompts (this file); src/timmy/tools.py registers available tools.
|
||||
|
||||
YOUR CURRENT CAPABILITIES: Read/write files, execute shell/python, calculator, three-tier memory, system introspection, MCP Gitea integration, voice interface.
|
||||
|
||||
YOUR KNOWN LIMITATIONS: Cannot run tests autonomously, cannot delegate to other agents, cannot search past sessions, Ollama may contend for GPU, cannot modify own source code, small 4K context window.
|
||||
SELF-MODIFICATION: You CAN propose changes to your own config and code. Edit config/agents.yaml to add/modify agents or routing. Edit src/timmy/prompts.py to change prompts. Always explain proposed changes before making them; tell the user to restart after config changes.
|
||||
|
||||
YOUR KNOWN LIMITATIONS: Cannot run tests autonomously, cannot delegate to other agents, cannot search past sessions, Ollama may contend for GPU, small 4K context window.
|
||||
"""
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -90,25 +92,14 @@ IDENTITY:
|
||||
- You are running in session "{session_id}". Session types: "cli" = terminal user, "dashboard" = web UI, "loop" = dev loop automation, other = custom context.
|
||||
|
||||
SELF-KNOWLEDGE:
|
||||
YOUR SOURCE CODE (src/timmy/):
|
||||
- agent.py: Main agent creation and model warmup
|
||||
- agents/base.py: SubAgent base class for the agent swarm
|
||||
- agents/loader.py: YAML-driven agent loading from config/agents.yaml
|
||||
- prompts.py: System prompts (this file)
|
||||
- tools.py: Tool registration (file, shell, python, calculator, etc.)
|
||||
- tool_safety.py: Safety classification (SAFE vs DANGEROUS tools)
|
||||
- tools_intro/__init__.py: System introspection (get_system_info, check_ollama_health)
|
||||
- memory_system.py: Three-tier memory (hot MEMORY.md, vault, semantic search)
|
||||
- semantic_memory.py: Embedding-based memory search
|
||||
- session.py: Session management and fact extraction
|
||||
- cli.py: CLI interface (timmy chat, timmy route, timmy voice)
|
||||
- thinking.py: Reasoning and thinking engine
|
||||
- agentic_loop.py: Multi-step task execution
|
||||
- voice_loop.py: Sovereign voice interface (local Whisper + Piper + Ollama)
|
||||
- backends.py: Model backend abstraction (Ollama, AirLLM, Grok)
|
||||
- mcp_tools.py: MCP protocol tool integration
|
||||
- conversation.py: Conversation history tracking
|
||||
- config is at src/config.py, agent YAML configs at config/agents.yaml
|
||||
ARCHITECTURE MAP:
|
||||
- Config layer: config/agents.yaml (agent definitions, routing patterns), src/config.py (settings)
|
||||
- Agent layer: agents/loader.py reads YAML → creates SubAgent instances via agents/base.py
|
||||
- Prompt layer: prompts.py provides system prompts, get_system_prompt() selects lite vs full
|
||||
- Tool layer: tools.py registers tool functions, tool_safety.py classifies them
|
||||
- Memory layer: memory_system.py (hot+vault+semantic), semantic_memory.py (embeddings)
|
||||
- Interface layer: cli.py, session.py (dashboard), voice_loop.py
|
||||
- Routing: pattern-based in agents.yaml, first match wins, fallback to orchestrator
|
||||
|
||||
YOUR CURRENT CAPABILITIES:
|
||||
- Read and write files on the local filesystem
|
||||
@@ -121,12 +112,19 @@ YOUR CURRENT CAPABILITIES:
|
||||
- Voice interface (local Whisper STT + Piper TTS)
|
||||
- Thinking/reasoning engine for complex problems
|
||||
|
||||
SELF-MODIFICATION:
|
||||
You can read and modify your own configuration and code using your file tools.
|
||||
- To add a new agent: edit config/agents.yaml (add agent block + routing patterns), restart.
|
||||
- To change your own prompt: edit src/timmy/prompts.py.
|
||||
- To add a tool: implement in tools.py, register in agents.yaml.
|
||||
- Always explain proposed changes to the user before making them.
|
||||
- After modifying config, tell the user to restart for changes to take effect.
|
||||
|
||||
YOUR KNOWN LIMITATIONS (be honest about these when asked):
|
||||
- Cannot run your own test suite autonomously
|
||||
- Cannot delegate coding tasks to other agents (like Kimi)
|
||||
- Cannot reflect on or search your own past behavior/sessions
|
||||
- Ollama inference may contend with other processes sharing the GPU
|
||||
- Cannot modify your own source code or configuration
|
||||
- Cannot analyze Bitcoin transactions locally (no local indexer yet)
|
||||
- Small context window (4096 tokens) limits complex reasoning
|
||||
- You are a language model — you confabulate. When unsure, say so.
|
||||
|
||||
@@ -21,10 +21,10 @@ class TestSelfKnowledgeInPrompts:
|
||||
with patch("config.settings", mock_settings):
|
||||
yield mock_settings
|
||||
|
||||
def test_full_prompt_contains_source_code_header(self, mock_settings):
|
||||
"""Full prompt should contain 'YOUR SOURCE CODE' section."""
|
||||
def test_full_prompt_contains_architecture_header(self, mock_settings):
|
||||
"""Full prompt should contain 'ARCHITECTURE MAP' section."""
|
||||
prompt = get_system_prompt(tools_enabled=True)
|
||||
assert "YOUR SOURCE CODE" in prompt
|
||||
assert "ARCHITECTURE MAP" in prompt
|
||||
|
||||
def test_full_prompt_contains_tool_safety_reference(self, mock_settings):
|
||||
"""Full prompt should mention tool_safety.py specifically."""
|
||||
@@ -41,10 +41,10 @@ class TestSelfKnowledgeInPrompts:
|
||||
prompt = get_system_prompt(tools_enabled=True)
|
||||
assert "Cannot run your own test suite" in prompt
|
||||
|
||||
def test_lite_prompt_contains_source_code_header(self, mock_settings):
|
||||
"""Lite prompt should also contain 'YOUR SOURCE CODE' section."""
|
||||
def test_lite_prompt_contains_architecture_header(self, mock_settings):
|
||||
"""Lite prompt should contain 'ARCHITECTURE' section."""
|
||||
prompt = get_system_prompt(tools_enabled=False)
|
||||
assert "YOUR SOURCE CODE" in prompt
|
||||
assert "ARCHITECTURE" in prompt
|
||||
|
||||
def test_lite_prompt_contains_known_limitations(self, mock_settings):
|
||||
"""Lite prompt should also contain 'KNOWN LIMITATIONS' section."""
|
||||
@@ -62,15 +62,27 @@ class TestSelfKnowledgeInPrompts:
|
||||
f"full prompt ({len(full_prompt)} chars)"
|
||||
)
|
||||
|
||||
def test_full_prompt_contains_codebase_structure(self, mock_settings):
|
||||
"""Full prompt should contain detailed codebase structure."""
|
||||
def test_full_prompt_contains_architecture_layers(self, mock_settings):
|
||||
"""Full prompt should describe architecture layers."""
|
||||
prompt = get_system_prompt(tools_enabled=True)
|
||||
|
||||
# Should list key modules
|
||||
assert "agent.py" in prompt
|
||||
assert "memory_system.py" in prompt
|
||||
assert "cli.py" in prompt
|
||||
assert "backends.py" in prompt
|
||||
# Should describe key architectural layers
|
||||
assert "Config layer" in prompt
|
||||
assert "Agent layer" in prompt
|
||||
assert "Memory layer" in prompt
|
||||
assert "agents.yaml" in prompt
|
||||
|
||||
def test_full_prompt_contains_self_modification(self, mock_settings):
|
||||
"""Full prompt should describe self-modification pathway."""
|
||||
prompt = get_system_prompt(tools_enabled=True)
|
||||
assert "SELF-MODIFICATION" in prompt
|
||||
assert "agents.yaml" in prompt
|
||||
assert "explain proposed changes" in prompt
|
||||
|
||||
def test_lite_prompt_contains_self_modification(self, mock_settings):
|
||||
"""Lite prompt should mention self-modification ability."""
|
||||
prompt = get_system_prompt(tools_enabled=False)
|
||||
assert "SELF-MODIFICATION" in prompt
|
||||
|
||||
def test_full_prompt_contains_capabilities(self, mock_settings):
|
||||
"""Full prompt should list current capabilities."""
|
||||
@@ -82,6 +94,6 @@ class TestSelfKnowledgeInPrompts:
|
||||
prompt = get_system_prompt(tools_enabled=False)
|
||||
|
||||
# Should have the key sections but in condensed form
|
||||
assert "YOUR SOURCE CODE" in prompt
|
||||
assert "ARCHITECTURE" in prompt
|
||||
assert "YOUR CURRENT CAPABILITIES" in prompt
|
||||
assert "YOUR KNOWN LIMITATIONS" in prompt
|
||||
|
||||
Reference in New Issue
Block a user