# ryo-analysis
[](https://crates.io/crates/ryo-analysis)
[](https://docs.rs/ryo-analysis)
[](#license)
> **Status:** stable. Part of the [ryo](https://github.com/ynishi/ryo-rs) workspace —
> AST-centric Rust programming for AI agents.
Code graph and discovery engine. AST-first: symbols are identified by their
AST hierarchy (`SymbolPath`); physical files are derived as a View layer.
`CodeGraphV2` provides fast relationship traversal (calls, type references,
trait impls, container hierarchy).
## Install
```sh
cargo add ryo-analysis
```
Optional features:
| `workspace` | Pulls in `ryo-metadata` for workspace-wide resolution |
| `schemars` | JSON Schema derive |
| `testing` | Re-exports `ryo-symbol`'s `test-utils` |
| `literal-search` | Full-text literal search via `tantivy` |
## Quickstart
```rust,ignore
use ryo_analysis::{SymbolPath, SymbolRegistry, SymbolKind};
let path = SymbolPath::builder("tokio")
.push("sync")
.push("Mutex")
.build()?;
let mut registry = SymbolRegistry::new();
let id = registry.register(path, SymbolKind::Struct)?;
// Fast O(1) lookup
let resolved = registry.resolve(id);
```
## API Summary
| `context::AnalysisContext` | Workspace-wide analysis state |
| `discovery::*` | Symbol search and pattern discovery |
| `query::CodeGraphV2` | Call / type / trait / container graph |
| `query::TypeFlowGraphV2` | Type-level usage and dependency graph |
| `query::SpecFlowGraphV2` | `@spec:` directive graph |
| `cascade::*` | Cascade analysis (change-impact) |
| `pattern::*` | Pattern-driven symbol detection |
| `literal::*` | Literal value search (with `literal-search`) |
| `import_map_builder::*` | Import / use resolution |
`SymbolPath`, `SymbolId`, `SymbolKind`, `SymbolRegistry`, `CodeEdgeV2` and
related types are re-exported at the crate root.
## Status
API surface considered stable for the v0.1.0 release.
## License
Licensed under either of [Apache-2.0](https://github.com/ynishi/ryo-rs/blob/main/LICENSE-APACHE)
or [MIT](https://github.com/ynishi/ryo-rs/blob/main/LICENSE-MIT) at your option.