Update dependency analysis artifacts

Generated comprehensive static dependency analysis for g3 workspace:

- graph.json: 108 nodes (9 crates, 99 files), 186 edges
- graph.summary.md: Overview with metrics, entrypoints, fan-in/fan-out rankings
- sccs.md: No cycles detected (DAG structure confirmed)
- layers.observed.md: 4-layer crate hierarchy identified
- hotspots.md: ui_writer.rs (15 fan-in), agent_mode.rs (13 fan-out) as key nodes
- limitations.md: Documents extraction methodology and caveats

Updated AGENTS.md with artifact documentation table.

Agent: euler
This commit is contained in:
Dhanji R. Prasanna
2026-01-29 11:46:39 +11:00
parent cba7d31996
commit 853237e62e
7 changed files with 2234 additions and 2146 deletions

View File

@@ -1,172 +1,80 @@
# Observed Layering
## Derivation Method
## Crate-Level Layers
Layers derived mechanically from:
1. Crate dependency direction in Cargo.toml
2. Path-based module grouping
3. Import directionality analysis
## Crate Hierarchy
Based on dependency direction, the following layers are observed:
```
┌─────────────────────────────────────────────────────────────┐
│ Layer 0: Binaries │
g3 (main entry) │
studio (standalone tool) │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Layer 1: Application │
│ g3-cli (CLI interface, 16 files) │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Layer 2: Orchestration │
│ g3-planner (planning logic, 8 files) │
│ g3-ensembles (multi-agent, 4 files) │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Layer 3: Core Engine │
│ g3-core (agent engine, 38 files) │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Layer 4: Infrastructure │
│ g3-providers (LLM providers, 7 files) │
│ g3-config (configuration, 2 files) │
│ g3-execution (code execution, 1 file) │
│ g3-computer-control (desktop automation, 16 files) │
└─────────────────────────────────────────────────────────────┘
Layer 0 (Leaf crates - no internal dependencies):
├── g3-config
├── g3-execution
├── g3-providers
├── g3-computer-control
└── studio
Layer 1 (Depends on Layer 0):
└── g3-core
└── depends on: g3-providers, g3-config, g3-execution, g3-computer-control
Layer 2 (Depends on Layer 0 and 1):
├── g3-cli
│ └── depends on: g3-core, g3-config, g3-planner, g3-computer-control, g3-providers
└── g3-planner
└── depends on: g3-providers, g3-core, g3-config
Layer 3 (Application root):
└── g3
└── depends on: g3-cli, g3-providers
```
## Intra-Crate Module Structure
## Layer Metrics
### g3-core (38 files)
| Layer | Crates | Description |
|-------|--------|-------------|
| 0 | 5 | Foundation crates with no internal deps |
| 1 | 1 | Core engine |
| 2 | 2 | High-level orchestration |
| 3 | 1 | Application entry point |
```
lib.rs
├── acd.rs # Aggressive Context Dehydration
├── background_process.rs # Background process management
├── code_search/ # Tree-sitter code search
│ ├── mod.rs
│ └── searcher.rs
├── compaction.rs # Context compaction
├── context_window.rs # Context window management
├── error_handling.rs # Error classification
├── feedback_extraction.rs # Coach feedback extraction
├── paths.rs # Path utilities
├── project.rs # Project abstraction
├── prompts.rs # System prompts
├── provider_config.rs # Provider configuration
├── provider_registration.rs # Provider registration
├── retry.rs # Retry logic
├── session.rs # Session management
├── session_continuation.rs # Session continuation
├── streaming.rs # Streaming utilities
├── streaming_parser.rs # Tool call parser
├── task_result.rs # Task result types
├── tool_definitions.rs # Tool definitions
├── tool_dispatch.rs # Tool routing
├── tools/ # Tool implementations
│ ├── mod.rs
│ ├── acd.rs
│ ├── executor.rs
│ ├── file_ops.rs
│ ├── memory.rs
│ ├── misc.rs
│ ├── research.rs
│ ├── shell.rs
│ ├── todo.rs
│ └── webdriver.rs
├── ui_writer.rs # UI abstraction
├── utils.rs # General utilities
└── webdriver_session.rs # WebDriver session
```
## Observed Groupings by Path
### g3-cli (16 files)
### g3-core/src/tools/
Tool implementations grouped under `tools/` submodule:
- executor.rs (tool context and execution)
- acd.rs, file_ops.rs, memory.rs, misc.rs, research.rs, shell.rs, todo.rs, webdriver.rs
```
lib.rs
├── accumulative.rs # Accumulative mode
├── agent_mode.rs # Agent mode
├── autonomous.rs # Autonomous mode
├── cli_args.rs # CLI argument parsing
├── coach_feedback.rs # Coach feedback
├── filter_json.rs # JSON filtering
├── interactive.rs # Interactive mode
├── metrics.rs # Metrics/timing
├── project_files.rs # Project file loading
├── simple_output.rs # Simple output helper
├── streaming_markdown.rs # Markdown formatting
├── task_execution.rs # Task execution
├── theme.rs # UI theming
├── ui_writer_impl.rs # UiWriter implementation
└── utils.rs # CLI utilities
```
### g3-core/src/code_search/
Code search functionality:
- mod.rs (API types)
- searcher.rs (tree-sitter implementation)
### g3-computer-control (16 files)
### g3-computer-control/src/platform/
Platform-specific implementations:
- macos.rs, linux.rs, windows.rs (conditional compilation)
```
lib.rs
├── macax/ # macOS Accessibility
│ ├── mod.rs
│ └── controller.rs
├── ocr/ # OCR engines
│ ├── mod.rs
│ ├── tesseract.rs
│ └── vision.rs
├── platform/ # Platform implementations
│ ├── mod.rs
│ ├── linux.rs
│ ├── macos.rs
│ └── windows.rs
├── types.rs # Shared types
└── webdriver/ # WebDriver implementations
├── mod.rs
├── chrome.rs
├── diagnostics.rs
└── safari.rs
```
### g3-computer-control/src/webdriver/
Browser automation:
- safari.rs, chrome.rs, diagnostics.rs
### g3-providers (7 files)
### g3-providers/src/
LLM provider implementations:
- anthropic.rs, openai.rs, gemini.rs, databricks.rs, embedded.rs
- oauth.rs (authentication)
- mock.rs (testing)
```
lib.rs
├── anthropic.rs # Anthropic Claude
├── databricks.rs # Databricks
├── embedded.rs # Local llama.cpp
├── oauth.rs # OAuth flow
├── openai.rs # OpenAI-compatible
└── streaming.rs # Streaming utilities
```
## Directionality
### g3-planner (8 files)
```
lib.rs
├── code_explore.rs # Code exploration
├── git.rs # Git operations
├── history.rs # History management
├── llm.rs # LLM integration
├── planner.rs # Planning logic
├── prompts.rs # Planner prompts
└── state.rs # State management
```
## Layer Violations
**None detected.**
All dependencies flow downward through the layer hierarchy. No upward dependencies exist.
| From | To | Direction | Violations |
|------|----|-----------|------------|
| g3 | g3-cli | down | none |
| g3-cli | g3-core | down | none |
| g3-cli | g3-planner | lateral | none |
| g3-core | g3-providers | down | none |
| g3-core | g3-config | down | none |
| g3-planner | g3-core | lateral | none |
## Uncertainty
- Layer assignment is based on dependency direction, not semantic intent
- `studio` is isolated (no internal crate dependencies) - layer assignment is nominal
- Some crates at Layer 4 could arguably be split further (e.g., `g3-computer-control` is large)
- **studio**: Isolated crate with no detected internal dependencies; may have runtime integration not captured
- **g3-execution**: Minimal crate (1 file); purpose unclear from static analysis alone
- **Lateral dependencies**: g3-cli ↔ g3-planner relationship suggests potential for extraction or consolidation