How shuijiao-ai/as_dev works
YYagent is a Three Kingdoms knowledge assistant with persistent conversations, user-approved tool use, Agentic RAG, skills, and both local CLI and service/client modes. The main workflow is user input → agent response and, when needed, approved knowledge-base retrieval → rendered answer and saved conversation state. The CLI also supports slash commands and session recovery; the service mode supplies a workspace-based AgentScope app. Edges reflect shown calls or documented run modes; the client/server transport details are not shown, so that connection is documented rather than inferred.
Main entry points: service.py Service app · cli_main.py CLI entry · sanguo_agent.py Sanguo agent · chat.py Chat and approvals
Components 22
Agent and knowledge
- Agent loader
YYagent/cli/agent.py - Sanguo agent
YYagent/agents/sanguo_agent.py - LightRAG tool
YYagent/tools/lightrag_tool.py - Review skill
YYagent/skills/review-agent/SKILL.md - Timing middleware
YYagent/middleware/Timing.py
Local CLI
- CLI entry
YYagent/cli_main.py - Chat and approvals
YYagent/cli/chat.py - Stream renderer
YYagent/cli/renderer.py - Command selector
YYagent/cli/selector.py - Slash commands
YYagent/cli/commands.py - CLI settings
YYagent/cli/common.py
Service mode
- Service app
YYagent/service/service.py - Workspace manager
YYagent/service/service.py - Service SQLite state
YYagent/service/service.py - In-memory message bus
YYagent/service/service.py - Service launcher
YYagent/service_main.py - Standalone client
YYagent/client_main.py
Conversation state
- CLI storage
YYagent/cli/storage.py - CLI SQLite state
YYagent/cli/common.py
Other components
- User
- LightRAG service
- DashScope model
Connections 27
- User → CLI entry: enters question
YYagent/cli_main.py - CLI entry → Command selector: reads input
YYagent/cli_main.py - CLI entry → Agent loader: builds agent
YYagent/cli_main.py - Agent loader → Sanguo agent: delegates build
YYagent/cli/agent.py - CLI entry → Chat and approvals: starts chat
YYagent/cli_main.py - Chat and approvals → Sanguo agent: streams reply
YYagent/cli/chat.py - Chat and approvals → Stream renderer: renders events
YYagent/cli/chat.py - CLI entry → Slash commands: dispatches commands
YYagent/cli_main.py - Slash commands → Agent loader: rebuilds agent
YYagent/cli/commands.py - Slash commands → CLI storage: lists sessions
YYagent/cli/commands.py - Command selector → CLI settings: reads command list
YYagent/cli/selector.py - CLI storage → CLI SQLite state: reads and writes
YYagent/cli/storage.py - CLI entry → CLI storage: saves state
YYagent/cli_main.py - Sanguo agent → LightRAG tool: registers tool
YYagent/agents/sanguo_agent.py - Sanguo agent → Timing middleware: uses middleware
YYagent/agents/sanguo_agent.py - Sanguo agent → DashScope model: configures model
YYagent/agents/sanguo_agent.py - LightRAG tool → LightRAG service: queries HTTP
YYagent/tools/lightrag_tool.py - Sanguo agent → Review skill: loads skills
YYagent/agents/sanguo_agent.py - Service app → Service SQLite state: configures storage
YYagent/service/service.py - Service app → In-memory message bus: configures bus
YYagent/service/service.py - Service app → Workspace manager: configures workspace
YYagent/service/service.py - Service app → LightRAG tool: injects tool
YYagent/service/service.py - Service app → Timing middleware: injects middleware
YYagent/service/service.py - Service app → Review skill: seeds workspace
YYagent/service/service.py - Service launcher → Service app: launches app
YYagent/service_main.py - Standalone client → Service app: uses service
README.md - User → Standalone client: uses client
README.md