Remove redundant 'No plan exists' message from plan_read output

The UI already shows 'empty' via print_plan_compact, so returning an
empty string avoids duplicate output.
This commit is contained in:
Dhanji R. Prasanna
2026-02-02 17:19:01 +11:00
parent e332109273
commit 263a838d31
6 changed files with 634 additions and 2118 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,86 +1,105 @@
# Dependency Graph Summary
## Overview
**Generated**: 2025-02-02
**Extraction Method**: Static import parsing via ripgrep
**Workspace**: g3
| Metric | Value |
## Metrics
| Metric | Count |
|--------|-------|
| Total nodes | 108 |
| Total edges | 186 |
| Crate nodes | 9 |
| File nodes | 99 |
| Crate-level edges | 14 |
| File-level edges | 172 |
| Total Nodes | 127 |
| Crate Nodes | 9 |
| File Nodes | 118 |
| Total Edges | 156 |
| Crate-level Edges | 14 |
| File-level Edges | 142 |
## Crate Structure
## Crate Dependency Structure
| Crate | Path | Direct Dependencies |
|-------|------|---------------------|
| g3 | `.` | g3-cli, g3-providers |
| g3-cli | `crates/g3-cli` | g3-core, g3-config, g3-planner, g3-computer-control, g3-providers |
| g3-core | `crates/g3-core` | g3-providers, g3-config, g3-execution, g3-computer-control |
| g3-providers | `crates/g3-providers` | (none) |
| g3-config | `crates/g3-config` | (none) |
| g3-execution | `crates/g3-execution` | (none) |
| g3-planner | `crates/g3-planner` | g3-providers, g3-core, g3-config |
| g3-computer-control | `crates/g3-computer-control` | (none) |
| studio | `crates/studio` | (none) |
```
g3 (root binary)
├── g3-cli
│ ├── g3-core
│ ├── g3-config
│ ├── g3-planner
│ ├── g3-computer-control
│ └── g3-providers
├── g3-providers
g3-core
├── g3-providers
├── g3-config
├── g3-execution
└── g3-computer-control
g3-planner
├── g3-providers
├── g3-core
└── g3-config
studio (standalone binary)
└── (no internal g3 dependencies)
g3-config (leaf - no internal deps)
g3-execution (leaf - no internal deps)
g3-computer-control (leaf - no internal deps)
g3-providers (leaf - no internal deps)
```
## Entrypoints
| Type | Location | Evidence |
|------|----------|----------|
| Binary | `crates/g3-cli/src/lib.rs` | `run()` function, CLI dispatch |
| Binary | `crates/studio/src/main.rs` | `main()` function |
| Library | `crates/g3-core/src/lib.rs` | `Agent` struct, core API |
| Entrypoint | Path | Type |
|------------|------|------|
| g3 | `src/main.rs` | Binary |
| studio | `crates/studio/src/main.rs` | Binary |
| g3-cli | `crates/g3-cli/src/lib.rs` | Library |
## Top Fan-In Nodes (Most Depended Upon)
| Node | Fan-In | Type |
|------|--------|------|
| crate:g3-core | 35 | crate |
| crate:g3-providers | 19 | crate |
| file:crates/g3-core/src/ui_writer.rs | 15 | file |
| crate:g3-config | 13 | crate |
| file:crates/g3-cli/src/g3_status.rs | 10 | file |
| file:crates/g3-cli/src/simple_output.rs | 8 | file |
| file:crates/g3-core/src/context_window.rs | 6 | file |
| file:crates/g3-cli/src/template.rs | 6 | file |
| file:crates/g3-core/src/paths.rs | 5 | file |
| crate:g3-computer-control | 4 | crate |
| Node | Fan-In | Description |
|------|--------|-------------|
| `g3-core/src/lib.rs` | 18 | Core Agent, ToolCall types |
| `g3-core/src/ui_writer.rs` | 14 | UiWriter trait |
| `g3-cli/src/simple_output.rs` | 9 | SimpleOutput helper |
| `g3-cli/src/template.rs` | 6 | Template processing |
| `g3-core/src/paths.rs` | 6 | Path utilities |
| `g3-core/src/context_window.rs` | 5 | Context window management |
| `g3-cli/src/g3_status.rs` | 5 | Status formatting |
| `crate:g3-providers` | 5 | Provider abstractions |
| `crate:g3-config` | 5 | Configuration |
| `crate:g3-core` | 5 | Core engine |
## Top Fan-Out Nodes (Most Dependencies)
| Node | Fan-Out | Type |
|------|---------|------|
| file:crates/g3-cli/src/agent_mode.rs | 13 | file |
| file:crates/g3-core/src/lib.rs | 13 | file |
| file:crates/g3-cli/src/commands.rs | 12 | file |
| file:crates/g3-cli/src/interactive.rs | 12 | file |
| file:crates/g3-cli/src/accumulative.rs | 11 | file |
| file:crates/g3-planner/src/planner.rs | 8 | file |
| file:crates/g3-cli/src/autonomous.rs | 8 | file |
| file:crates/g3-core/src/tools/acd.rs | 7 | file |
| file:crates/g3-planner/src/llm.rs | 6 | file |
| file:crates/g3-cli/src/utils.rs | 5 | file |
| Node | Fan-Out | Description |
|------|---------|-------------|
| `g3-cli/src/interactive.rs` | 11 | Interactive REPL |
| `g3-cli/src/agent_mode.rs` | 11 | Agent mode runner |
| `g3-cli/src/accumulative.rs` | 8 | Accumulative mode |
| `g3-cli/src/commands.rs` | 7 | CLI commands |
| `g3-core/src/tools/executor.rs` | 7 | Tool execution context |
| `g3-cli/src/autonomous.rs` | 5 | Autonomous mode |
| `g3-core/src/compaction.rs` | 4 | Context compaction |
| `g3-core/src/tool_dispatch.rs` | 4 | Tool routing |
## File Counts by Crate
## Crate File Counts
| Crate | Source Files |
|-------|-------------|
| g3-cli | 23 |
| g3-core | 42 |
| g3-providers | 9 |
| g3-config | 2 |
| g3-execution | 1 |
| g3-planner | 8 |
| g3-computer-control | 11 |
| studio | 3 |
| Crate | Source Files | Test Files |
|-------|--------------|------------|
| g3-cli | 21 | 5 |
| g3-core | 32 | 33 |
| g3-providers | 12 | 4 |
| g3-planner | 7 | 4 |
| g3-computer-control | 12 | 1 |
| g3-config | 2 | 0 |
| g3-execution | 1 | 0 |
| studio | 3 | 0 |
## Extraction Limitations
1. **Static analysis only**: Dynamic dispatch and trait objects not traced
2. **Use statement parsing**: Only `use g3_*` and `use crate::` patterns captured
3. **Conditional compilation**: `#[cfg(...)]` blocks not evaluated
4. **Re-exports**: `pub use` chains not fully resolved
5. **Test files excluded**: Files in `/tests/` directories not included
6. **Examples excluded**: Files in `/examples/` directories not included
1. **Dynamic imports not captured**: Any runtime module loading is not reflected
2. **Macro-generated imports**: Imports generated by macros may be missed
3. **Conditional compilation**: `#[cfg(...)]` gated imports are included regardless of target
4. **Re-exports**: Transitive re-exports through `pub use` are not fully traced
5. **Test files excluded from graph**: Test files (`tests/`) are not included in file nodes

View File

@@ -1,80 +1,152 @@
# Observed Layering
# Observed Layering Structure
## Crate-Level Layers
**Generated**: 2025-02-02
**Method**: Derived from crate dependencies and file import patterns
Based on dependency direction, the following layers are observed:
## Crate Layers
Based on dependency direction, the crates form the following layers:
```
Layer 0 (Leaf crates - no internal dependencies):
├── g3-config
├── g3-execution
├── g3-providers
├── g3-computer-control
└── studio
Layer 0 (Leaf/Foundation):
┌─────────────────┬─────────────────┬─────────────────────────┬─────────────────┐
g3-config │ g3-execution │ g3-computer-control │ g3-providers │
(config mgmt) │ (code execution)│ (browser/UI control) │ (LLM providers) │
└─────────────────┴─────────────────┴─────────────────────────┴─────────────────┘
Layer 1 (Core Engine):
┌───────────────────────────────────────────────────────────────────────────────┐
│ g3-core │
│ (Agent, ToolCall, context management, tool dispatch, streaming) │
└───────────────────────────────────────────────────────────────────────────────┘
Layer 2 (Orchestration):
┌───────────────────────────────────────────────────────────────────────────────┐
│ g3-planner │
│ (fast-discovery planner, git integration, LLM orchestration) │
└───────────────────────────────────────────────────────────────────────────────┘
Layer 3 (CLI/Application):
┌───────────────────────────────────────────────────────────────────────────────┐
│ g3-cli │
│ (interactive mode, autonomous mode, agent mode, commands, UI) │
└───────────────────────────────────────────────────────────────────────────────┘
Layer 4 (Binary Entry):
┌───────────────────────────────────────────────────────────────────────────────┐
│ g3 │
│ (main binary, minimal - delegates to g3-cli) │
└───────────────────────────────────────────────────────────────────────────────┘
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
Separate:
┌───────────────────────────────────────────────────────────────────────────────┐
│ studio │
│ (standalone multi-agent workspace manager, no g3 crate dependencies) │
└───────────────────────────────────────────────────────────────────────────────┘
```
## Layer Metrics
## Layer Violations
| 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 |
**None detected at crate level.**
## Observed Groupings by Path
All dependencies flow downward (higher layer → lower layer). No upward dependencies exist.
### 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
## File-Level Layering Within g3-cli
### g3-core/src/code_search/
Code search functionality:
- mod.rs (API types)
- searcher.rs (tree-sitter implementation)
```
Entry Layer:
lib.rs (run function, mode dispatch)
Mode Layer:
interactive.rs, autonomous.rs, agent_mode.rs, accumulative.rs
Command/Execution Layer:
commands.rs, task_execution.rs, coach_feedback.rs
Utility Layer:
simple_output.rs, g3_status.rs, display.rs, template.rs,
ui_writer_impl.rs, streaming_markdown.rs, filter_json.rs,
metrics.rs, project_files.rs, language_prompts.rs, embedded_agents.rs
Data Layer:
cli_args.rs, project.rs, completion.rs, theme.rs
```
### g3-computer-control/src/platform/
Platform-specific implementations:
- macos.rs, linux.rs, windows.rs (conditional compilation)
## File-Level Layering Within g3-core
### g3-computer-control/src/webdriver/
Browser automation:
- safari.rs, chrome.rs, diagnostics.rs
```
Entry Layer:
lib.rs (Agent struct, stream_completion_with_tools)
Orchestration Layer:
retry.rs, compaction.rs, feedback_extraction.rs
Tool Layer:
tool_dispatch.rs, tool_definitions.rs
tools/mod.rs → tools/{shell,file_ops,plan,webdriver,research,memory,misc,acd}.rs
tools/executor.rs
Streaming Layer:
streaming.rs, streaming_parser.rs
Context Layer:
context_window.rs, acd.rs, session.rs, session_continuation.rs
Infrastructure Layer:
paths.rs, utils.rs, error_handling.rs, stats.rs,
provider_config.rs, provider_registration.rs,
background_process.rs, pending_research.rs,
webdriver_session.rs, ui_writer.rs, project.rs, prompts.rs
Search Layer:
code_search/mod.rs, code_search/searcher.rs
```
### g3-providers/src/
LLM provider implementations:
- anthropic.rs, openai.rs, gemini.rs, databricks.rs, embedded.rs
- oauth.rs (authentication)
- mock.rs (testing)
## File-Level Layering Within g3-providers
## Directionality
```
Entry Layer:
lib.rs (LLMProvider trait, ProviderRegistry, Message types)
Provider Implementations:
anthropic.rs, openai.rs, gemini.rs, databricks.rs, mock.rs
embedded/mod.rs → embedded/provider.rs, embedded/adapters/{mod,glm}.rs
Utility Layer:
streaming.rs, oauth.rs
```
| 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 |
## Directionality Confidence
| Layer Boundary | Confidence | Notes |
|----------------|------------|-------|
| g3 → g3-cli | High | Single dependency, clear delegation |
| g3-cli → g3-core | High | Many imports, clear consumer relationship |
| g3-cli → g3-planner | High | Explicit dependency for planning features |
| g3-core → g3-providers | High | Core uses provider abstractions |
| g3-core → g3-config | High | Core reads configuration |
| g3-core → g3-computer-control | High | WebDriver integration |
| g3-core → g3-execution | Medium | Declared but minimal observed usage |
| g3-planner → g3-core | High | Planner uses Agent, error handling |
## Uncertainty
- **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
1. **g3-execution usage**: Declared as dependency of g3-core but no `use g3_execution::` statements found in source. May be used transitively or for future features.
2. **studio isolation**: studio has no g3 crate dependencies. It may interact with g3 via filesystem/process boundaries rather than library calls.

View File

@@ -1,27 +1,83 @@
# Strongly Connected Components (Cycles)
**Generated**: 2025-02-02
**Method**: Manual analysis of crate and file-level dependency graph
## Crate-Level Cycles
**None detected.**
The crate dependency graph is a DAG (directed acyclic graph). All crate dependencies flow downward:
```
g3-cli → g3-core → g3-providers
→ g3-config
→ g3-planner → g3-core (creates diamond, not cycle)
→ g3-providers
→ g3-config
→ g3-computer-control
→ g3-providers
g3-core → g3-execution
→ g3-computer-control
```
## File-Level Cycles Within Crates
### g3-core
**Potential cycle via lib.rs re-exports:**
Multiple modules import from `lib.rs` (for `ToolCall`, `Agent`, etc.), and `lib.rs` declares these modules. This is standard Rust module structure, not a problematic cycle.
```
lib.rs ←──mod──→ streaming_parser.rs (uses crate::ToolCall)
lib.rs ←──mod──→ context_window.rs (uses crate::ToolCall)
lib.rs ←──mod──→ acd.rs (uses crate::ToolCall)
lib.rs ←──mod──→ streaming.rs (uses crate::ToolCall)
lib.rs ←──mod──→ stats.rs (uses crate::CacheStats)
lib.rs ←──mod──→ retry.rs (uses crate::{Agent, DiscoveryOptions, TaskResult})
lib.rs ←──mod──→ feedback_extraction.rs (uses crate::{Agent, TaskResult})
```
This is the standard Rust pattern where `lib.rs` defines types and submodules import them via `crate::`. Not a problematic SCC.
### g3-cli
**No problematic cycles detected.**
Dependencies flow from high-level modules (interactive, agent_mode, accumulative) down to utilities (simple_output, g3_status, template).
### g3-providers
**No cycles detected.**
All provider implementations (anthropic, openai, gemini, databricks, embedded, mock) import from `lib.rs` only.
### g3-planner
**No cycles detected.**
`planner.rs` imports from `git.rs`, `history.rs`, `llm.rs`, `state.rs`. No reverse dependencies.
## Cross-Crate Diamonds (Not Cycles)
The following diamond patterns exist but are not cycles:
1. **g3-cli → g3-core → g3-config** and **g3-cli → g3-config**
2. **g3-cli → g3-planner → g3-core** and **g3-cli → g3-core**
3. **g3-cli → g3-planner → g3-providers** and **g3-cli → g3-providers**
These are valid DAG structures where multiple paths lead to the same dependency.
## Summary
| Metric | Value |
|--------|-------|
| Non-trivial SCCs | 0 |
| Total nodes in cycles | 0 |
| Scope | Cycles Found | Severity |
|-------|--------------|----------|
| Crate-level | 0 | N/A |
| File-level (g3-core) | 0 problematic | N/A |
| File-level (g3-cli) | 0 | N/A |
| File-level (g3-providers) | 0 | N/A |
| File-level (g3-planner) | 0 | N/A |
## Analysis
No strongly connected components with more than one node were detected in the dependency graph.
This indicates the codebase has a **directed acyclic graph (DAG)** structure at both the crate and file level for the dependencies that were extracted.
## Methodology
- Tarjan's algorithm applied to all 108 nodes and 186 edges
- Only SCCs with 2+ nodes reported (trivial single-node SCCs excluded)
- Analysis covers `use` statement imports only
## Caveats
1. **Trait implementations**: Mutual trait dependencies not captured by `use` statements
2. **Type references**: Types referenced without explicit `use` not detected
3. **Macro expansions**: Dependencies introduced by macros not traced
4. **Build-time dependencies**: `build.rs` dependencies not included
The codebase has a clean acyclic dependency structure.