Update dependency analysis artifacts

Refreshed static analysis of workspace dependency structure:
- graph.json: 10 crates, 17 crate-level edges, 95 files, 123 file-level edges
- graph.summary.md: Updated metrics and fan-in/fan-out rankings
- sccs.md: Confirmed no cycles (DAG structure intact)
- layers.observed.md: 5-layer hierarchy from binaries to infrastructure
- hotspots.md: Identified g3-config, g3-providers as high fan-in; g3-cli as high fan-out
- limitations.md: Documented extraction method constraints

Agent: euler
This commit is contained in:
Dhanji R. Prasanna
2026-01-12 20:32:16 +05:30
parent fe67e72ddd
commit 028285825b
6 changed files with 2130 additions and 2343 deletions

View File

@@ -4,103 +4,169 @@
Layers derived mechanically from:
1. Crate dependency direction in Cargo.toml
2. Path-based grouping within crates
3. Import directionality between files
2. Path-based module grouping
3. Import directionality analysis
## Crate Layers
## Crate Hierarchy
### Layer 0: Foundation (No internal dependencies)
```
┌─────────────────────────────────────────────────────────────┐
│ 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) │
└─────────────────────────────────────────────────────────────┘
```
| Crate | Purpose (from Cargo.toml description) |
|-------|---------------------------------------|
| g3-config | Configuration management |
| g3-execution | Code execution engine |
| g3-providers | LLM provider abstractions |
| g3-computer-control | Computer control (no description) |
## Intra-Crate Module Structure
### Layer 1: Core Services
### g3-core (38 files)
| Crate | Dependencies |
|-------|-------------|
| g3-core | g3-providers, g3-config, g3-execution, g3-computer-control |
```
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
```
### Layer 2: Higher-Level Services
### g3-cli (16 files)
| Crate | Dependencies |
|-------|-------------|
| g3-ensembles | g3-core, g3-config |
| g3-planner | g3-providers, g3-core, g3-config |
```
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
```
### Layer 3: Application
### g3-computer-control (16 files)
| Crate | Dependencies |
|-------|-------------|
| g3-cli | g3-core, g3-config, g3-planner, g3-computer-control, g3-providers, g3-ensembles |
| g3 (root) | g3-cli, g3-providers |
```
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
```
## Module Groupings Within Crates
### g3-providers (7 files)
### g3-core (60 files)
```
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
```
| Group | Files | Purpose |
|-------|-------|--------|
| tools/ | 9 | Tool implementations (file_ops, shell, webdriver, etc.) |
| code_search/ | 2 | Tree-sitter based code search |
| root modules | 22 | Core functionality (agent, context, streaming, etc.) |
| tests/ | 27 | Integration and unit tests |
### g3-planner (8 files)
### g3-computer-control (29 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
```
| Group | Files | Purpose |
|-------|-------|--------|
| platform/ | 5 | OS-specific implementations (macos, linux, windows) |
| webdriver/ | 4 | Browser automation (safari, chrome) |
| ocr/ | 3 | Text recognition (tesseract, vision) |
| macax/ | 3 | macOS accessibility |
| examples/ | 12 | Usage examples |
### g3-providers (10 files)
| Group | Files | Purpose |
|-------|-------|--------|
| providers | 5 | LLM implementations (anthropic, databricks, openai, embedded) |
| support | 3 | OAuth, streaming utilities |
| tests/ | 3 | Provider tests |
### g3-planner (12 files)
| Group | Files | Purpose |
|-------|-------|--------|
| core | 7 | Planner logic (planner, state, llm, git, history) |
| tests/ | 4 | Planner tests |
## Observed Directionality
### Cross-Crate Import Patterns
| From Crate | To Crate | Edge Count |
|------------|----------|------------|
| g3-cli | g3-core | 5 |
| g3-cli | g3-config | 2 |
| g3-cli | g3-computer-control | 1 |
| g3-core | g3-providers | 18 |
| g3-core | g3-config | 6 |
| g3-core | g3-computer-control | 2 |
| g3-planner | g3-providers | 3 |
| g3-planner | g3-core | 5 |
| g3-planner | g3-config | 1 |
| g3-ensembles | g3-core | 1 |
| g3-ensembles | g3-config | 1 |
### Layer Violations
## Layer Violations
**None detected.**
All observed imports follow the declared crate dependency direction.
No file imports from a crate that is not declared as a dependency.
All dependencies flow downward through the layer hierarchy. No upward dependencies exist.
## Uncertainty
- Internal `use crate::` imports not fully resolved to specific files
- Some module relationships inferred from `mod` declarations only
- Test files may have additional dev-dependencies not tracked
- 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)