clio-agent 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clio_agent-0.5.0/.claude/CLAUDE.md +392 -0
- clio_agent-0.5.0/.gitattributes +7 -0
- clio_agent-0.5.0/.github/workflows/ci.yml +24 -0
- clio_agent-0.5.0/.github/workflows/release.yml +47 -0
- clio_agent-0.5.0/.gitignore +161 -0
- clio_agent-0.5.0/.pre-commit-config.yaml +7 -0
- clio_agent-0.5.0/AGENTS.md +43 -0
- clio_agent-0.5.0/CHANGELOG.md +164 -0
- clio_agent-0.5.0/CLIO_VISION.md +152 -0
- clio_agent-0.5.0/Dockerfile +17 -0
- clio_agent-0.5.0/LICENSE +45 -0
- clio_agent-0.5.0/PKG-INFO +184 -0
- clio_agent-0.5.0/PLAN.md +648 -0
- clio_agent-0.5.0/README.md +116 -0
- clio_agent-0.5.0/ai-docs/DSPY/00_DSPY_API_REFERENCE.md +1012 -0
- clio_agent-0.5.0/ai-docs/DSPY/01_DSPY_FUNDAMENTALS.md +1016 -0
- clio_agent-0.5.0/ai-docs/DSPY/02_SIGNATURES_GUIDE.md +852 -0
- clio_agent-0.5.0/ai-docs/DSPY/03_MODULES_GUIDE.md +1048 -0
- clio_agent-0.5.0/ai-docs/DSPY/04_OPTIMIZATION_GUIDE.md +1001 -0
- clio_agent-0.5.0/ai-docs/DSPY/05_LM_INTEGRATION.md +1083 -0
- clio_agent-0.5.0/ai-docs/DSPY/06_ADVANCED_PATTERNS.md +1136 -0
- clio_agent-0.5.0/ai-docs/DSPY/07_MULTI_AGENT_SYSTEMS.md +984 -0
- clio_agent-0.5.0/ai-docs/DSPY/README.md +52 -0
- clio_agent-0.5.0/ai-docs/FASTMCP/00_FASTMCP_API_REFERENCE.md +665 -0
- clio_agent-0.5.0/ai-docs/FASTMCP/01_SERVER_CREATION.md +1277 -0
- clio_agent-0.5.0/ai-docs/FASTMCP/02_CLIENT_USAGE.md +831 -0
- clio_agent-0.5.0/ai-docs/FASTMCP/03_COMPOSITION.md +632 -0
- clio_agent-0.5.0/ai-docs/FASTMCP/04_TRANSFORMS.md +965 -0
- clio_agent-0.5.0/ai-docs/FASTMCP/05_DEPLOYMENT.md +1058 -0
- clio_agent-0.5.0/ai-docs/FASTMCP/06_TESTING.md +873 -0
- clio_agent-0.5.0/ai-docs/FASTMCP/07_CLIO_PATTERNS.md +1384 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/Agent-SDK-reference-Python.md +1848 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/custom-tools.md +740 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/mcp-agent-sdk.md +361 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/migrate.md +327 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/overview.md +116 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/permissions.md +566 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/session.md +237 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/slash-commands.md +480 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/streaming-input.md +295 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/subagents.md +256 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/system-prompt.md +479 -0
- clio_agent-0.5.0/ai-docs/claude-agent-sdk/todo-lists.md +160 -0
- clio_agent-0.5.0/ai-docs/developer/UV_SCRIPTS_GUIDE.md +1370 -0
- clio_agent-0.5.0/ai-docs/developer/gpt-oss-response.md +962 -0
- clio_agent-0.5.0/data/atmospheric.h5 +0 -0
- clio_agent-0.5.0/data/dirty_measurements.parquet +0 -0
- clio_agent-0.5.0/data/measurements.parquet +0 -0
- clio_agent-0.5.0/data/observations.csv +51 -0
- clio_agent-0.5.0/data/sensors_raw.h5 +0 -0
- clio_agent-0.5.0/docker-compose.yml +22 -0
- clio_agent-0.5.0/docs/ARC_MEMORY_LAYER.md +956 -0
- clio_agent-0.5.0/docs/CAPABILITIES_MATRIX.md +66 -0
- clio_agent-0.5.0/docs/CLIO_AGENT_ARCHITECTURE.md +1094 -0
- clio_agent-0.5.0/docs/CODEX_BRIDGE.md +93 -0
- clio_agent-0.5.0/docs/CONTRIBUTOR_QUICKSTART.md +60 -0
- clio_agent-0.5.0/docs/EXPERT_SYSTEM_DESIGN.md +175 -0
- clio_agent-0.5.0/docs/LAB_ANNOUNCEMENT.md +85 -0
- clio_agent-0.5.0/docs/LAB_USER_NOTES.md +88 -0
- clio_agent-0.5.0/docs/MCP_TOOL_INTEGRATION.md +383 -0
- clio_agent-0.5.0/docs/PERMISSIONS.md +102 -0
- clio_agent-0.5.0/docs/SELF_IMPROVEMENT.md +118 -0
- clio_agent-0.5.0/docs/SETUP.md +264 -0
- clio_agent-0.5.0/docs/SYSTEM_IDENTITY.md +154 -0
- clio_agent-0.5.0/docs/images/architecture.png +0 -0
- clio_agent-0.5.0/docs/images/banner.png +0 -0
- clio_agent-0.5.0/docs/images/logo-large.png +0 -0
- clio_agent-0.5.0/docs/images/logo-small.png +0 -0
- clio_agent-0.5.0/docs/providers/meridian.md +136 -0
- clio_agent-0.5.0/docs/tui/01-overview.md +220 -0
- clio_agent-0.5.0/docs/tui/02-agent-graph.md +106 -0
- clio_agent-0.5.0/docs/tui/03-experts.md +89 -0
- clio_agent-0.5.0/docs/tui/04-arc-memory.md +135 -0
- clio_agent-0.5.0/docs/tui/05-tools.md +90 -0
- clio_agent-0.5.0/docs/tui/06-endpoints.md +194 -0
- clio_agent-0.5.0/docs/tui/07-providers-config.md +173 -0
- clio_agent-0.5.0/docs/tui/08-semantics-and-lifecycle.md +272 -0
- clio_agent-0.5.0/docs/tui/09-integration-plan.md +202 -0
- clio_agent-0.5.0/docs/tui/GAPS.md +54 -0
- clio_agent-0.5.0/docs/tui/README.md +56 -0
- clio_agent-0.5.0/docs/tui/REAL_GAPS.md +107 -0
- clio_agent-0.5.0/install/README.md +142 -0
- clio_agent-0.5.0/install/clio +248 -0
- clio_agent-0.5.0/install/clio.cmd +4 -0
- clio_agent-0.5.0/install/clio.ps1 +268 -0
- clio_agent-0.5.0/install/install.ps1 +127 -0
- clio_agent-0.5.0/install/install.sh +170 -0
- clio_agent-0.5.0/install/uninstall.ps1 +118 -0
- clio_agent-0.5.0/install/uninstall.sh +98 -0
- clio_agent-0.5.0/pyproject.toml +157 -0
- clio_agent-0.5.0/scripts/codex_bridge.py +251 -0
- clio_agent-0.5.0/scripts/create_demo_data.py +85 -0
- clio_agent-0.5.0/scripts/gact_smoke_server.py +200 -0
- clio_agent-0.5.0/scripts/homelab-env.sh +92 -0
- clio_agent-0.5.0/singularity.def +28 -0
- clio_agent-0.5.0/src/clio_agent/__init__.py +59 -0
- clio_agent-0.5.0/src/clio_agent/agent.py +1587 -0
- clio_agent-0.5.0/src/clio_agent/arc/__init__.py +44 -0
- clio_agent-0.5.0/src/clio_agent/arc/cache.py +246 -0
- clio_agent-0.5.0/src/clio_agent/arc/context_compiler.py +377 -0
- clio_agent-0.5.0/src/clio_agent/arc/coordinator.py +576 -0
- clio_agent-0.5.0/src/clio_agent/arc/index.py +366 -0
- clio_agent-0.5.0/src/clio_agent/arc/lsm.py +541 -0
- clio_agent-0.5.0/src/clio_agent/arc/memory.py +1137 -0
- clio_agent-0.5.0/src/clio_agent/arc/retrieval.py +414 -0
- clio_agent-0.5.0/src/clio_agent/arc/schema.py +848 -0
- clio_agent-0.5.0/src/clio_agent/arc/storage.py +582 -0
- clio_agent-0.5.0/src/clio_agent/config.py +883 -0
- clio_agent-0.5.0/src/clio_agent/conversation_manager.py +79 -0
- clio_agent-0.5.0/src/clio_agent/errors.py +163 -0
- clio_agent-0.5.0/src/clio_agent/experts/__init__.py +92 -0
- clio_agent-0.5.0/src/clio_agent/experts/analysis_expert.py +559 -0
- clio_agent-0.5.0/src/clio_agent/experts/data_expert.py +481 -0
- clio_agent-0.5.0/src/clio_agent/experts/native_tools.py +66 -0
- clio_agent-0.5.0/src/clio_agent/experts/visualization_expert.py +580 -0
- clio_agent-0.5.0/src/clio_agent/gact/__init__.py +15 -0
- clio_agent-0.5.0/src/clio_agent/gact/app.py +6545 -0
- clio_agent-0.5.0/src/clio_agent/gact/events.py +190 -0
- clio_agent-0.5.0/src/clio_agent/gact/scheduler.py +182 -0
- clio_agent-0.5.0/src/clio_agent/gact/sessions.py +324 -0
- clio_agent-0.5.0/src/clio_agent/gact/types.py +595 -0
- clio_agent-0.5.0/src/clio_agent/gact/user_agents.py +125 -0
- clio_agent-0.5.0/src/clio_agent/gact/workspaces.py +199 -0
- clio_agent-0.5.0/src/clio_agent/harness.py +501 -0
- clio_agent-0.5.0/src/clio_agent/optimizer/__init__.py +27 -0
- clio_agent-0.5.0/src/clio_agent/optimizer/instrumentation.py +246 -0
- clio_agent-0.5.0/src/clio_agent/optimizer/runner.py +236 -0
- clio_agent-0.5.0/src/clio_agent/optimizer/trainer.py +263 -0
- clio_agent-0.5.0/src/clio_agent/optimizer/variants.py +303 -0
- clio_agent-0.5.0/src/clio_agent/providers/__init__.py +8 -0
- clio_agent-0.5.0/src/clio_agent/providers/argonne_auth.py +267 -0
- clio_agent-0.5.0/src/clio_agent/registry/__init__.py +30 -0
- clio_agent-0.5.0/src/clio_agent/registry/capability_matcher.py +197 -0
- clio_agent-0.5.0/src/clio_agent/registry/registry.py +382 -0
- clio_agent-0.5.0/src/clio_agent/runtime/__init__.py +28 -0
- clio_agent-0.5.0/src/clio_agent/runtime/hooks.py +167 -0
- clio_agent-0.5.0/src/clio_agent/runtime/nanoagent.py +181 -0
- clio_agent-0.5.0/src/clio_agent/runtime/status.py +1070 -0
- clio_agent-0.5.0/src/clio_agent/signatures/__init__.py +47 -0
- clio_agent-0.5.0/src/clio_agent/signatures/analysis_sig.py +126 -0
- clio_agent-0.5.0/src/clio_agent/signatures/expert_sig.py +92 -0
- clio_agent-0.5.0/src/clio_agent/signatures/main_agent_sig.py +107 -0
- clio_agent-0.5.0/src/clio_agent/signatures/visualization_sig.py +119 -0
- clio_agent-0.5.0/src/clio_agent/tools/__init__.py +10 -0
- clio_agent-0.5.0/src/clio_agent/tools/execution.py +532 -0
- clio_agent-0.5.0/src/clio_agent/tools/file_policy.py +325 -0
- clio_agent-0.5.0/src/clio_agent/tools/gateway.py +134 -0
- clio_agent-0.5.0/src/clio_agent/tools/servers/__init__.py +7 -0
- clio_agent-0.5.0/src/clio_agent/tools/servers/fs_server.py +135 -0
- clio_agent-0.5.0/src/clio_agent/tools/servers/hdf5_server.py +431 -0
- clio_agent-0.5.0/src/clio_agent/tools/servers/parquet_server.py +257 -0
- clio_agent-0.5.0/src/clio_agent/ui/__init__.py +27 -0
- clio_agent-0.5.0/src/clio_agent/ui/api.py +390 -0
- clio_agent-0.5.0/src/clio_agent/ui/cli.py +839 -0
- clio_agent-0.5.0/tests/__init__.py +35 -0
- clio_agent-0.5.0/tests/conftest.py +101 -0
- clio_agent-0.5.0/tests/test_arc/__init__.py +1 -0
- clio_agent-0.5.0/tests/test_arc/test_cache.py +123 -0
- clio_agent-0.5.0/tests/test_arc/test_context_compiler.py +358 -0
- clio_agent-0.5.0/tests/test_arc/test_coordinator.py +273 -0
- clio_agent-0.5.0/tests/test_arc/test_lsm.py +294 -0
- clio_agent-0.5.0/tests/test_arc/test_memory_coverage.py +405 -0
- clio_agent-0.5.0/tests/test_arc/test_memory_extended.py +188 -0
- clio_agent-0.5.0/tests/test_arc/test_retrieval.py +285 -0
- clio_agent-0.5.0/tests/test_arc/test_shared_context.py +266 -0
- clio_agent-0.5.0/tests/test_arc/test_storage.py +241 -0
- clio_agent-0.5.0/tests/test_core/__init__.py +6 -0
- clio_agent-0.5.0/tests/test_core/test_agent.py +167 -0
- clio_agent-0.5.0/tests/test_core/test_agent_dispatch.py +369 -0
- clio_agent-0.5.0/tests/test_core/test_agent_planner.py +288 -0
- clio_agent-0.5.0/tests/test_core/test_api.py +453 -0
- clio_agent-0.5.0/tests/test_core/test_cli_argparse.py +107 -0
- clio_agent-0.5.0/tests/test_core/test_cli_commands.py +486 -0
- clio_agent-0.5.0/tests/test_core/test_config.py +154 -0
- clio_agent-0.5.0/tests/test_core/test_config_providers.py +399 -0
- clio_agent-0.5.0/tests/test_core/test_errors.py +182 -0
- clio_agent-0.5.0/tests/test_core/test_instrumentation.py +306 -0
- clio_agent-0.5.0/tests/test_core/test_registry.py +273 -0
- clio_agent-0.5.0/tests/test_core/test_runner.py +217 -0
- clio_agent-0.5.0/tests/test_core/test_runtime_status.py +279 -0
- clio_agent-0.5.0/tests/test_core/test_trainer.py +266 -0
- clio_agent-0.5.0/tests/test_core/test_variants.py +236 -0
- clio_agent-0.5.0/tests/test_experts/__init__.py +5 -0
- clio_agent-0.5.0/tests/test_experts/test_analysis_expert.py +291 -0
- clio_agent-0.5.0/tests/test_experts/test_data_expert.py +276 -0
- clio_agent-0.5.0/tests/test_experts/test_visualization_expert.py +220 -0
- clio_agent-0.5.0/tests/test_gact/__init__.py +0 -0
- clio_agent-0.5.0/tests/test_gact/conftest.py +64 -0
- clio_agent-0.5.0/tests/test_gact/test_agent_write.py +109 -0
- clio_agent-0.5.0/tests/test_gact/test_agents_catalog.py +96 -0
- clio_agent-0.5.0/tests/test_gact/test_app_scaffold.py +132 -0
- clio_agent-0.5.0/tests/test_gact/test_cancellation.py +140 -0
- clio_agent-0.5.0/tests/test_gact/test_cluster5.py +164 -0
- clio_agent-0.5.0/tests/test_gact/test_commands.py +89 -0
- clio_agent-0.5.0/tests/test_gact/test_context_files.py +84 -0
- clio_agent-0.5.0/tests/test_gact/test_context_injection.py +138 -0
- clio_agent-0.5.0/tests/test_gact/test_cost_estimate.py +41 -0
- clio_agent-0.5.0/tests/test_gact/test_cost_tracking.py +92 -0
- clio_agent-0.5.0/tests/test_gact/test_diffs.py +101 -0
- clio_agent-0.5.0/tests/test_gact/test_doctor_integrations.py +74 -0
- clio_agent-0.5.0/tests/test_gact/test_fork_and_search.py +106 -0
- clio_agent-0.5.0/tests/test_gact/test_hooks.py +141 -0
- clio_agent-0.5.0/tests/test_gact/test_lm_provider.py +117 -0
- clio_agent-0.5.0/tests/test_gact/test_mcp_servers.py +38 -0
- clio_agent-0.5.0/tests/test_gact/test_memory_stats.py +124 -0
- clio_agent-0.5.0/tests/test_gact/test_metrics.py +74 -0
- clio_agent-0.5.0/tests/test_gact/test_nanoagent_runtime.py +96 -0
- clio_agent-0.5.0/tests/test_gact/test_nanoagents.py +72 -0
- clio_agent-0.5.0/tests/test_gact/test_permission_gate.py +108 -0
- clio_agent-0.5.0/tests/test_gact/test_permissions.py +100 -0
- clio_agent-0.5.0/tests/test_gact/test_plan_edit_modes.py +172 -0
- clio_agent-0.5.0/tests/test_gact/test_post_messages.py +201 -0
- clio_agent-0.5.0/tests/test_gact/test_providers_list.py +29 -0
- clio_agent-0.5.0/tests/test_gact/test_session_export.py +72 -0
- clio_agent-0.5.0/tests/test_gact/test_session_tasks.py +72 -0
- clio_agent-0.5.0/tests/test_gact/test_sessions.py +161 -0
- clio_agent-0.5.0/tests/test_gact/test_sessions_api.py +136 -0
- clio_agent-0.5.0/tests/test_gact/test_sse.py +170 -0
- clio_agent-0.5.0/tests/test_gact/test_streaming.py +81 -0
- clio_agent-0.5.0/tests/test_gact/test_thinking_blocks.py +82 -0
- clio_agent-0.5.0/tests/test_gact/test_tool_telemetry.py +68 -0
- clio_agent-0.5.0/tests/test_gact/test_tools_called.py +98 -0
- clio_agent-0.5.0/tests/test_gact/test_workspaces.py +93 -0
- clio_agent-0.5.0/tests/test_integration/__init__.py +1 -0
- clio_agent-0.5.0/tests/test_integration/test_end_to_end.py +219 -0
- clio_agent-0.5.0/tests/test_integration/test_local_filesystem_smoke.py +385 -0
- clio_agent-0.5.0/tests/test_integration/test_multi_expert.py +316 -0
- clio_agent-0.5.0/tests/test_integration_v0_2/__init__.py +16 -0
- clio_agent-0.5.0/tests/test_integration_v0_2/conftest.py +114 -0
- clio_agent-0.5.0/tests/test_integration_v0_2/test_real_capabilities.py +431 -0
- clio_agent-0.5.0/tests/test_tools/__init__.py +1 -0
- clio_agent-0.5.0/tests/test_tools/test_execution.py +150 -0
- clio_agent-0.5.0/tests/test_tools/test_file_policy.py +83 -0
- clio_agent-0.5.0/tests/test_tools/test_gateway.py +149 -0
- clio_agent-0.5.0/tests/test_tools/test_hdf5_server.py +308 -0
- clio_agent-0.5.0/tests/test_tools/test_parquet_server.py +285 -0
- clio_agent-0.5.0/uv.lock +3578 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
# CLIO Agent Development Rules for AI Agents
|
|
2
|
+
|
|
3
|
+
Essential rules and guidelines for AI agents implementing CLIO Agent.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Core Principles
|
|
8
|
+
|
|
9
|
+
**CLIO Agent IS**: Self-improving autonomous agent for scientific data (not a framework)
|
|
10
|
+
**Architecture**: 3-Tier Orchestration + ARC Memory + Optimizer Layer + IOWarp Integration
|
|
11
|
+
**Internal Engine**: DSPy 3.x (signatures, modules, optimizers) + FastMCP 3.x (tool servers)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Locked-Down Stack
|
|
16
|
+
|
|
17
|
+
### Required Dependencies
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
# Core
|
|
21
|
+
"dspy-ai>=3.1.0" # Agent patterns + optimizers (INTERNAL)
|
|
22
|
+
"fastmcp>=3.0.0" # MCP protocol + gateway composition
|
|
23
|
+
|
|
24
|
+
# UI
|
|
25
|
+
"rich>=14.2.0" # Terminal UI
|
|
26
|
+
|
|
27
|
+
# Memory Layer
|
|
28
|
+
"sortedcontainers>=2.4.0" # B-tree index
|
|
29
|
+
"lru-dict>=1.3.0" # LRU cache
|
|
30
|
+
"msgspec>=0.18.0" # Serialization
|
|
31
|
+
|
|
32
|
+
# Optimizer Layer (Phase 3+)
|
|
33
|
+
"scipy>=1.11.0" # Statistical tests
|
|
34
|
+
"numpy>=1.24.0" # Numerical ops
|
|
35
|
+
|
|
36
|
+
# Tools (Phase 1+)
|
|
37
|
+
"h5py>=3.10.0" # HDF5 MCP server
|
|
38
|
+
"pyarrow>=14.0.0" # Parquet MCP server (Phase 2+)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Forbidden
|
|
42
|
+
|
|
43
|
+
**DO NOT add** without approval:
|
|
44
|
+
- LangChain, CrewAI, AutoGen as core dependencies (external integration only via A2A)
|
|
45
|
+
- Heavy ML frameworks (TensorFlow, PyTorch)
|
|
46
|
+
- Database ORMs (SQLAlchemy)
|
|
47
|
+
- Custom async/sync bridge code (use native DSPy/FastMCP instead)
|
|
48
|
+
|
|
49
|
+
**Python Version**: >= 3.12 (LOCKED)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Critical Rules (NON-NEGOTIABLE)
|
|
54
|
+
|
|
55
|
+
### RULE 1: Follow PLAN.md Phase Order
|
|
56
|
+
- Implement phases sequentially: Phase 1 -> Phase 2 -> ... -> Phase 6
|
|
57
|
+
- Complete tasks within a phase before moving to next
|
|
58
|
+
- Never skip phases or cherry-pick tasks from later phases
|
|
59
|
+
|
|
60
|
+
### RULE 2: Never Break Baseline
|
|
61
|
+
- Main agent, DataExpert, CLI must always work
|
|
62
|
+
- Test before committing: `uv run src/clio_agent/ui/cli.py`
|
|
63
|
+
- If a change breaks baseline, revert first, then fix
|
|
64
|
+
|
|
65
|
+
### RULE 3: DSPy is Internal Implementation Detail
|
|
66
|
+
- Use DSPy internally for signatures, modules, optimizers
|
|
67
|
+
- **DO NOT expose** DSPy in user-facing docs, APIs, or error messages
|
|
68
|
+
- **Exception**: CLAUDE.md and code comments only
|
|
69
|
+
|
|
70
|
+
### RULE 4: All Data Goes Through ARC
|
|
71
|
+
- Store conversations, invocations, metrics in ARC
|
|
72
|
+
- **DO NOT create** separate storage systems, databases, or caches
|
|
73
|
+
|
|
74
|
+
### RULE 5: Tool Curation (Max 5-7 Per Expert)
|
|
75
|
+
- Each expert gets 5-7 high-level curated tools, not every atomic operation
|
|
76
|
+
- Hide implementation complexity behind composite tools
|
|
77
|
+
- Document each tool with an "agent story" (when/why an agent would use it)
|
|
78
|
+
- **DO NOT auto-generate** tools from OpenAPI specs or file system scans
|
|
79
|
+
|
|
80
|
+
### RULE 6: Context is Compiled, Not Concatenated
|
|
81
|
+
- Never dump raw conversation history into prompts
|
|
82
|
+
- Use context compilation pipeline: filter -> compact -> enrich -> assemble
|
|
83
|
+
- Set context budgets per tier (T1: 2K tokens, T2: 4K tokens)
|
|
84
|
+
- **DO NOT concatenate** all ARC data into a single string
|
|
85
|
+
|
|
86
|
+
### RULE 7: Performance Targets
|
|
87
|
+
- Cache hit rate > 85%
|
|
88
|
+
- ARC retrieval < 10ms (O(log N))
|
|
89
|
+
- Tool cache hit rate > 50%
|
|
90
|
+
|
|
91
|
+
### RULE 8: Test Coverage > 80% (Phase 4+)
|
|
92
|
+
- Unit tests for all new code
|
|
93
|
+
- Integration tests for critical paths
|
|
94
|
+
- Use `Client(server)` for in-memory MCP server testing
|
|
95
|
+
- Run `pytest tests/` before committing
|
|
96
|
+
|
|
97
|
+
### RULE 9: Type Hints + Docstrings
|
|
98
|
+
- Type hints on all functions
|
|
99
|
+
- Google-style docstrings
|
|
100
|
+
- Use `Literal` types for routing decisions
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## DSPy 3.x Patterns (Use These)
|
|
105
|
+
|
|
106
|
+
### ChatAdapter for Local Models
|
|
107
|
+
```python
|
|
108
|
+
# Makes ReAct work with LM Studio, Ollama, any chat model
|
|
109
|
+
import dspy
|
|
110
|
+
lm = dspy.LM("openai/model-name", api_base="http://127.0.0.1:1234/v1")
|
|
111
|
+
dspy.configure(lm=lm, adapter=dspy.ChatAdapter())
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Tool.from_mcp_tool() for MCP Bridge
|
|
115
|
+
```python
|
|
116
|
+
# Native bridge: MCP tool -> DSPy tool (replaces mcp_connector.py)
|
|
117
|
+
from fastmcp import Client
|
|
118
|
+
client = Client(server)
|
|
119
|
+
async with client:
|
|
120
|
+
mcp_tools = await client.list_tools()
|
|
121
|
+
dspy_tools = [dspy.Tool.from_mcp_tool(t) for t in mcp_tools]
|
|
122
|
+
agent = dspy.ReAct(signature, tools=dspy_tools)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Per-Request Model Selection
|
|
126
|
+
```python
|
|
127
|
+
# Use dspy.context() instead of global dspy.configure()
|
|
128
|
+
with dspy.context(lm=expert_model):
|
|
129
|
+
result = expert(question=query)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### SIMBA for Agentic Optimization
|
|
133
|
+
```python
|
|
134
|
+
# Designed for multi-step agent tasks (not just single predictions)
|
|
135
|
+
optimizer = dspy.SIMBA(metric=success_metric, max_steps=50)
|
|
136
|
+
optimized_agent = optimizer.compile(agent, trainset=examples)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Typed Outputs
|
|
140
|
+
```python
|
|
141
|
+
# Use Literal for routing decisions (optimizable by DSPy)
|
|
142
|
+
class RoutingSignature(dspy.Signature):
|
|
143
|
+
question: str = dspy.InputField()
|
|
144
|
+
selected_expert: Literal["data", "hpc", "none"] = dspy.OutputField()
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## FastMCP 3.x Patterns (Use These)
|
|
150
|
+
|
|
151
|
+
### Gateway with mount()
|
|
152
|
+
```python
|
|
153
|
+
from fastmcp import FastMCP
|
|
154
|
+
gateway = FastMCP("clio-gateway")
|
|
155
|
+
gateway.mount("/hdf5", hdf5_server)
|
|
156
|
+
gateway.mount("/parquet", parquet_server)
|
|
157
|
+
# Tools namespaced: hdf5_list_datasets, parquet_analyze_schema
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### In-Memory Testing
|
|
161
|
+
```python
|
|
162
|
+
# Test MCP servers without subprocess or network
|
|
163
|
+
from fastmcp import Client
|
|
164
|
+
async def test_hdf5_analyze():
|
|
165
|
+
async with Client(hdf5_server) as client:
|
|
166
|
+
result = await client.call_tool("analyze_dataset", {"filepath": "test.h5"})
|
|
167
|
+
assert result is not None
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Dependency Injection
|
|
171
|
+
```python
|
|
172
|
+
from fastmcp import FastMCP, Depends
|
|
173
|
+
|
|
174
|
+
def get_arc_memory():
|
|
175
|
+
return ARCMemory()
|
|
176
|
+
|
|
177
|
+
@mcp.tool()
|
|
178
|
+
def analyze(filepath: str, arc: ARCMemory = Depends(get_arc_memory)) -> dict:
|
|
179
|
+
# arc is injected, hidden from LLM tool schema
|
|
180
|
+
cached = arc.get_cached_tool_result("hdf5", "analyze", {"filepath": filepath})
|
|
181
|
+
if cached:
|
|
182
|
+
return cached
|
|
183
|
+
# ... actual analysis
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Transforms for Access Control
|
|
187
|
+
```python
|
|
188
|
+
from fastmcp.transforms import Enabled
|
|
189
|
+
# Only expose tools matching a condition
|
|
190
|
+
gateway.mount("/admin", admin_server, transforms=[Enabled(lambda t: user.is_admin)])
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Architecture DOs and DONTs
|
|
196
|
+
|
|
197
|
+
### 3-Tier Hierarchy
|
|
198
|
+
- **DO**: Tier 1 (Main) -> Tier 2 (Experts) -> Tier 3 (Nanoagents via dspy.Parallel)
|
|
199
|
+
- **DON'T**: Skip tiers, mix responsibilities, or have experts call other experts directly
|
|
200
|
+
|
|
201
|
+
### Agent Registry
|
|
202
|
+
- **DO**: Use registry for capability-based routing with typed outputs
|
|
203
|
+
- **DON'T**: Hardcode if/else routing logic or keyword-match routing
|
|
204
|
+
|
|
205
|
+
### ARC Memory
|
|
206
|
+
- **DO**: Check cache before expensive operations; compile context before injection
|
|
207
|
+
- **DON'T**: Skip caching, use O(N) algorithms, or concatenate raw history
|
|
208
|
+
|
|
209
|
+
### MCP Tools
|
|
210
|
+
- **DO**: Use FastMCP mount() gateway pattern; test with Client(server) in-memory
|
|
211
|
+
- **DON'T**: Write custom async/sync bridges, spawn subprocess per tool call
|
|
212
|
+
- **DO**: Curate 5-7 tools per expert with clear agent stories
|
|
213
|
+
- **DON'T**: Auto-generate tools, expose 10+ tools, or duplicate tool functionality
|
|
214
|
+
|
|
215
|
+
### Optimizers
|
|
216
|
+
- **DO**: Validate with statistical significance before deploying optimized variants
|
|
217
|
+
- **DON'T**: Deploy without testing; optimize without sufficient training data (min 50 examples)
|
|
218
|
+
|
|
219
|
+
### System Prompts
|
|
220
|
+
- **DO**: Write 500+ word domain-specific prompts for each expert signature
|
|
221
|
+
- **DON'T**: Use generic "helpful assistant" prompts or share prompts across experts
|
|
222
|
+
|
|
223
|
+
### Model Selection
|
|
224
|
+
- **DO**: Use `dspy.context(lm=...)` for per-request model selection
|
|
225
|
+
- **DON'T**: Mutate global `dspy.configure()` from within expert code
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Development Workflow
|
|
230
|
+
|
|
231
|
+
### Environment setup
|
|
232
|
+
|
|
233
|
+
- Python >= 3.12; [`uv`](https://astral.sh/uv) drives everything (deps + execution).
|
|
234
|
+
- Install deps: `uv sync --extra dev --extra api --extra optimizers`
|
|
235
|
+
- `CLIO_ALLOWED_ROOTS` gates tool file access. The tool-server tests
|
|
236
|
+
write fixtures into the pytest temp dir, so that dir must be on the
|
|
237
|
+
allow list or those tests fail with `outside_allowed_roots`. Unset,
|
|
238
|
+
the file policy defaults to the current working directory, which
|
|
239
|
+
excludes temp paths. Before running the tool tests:
|
|
240
|
+
`CLIO_ALLOWED_ROOTS="$TMPDIR:$PWD" uv run pytest tests/`
|
|
241
|
+
|
|
242
|
+
### Workflow
|
|
243
|
+
|
|
244
|
+
1. Read PLAN.md for current phase and task
|
|
245
|
+
2. Read relevant architecture docs (CLIO_AGENT_ARCHITECTURE, etc.)
|
|
246
|
+
3. Implement with type hints + docstrings
|
|
247
|
+
4. Write tests (using `Client(server)` for MCP, mocks for LM calls)
|
|
248
|
+
5. Test + lint: `uv run pytest tests/ -m "not integration"` then `ruff check src/`
|
|
249
|
+
6. Verify baseline still works: `uv run src/clio_agent/ui/cli.py`
|
|
250
|
+
7. Commit with clear message: `<type>: <description>`
|
|
251
|
+
|
|
252
|
+
### Running CLIO
|
|
253
|
+
|
|
254
|
+
- **Dev (from source):** `uv run src/clio_agent/ui/cli.py`
|
|
255
|
+
- **Deployed:** the `install/` system installs a `clio` launcher CLI
|
|
256
|
+
(`clio start|stop|restart|status|logs|doctor`) alongside the gact
|
|
257
|
+
TUI. See `install/README.md`.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## File Organization
|
|
262
|
+
|
|
263
|
+
### Current Working Files
|
|
264
|
+
```
|
|
265
|
+
src/clio_agent/
|
|
266
|
+
├── config.py # Multi-provider LM configuration
|
|
267
|
+
├── agent.py # Main agent — planner loop (Tier 1)
|
|
268
|
+
├── harness.py # RunTrace, RouteDecision, tool-result normalization
|
|
269
|
+
├── conversation_manager.py # Session conversation state
|
|
270
|
+
├── errors.py # Structured error types
|
|
271
|
+
├── signatures/ # DSPy signatures (planner, expert, chat)
|
|
272
|
+
├── experts/ # Domain experts (Tier 2): data, analysis, visualization
|
|
273
|
+
├── registry/ # Capability-based agent registry + matching
|
|
274
|
+
├── arc/ # ARC memory: cache, B-tree index, LSM, storage, retrieval
|
|
275
|
+
├── optimizer/ # Instrumentation, training, variants, runner
|
|
276
|
+
├── runtime/ # Doctor / runtime status + nanoagent spawn primitive (Tier 3)
|
|
277
|
+
├── providers/ # Provider-specific auth (e.g. Argonne / ALCF)
|
|
278
|
+
├── tools/ # FastMCP gateway, file policy, execution boundary
|
|
279
|
+
│ └── servers/ # HDF5 + Parquet MCP servers
|
|
280
|
+
├── gact/ # GACT v0.2 server — the API surface gact-tui talks to
|
|
281
|
+
└── ui/
|
|
282
|
+
├── cli.py # Interactive CLI + doctor
|
|
283
|
+
└── api.py # REST API
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Common Patterns
|
|
289
|
+
|
|
290
|
+
### Pattern 1: ARC Cache-First
|
|
291
|
+
```python
|
|
292
|
+
cached = arc.get_cached_tool_result(tool, params)
|
|
293
|
+
if cached:
|
|
294
|
+
return cached
|
|
295
|
+
result = execute_tool(tool, params)
|
|
296
|
+
arc.cache_tool_result(tool, params, result)
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Pattern 2: Store Metrics
|
|
300
|
+
```python
|
|
301
|
+
start = time.time()
|
|
302
|
+
result = expert.forward(query)
|
|
303
|
+
arc.store_invocation({
|
|
304
|
+
"duration_ms": (time.time() - start) * 1000,
|
|
305
|
+
"success": True,
|
|
306
|
+
...
|
|
307
|
+
})
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Pattern 3: Registry Routing (Typed)
|
|
311
|
+
```python
|
|
312
|
+
class RoutingSignature(dspy.Signature):
|
|
313
|
+
question: str = dspy.InputField()
|
|
314
|
+
selected_expert: Literal["data", "hpc", "none"] = dspy.OutputField()
|
|
315
|
+
|
|
316
|
+
router = dspy.ChainOfThought(RoutingSignature)
|
|
317
|
+
routing = router(question=query)
|
|
318
|
+
expert = registry.get_agent(routing.selected_expert)
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Pattern 4: Context Compilation
|
|
322
|
+
```python
|
|
323
|
+
# DON'T: raw_context = "\n".join(all_messages)
|
|
324
|
+
# DO:
|
|
325
|
+
compiled = context_compiler.compile(
|
|
326
|
+
query=question,
|
|
327
|
+
session_id=session_id,
|
|
328
|
+
budget_tokens=2000,
|
|
329
|
+
include_procedural=True # what worked/failed before
|
|
330
|
+
)
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Testing Requirements
|
|
336
|
+
|
|
337
|
+
- Unit tests: `tests/test_<module>/`
|
|
338
|
+
- Integration tests: `tests/test_integration/`
|
|
339
|
+
- MCP server tests: use `Client(server)` in-memory (no subprocess)
|
|
340
|
+
- LM tests: mock dspy.LM responses
|
|
341
|
+
- Coverage gate: Phase 1 (50%), Phase 2 (60%), Phase 3 (70%), Phase 4+ (80%)
|
|
342
|
+
- Run before commit: `pytest tests/`
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Error Handling
|
|
347
|
+
|
|
348
|
+
**Graceful Degradation Chain**:
|
|
349
|
+
- IOWarp unavailable -> file-based ARC storage
|
|
350
|
+
- ARC unavailable -> continue without memory (warn user)
|
|
351
|
+
- MCP server down -> pure reasoning mode (no tool calls)
|
|
352
|
+
- Optimizer fails -> keep current variant (no rollback)
|
|
353
|
+
- LM timeout -> retry once, then return partial answer
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## Git Workflow
|
|
358
|
+
|
|
359
|
+
**Commit Format**: `<type>: <subject>`
|
|
360
|
+
- `feat`: New feature
|
|
361
|
+
- `fix`: Bug fix
|
|
362
|
+
- `refactor`: Code refactoring
|
|
363
|
+
- `test`: Tests
|
|
364
|
+
- `docs`: Documentation
|
|
365
|
+
|
|
366
|
+
**Before Commit**:
|
|
367
|
+
- [ ] Tests passing: `pytest tests/`
|
|
368
|
+
- [ ] Lint clean: `ruff check src/`
|
|
369
|
+
- [ ] Baseline works: `uv run src/clio_agent/ui/cli.py`
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Quick Reference
|
|
374
|
+
|
|
375
|
+
**Read First**:
|
|
376
|
+
- `PLAN.md` - What to build (current phase)
|
|
377
|
+
- `docs/CLIO_AGENT_ARCHITECTURE.md` - How it all fits together
|
|
378
|
+
|
|
379
|
+
**Test**:
|
|
380
|
+
```bash
|
|
381
|
+
pytest tests/
|
|
382
|
+
ruff check src/
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**Run**:
|
|
386
|
+
```bash
|
|
387
|
+
uv run src/clio_agent/ui/cli.py
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
**THIS IS YOUR REFERENCE. FOLLOW PLAN.MD. USE NATIVE DSPy/FastMCP PATTERNS.**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop, "v*"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
check:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: astral-sh/setup-uv@v5
|
|
15
|
+
with:
|
|
16
|
+
version: "latest"
|
|
17
|
+
- run: uv sync --extra dev --extra api --extra optimizers
|
|
18
|
+
- run: uv run ruff check src/ tests/ scripts/create_demo_data.py
|
|
19
|
+
- run: bash -n scripts/homelab-env.sh
|
|
20
|
+
- run: uv run mypy src/
|
|
21
|
+
# Coverage floor lowered to 70 as the v0.5 merge brought in
|
|
22
|
+
# large under-tested gact code; tracked in iowarp/clio-agent#31
|
|
23
|
+
# to ratchet back up to 80% as the new code gets tests.
|
|
24
|
+
- run: uv run pytest tests/ -m "not integration" --cov-fail-under=70
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publish clio-agent to PyPI when a version tag is pushed.
|
|
4
|
+
#
|
|
5
|
+
# Uses PyPI Trusted Publishing (OIDC) -- no API token secret needed.
|
|
6
|
+
# One-time setup on PyPI before the first release:
|
|
7
|
+
# PyPI project "clio-agent" -> Settings -> Publishing -> add a
|
|
8
|
+
# trusted publisher:
|
|
9
|
+
# owner: iowarp
|
|
10
|
+
# repository: clio-agent
|
|
11
|
+
# workflow: release.yml
|
|
12
|
+
# environment: pypi
|
|
13
|
+
# If the project doesn't exist on PyPI yet, create it (or do one manual
|
|
14
|
+
# `uv publish --token ...` for the first upload, then switch to OIDC).
|
|
15
|
+
|
|
16
|
+
on:
|
|
17
|
+
push:
|
|
18
|
+
tags:
|
|
19
|
+
- "v*"
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
pypi:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
environment: pypi
|
|
25
|
+
permissions:
|
|
26
|
+
id-token: write # required for PyPI Trusted Publishing (OIDC)
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- uses: astral-sh/setup-uv@v5
|
|
31
|
+
with:
|
|
32
|
+
version: "latest"
|
|
33
|
+
|
|
34
|
+
- name: Verify tag matches package version
|
|
35
|
+
run: |
|
|
36
|
+
tag="${GITHUB_REF_NAME#v}"
|
|
37
|
+
pkg="$(uv version --short)"
|
|
38
|
+
if [ "$tag" != "$pkg" ]; then
|
|
39
|
+
echo "tag $GITHUB_REF_NAME does not match pyproject version $pkg" >&2
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
- name: Build sdist + wheel
|
|
44
|
+
run: uv build
|
|
45
|
+
|
|
46
|
+
- name: Publish to PyPI
|
|
47
|
+
run: uv publish
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# CLIO Agent .gitignore
|
|
2
|
+
# Comprehensive ignore patterns for DSPy agent + UV + HPC scientific computing project
|
|
3
|
+
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# Python & Virtual Environments
|
|
6
|
+
# ============================================================================
|
|
7
|
+
|
|
8
|
+
# Virtual environments
|
|
9
|
+
venv/
|
|
10
|
+
env/
|
|
11
|
+
ENV/
|
|
12
|
+
.venv
|
|
13
|
+
.env
|
|
14
|
+
*.env
|
|
15
|
+
|
|
16
|
+
# Python cache
|
|
17
|
+
__pycache__/
|
|
18
|
+
*.py[cod]
|
|
19
|
+
*$py.class
|
|
20
|
+
*.so
|
|
21
|
+
.Python
|
|
22
|
+
*.egg-info/
|
|
23
|
+
dist/
|
|
24
|
+
build/
|
|
25
|
+
|
|
26
|
+
# pytest
|
|
27
|
+
.pytest_cache/
|
|
28
|
+
.coverage
|
|
29
|
+
htmlcov/
|
|
30
|
+
|
|
31
|
+
# mypy
|
|
32
|
+
.mypy_cache/
|
|
33
|
+
.dmypy.json
|
|
34
|
+
dmypy.json
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# ============================================================================
|
|
38
|
+
# MCP & Tool Artifacts
|
|
39
|
+
# ============================================================================
|
|
40
|
+
|
|
41
|
+
# MCP tool outputs
|
|
42
|
+
mcp_output/
|
|
43
|
+
mcp_logs/
|
|
44
|
+
tool_cache/
|
|
45
|
+
|
|
46
|
+
# Tool-generated files
|
|
47
|
+
tool_output/
|
|
48
|
+
*.tool.log
|
|
49
|
+
mcp_*.log
|
|
50
|
+
|
|
51
|
+
# ============================================================================
|
|
52
|
+
# Development & Testing
|
|
53
|
+
# ============================================================================
|
|
54
|
+
|
|
55
|
+
# IDE files
|
|
56
|
+
.vscode/
|
|
57
|
+
.idea/
|
|
58
|
+
*.swp
|
|
59
|
+
*.swo
|
|
60
|
+
*~
|
|
61
|
+
.DS_Store
|
|
62
|
+
.env.local
|
|
63
|
+
.env.*.local
|
|
64
|
+
|
|
65
|
+
# Testing
|
|
66
|
+
test_output/
|
|
67
|
+
test_*.json
|
|
68
|
+
.pytest_cache/
|
|
69
|
+
|
|
70
|
+
# Temporary files
|
|
71
|
+
tmp/
|
|
72
|
+
temp/
|
|
73
|
+
*.tmp
|
|
74
|
+
*.bak
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# ============================================================================
|
|
78
|
+
# Configuration & Secrets
|
|
79
|
+
# ============================================================================
|
|
80
|
+
|
|
81
|
+
# Environment variables with secrets
|
|
82
|
+
.env
|
|
83
|
+
.env.local
|
|
84
|
+
.env.*.local
|
|
85
|
+
*.env.local
|
|
86
|
+
|
|
87
|
+
# API keys and credentials (CRITICAL - never commit these)
|
|
88
|
+
secrets/
|
|
89
|
+
.secrets/
|
|
90
|
+
credentials.json
|
|
91
|
+
api_keys.json
|
|
92
|
+
*.key
|
|
93
|
+
*.pem
|
|
94
|
+
*.pfx
|
|
95
|
+
|
|
96
|
+
# Configuration that varies per environment
|
|
97
|
+
config.local.py
|
|
98
|
+
settings.local.json
|
|
99
|
+
local_config.yaml
|
|
100
|
+
|
|
101
|
+
# ============================================================================
|
|
102
|
+
# FastAPI/Server Artifacts
|
|
103
|
+
# ============================================================================
|
|
104
|
+
|
|
105
|
+
# FastAPI/Uvicorn
|
|
106
|
+
.uvicorn_socket
|
|
107
|
+
uvicorn.sock
|
|
108
|
+
|
|
109
|
+
# Server logs
|
|
110
|
+
server_*.log
|
|
111
|
+
api_*.log
|
|
112
|
+
|
|
113
|
+
# ============================================================================
|
|
114
|
+
# Build & Packaging
|
|
115
|
+
# ============================================================================
|
|
116
|
+
|
|
117
|
+
# UV lockfile (optional - include if you want reproducible deps)
|
|
118
|
+
# uv.lock
|
|
119
|
+
|
|
120
|
+
# Build artifacts
|
|
121
|
+
build/
|
|
122
|
+
dist/
|
|
123
|
+
*.egg-info/
|
|
124
|
+
*.whl
|
|
125
|
+
|
|
126
|
+
# ============================================================================
|
|
127
|
+
# OS Specific
|
|
128
|
+
# ============================================================================
|
|
129
|
+
|
|
130
|
+
# macOS
|
|
131
|
+
.DS_Store
|
|
132
|
+
.AppleDouble
|
|
133
|
+
.LSOverride
|
|
134
|
+
|
|
135
|
+
# Windows
|
|
136
|
+
Thumbs.db
|
|
137
|
+
ehthumbs.db
|
|
138
|
+
Desktop.ini
|
|
139
|
+
|
|
140
|
+
# Linux
|
|
141
|
+
.directory
|
|
142
|
+
|
|
143
|
+
# ============================================================================
|
|
144
|
+
# Project Specific - CLIO Agent
|
|
145
|
+
# ============================================================================
|
|
146
|
+
|
|
147
|
+
# AI agents
|
|
148
|
+
.planning/
|
|
149
|
+
.clio_agent/
|
|
150
|
+
.codex
|
|
151
|
+
|
|
152
|
+
ai-docs/_archived/
|
|
153
|
+
ANTHONY/
|
|
154
|
+
.research/
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
# Test artefacts (relative-path file_diff tests sometimes leak)
|
|
159
|
+
/b.py
|
|
160
|
+
/x.py
|
|
161
|
+
scratch/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Repository Guidelines
|
|
2
|
+
|
|
3
|
+
## Project Structure & Module Organization
|
|
4
|
+
`src/clio_agent/` contains production code, organized by responsibility:
|
|
5
|
+
- `ui/` for CLI and FastAPI entry points
|
|
6
|
+
- `experts/`, `registry/`, and `signatures/` for routing and expert behavior
|
|
7
|
+
- `arc/` for memory/indexing/storage components
|
|
8
|
+
- `tools/servers/` for FastMCP-backed tool servers
|
|
9
|
+
- `optimizer/` for tuning and instrumentation workflows
|
|
10
|
+
- `runtime/` for doctor and integration status reporting
|
|
11
|
+
|
|
12
|
+
Tests mirror the runtime layout in `tests/` (`test_core/`, `test_arc/`, `test_experts/`, `test_tools/`, `test_integration/`). Architecture and design docs live in `docs/`, and reference material is in `ai-docs/`.
|
|
13
|
+
Helper scripts for local demos and homelab setup live in `scripts/`.
|
|
14
|
+
|
|
15
|
+
## Build, Test, and Development Commands
|
|
16
|
+
Use `uv` for environment and command execution:
|
|
17
|
+
- `uv sync --extra dev --extra api --extra optimizers` installs contributor dependencies.
|
|
18
|
+
- `uv run ruff check src/ tests/ scripts/create_demo_data.py` runs lint checks.
|
|
19
|
+
- `uv run ruff format src/ tests/ scripts/create_demo_data.py` formats code.
|
|
20
|
+
- `uv run pytest tests/` runs the full test suite with coverage output.
|
|
21
|
+
- `uv run src/clio_agent/ui/cli.py doctor` reports runtime truth for LM, tools, file policy, API, and `clio-core`.
|
|
22
|
+
- `uv run src/clio_agent/ui/cli.py` starts the interactive CLI.
|
|
23
|
+
- `uv run src/clio_agent/ui/api.py --port 8000` starts the REST API locally.
|
|
24
|
+
|
|
25
|
+
## Coding Style & Naming Conventions
|
|
26
|
+
Target Python 3.12 with 4-space indentation and type hints on public interfaces. Keep lines readable within the configured `line-length = 100`. Follow existing naming:
|
|
27
|
+
- modules/functions: `snake_case`
|
|
28
|
+
- classes: `PascalCase`
|
|
29
|
+
- constants: `UPPER_SNAKE_CASE`
|
|
30
|
+
|
|
31
|
+
Ruff is the authoritative linter/formatter (`ruff`, `ruff-format` in pre-commit). Run lint/format before opening a PR.
|
|
32
|
+
|
|
33
|
+
## Testing Guidelines
|
|
34
|
+
Pytest is the test framework (`test_*.py`, `Test*`, `test_*`). Coverage is enabled by default via `pyproject.toml` (`--cov=clio_agent --cov-report=term-missing --cov-report=html`). Add tests in the matching domain folder and prefer deterministic fixtures from `tests/conftest.py`. Integration tests that need LM Studio are already guarded with skip conditions.
|
|
35
|
+
|
|
36
|
+
## Commit & Pull Request Guidelines
|
|
37
|
+
The history follows Conventional Commit style, e.g. `feat(api): ...`, `fix(ci): ...`, `test(core): ...`, `docs(04-03): ...`. Keep subject lines imperative and scoped.
|
|
38
|
+
|
|
39
|
+
PRs should include:
|
|
40
|
+
- a short problem/solution summary
|
|
41
|
+
- linked issue(s) when applicable
|
|
42
|
+
- test/lint evidence (commands + result)
|
|
43
|
+
- API/CLI example output when behavior changes
|