|
| 1 | +# Aha Studio Architecture |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Aha Studio is a Go application providing AQL (Aha Query Language), MCP server integration, local SQLite sync, Neo4j graph analytics, and an HTTP API for Aha.io product management data. |
| 6 | + |
| 7 | +## System Architecture |
| 8 | + |
| 9 | +```text |
| 10 | + ┌──────────────────────────────┐ |
| 11 | + │ Entry Points │ |
| 12 | + │ │ |
| 13 | + │ CLI (cobra) MCP (stdio) │ |
| 14 | + │ REPL HTTP API │ |
| 15 | + └──────────┬───────────────────┘ |
| 16 | + │ |
| 17 | + ┌──────────▼───────────────────┐ |
| 18 | + │ Studio (Facade) │ |
| 19 | + │ studio/studio.go │ |
| 20 | + └──────────┬───────────────────┘ |
| 21 | + │ |
| 22 | + ┌────────────────────┼────────────────────┐ |
| 23 | + │ │ │ |
| 24 | + ┌────────▼────────┐ ┌────────▼────────┐ ┌────────▼────────┐ |
| 25 | + │ AQL Pipeline │ │ MCP Server │ │ HTTP Server │ |
| 26 | + │ │ │ mcp/ │ │ httpserver/ │ |
| 27 | + │ lexer → parser │ │ │ │ │ |
| 28 | + │ → ast │ │ OmniSkill skill │ │ REST endpoints │ |
| 29 | + │ → validator │ │ 40+ tools │ │ CORS/Auth │ |
| 30 | + │ → planner │ │ Resources │ │ Query modes │ |
| 31 | + │ → executor │ │ │ │ │ |
| 32 | + └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ |
| 33 | + │ │ │ |
| 34 | + └────────────┬──────┴─────────────────────┘ |
| 35 | + │ |
| 36 | + ┌────────────▼────────────────────────────┐ |
| 37 | + │ Data Layer │ |
| 38 | + │ │ |
| 39 | + │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ |
| 40 | + │ │ Aha API │ │ SQLite │ │ Neo4j │ │ |
| 41 | + │ │ (live) │ │ (cache) │ │ (graph) │ │ |
| 42 | + │ │ aha-go │ │ sync/ │ │ graph/ │ │ |
| 43 | + │ └──────────┘ └──────────┘ └──────────┘ │ |
| 44 | + └─────────────────────────────────────────┘ |
| 45 | +``` |
| 46 | + |
| 47 | +## AQL Pipeline |
| 48 | + |
| 49 | +The query engine follows a classic compiler pipeline: |
| 50 | + |
| 51 | +```text |
| 52 | +AQL string |
| 53 | + │ |
| 54 | + ▼ |
| 55 | +Lexer (aql/lexer/) |
| 56 | + │ Tokenization |
| 57 | + ▼ |
| 58 | +Parser (aql/parser/) |
| 59 | + │ Recursive descent, operator precedence |
| 60 | + ▼ |
| 61 | +AST (aql/ast/) |
| 62 | + │ SELECT, FROM, WHERE, JOIN, GROUP BY, HAVING, |
| 63 | + │ ORDER BY, LIMIT, INSERT, UPDATE, DELETE |
| 64 | + ▼ |
| 65 | +Validator (aql/validator/) |
| 66 | + │ Semantic validation against entity schema |
| 67 | + ▼ |
| 68 | +Planner (planner/) |
| 69 | + │ Filter pushdown, custom field detection, |
| 70 | + │ JOIN strategy, aggregation planning |
| 71 | + ▼ |
| 72 | +Executor (executor/) |
| 73 | + │ API calls, client-side filtering, aggregation, |
| 74 | + │ JOIN resolution, mutation execution |
| 75 | + ▼ |
| 76 | +Result (result/) |
| 77 | + │ Records, metadata, formatting |
| 78 | + ▼ |
| 79 | +Output (table / JSON / CSV / YAML / Markdown / HTML / XLSX) |
| 80 | +``` |
| 81 | + |
| 82 | +## MCP Server |
| 83 | + |
| 84 | +Built on the OmniSkill framework (`github.com/plexusone/omniskill`), which provides: |
| 85 | + |
| 86 | +- Skill/Tool abstraction over the MCP protocol |
| 87 | +- Transport options: stdio (Claude Desktop), HTTP/SSE |
| 88 | +- Direct library-mode invocation without JSON-RPC overhead |
| 89 | + |
| 90 | +The MCP server exposes 40+ tools across entity types (features, ideas, releases, epics, goals, initiatives, requirements, products, strategic models, comments) with full CRUD operations plus lookup/reference helpers. |
| 91 | + |
| 92 | +### Key files |
| 93 | + |
| 94 | +| File | Responsibility | |
| 95 | +|------|----------------| |
| 96 | +| `mcp/skill.go` | AhaSkill definition, tool registration | |
| 97 | +| `mcp/handlers.go` | Tool handler implementations | |
| 98 | +| `mcp/config.go` | MCP server configuration | |
| 99 | + |
| 100 | +## Data Layer |
| 101 | + |
| 102 | +### Aha API (aha-go) |
| 103 | + |
| 104 | +Primary data source. All live queries go through `github.com/grokify/aha-go`, which wraps the Aha.io REST API. |
| 105 | + |
| 106 | +### SQLite (sync/) |
| 107 | + |
| 108 | +Local cache for offline and hybrid query modes. |
| 109 | + |
| 110 | +- Full entity sync with incremental updates via `updated_since` |
| 111 | +- Schema migrations for evolving entity models |
| 112 | +- FTS5 full-text search across entities |
| 113 | +- Saved filters persistence |
| 114 | +- Three query modes: `api` (live only), `offline` (cache only), `prefer-cache` (cache first, API fallback) |
| 115 | + |
| 116 | +### Neo4j (graph/) |
| 117 | + |
| 118 | +Graph analytics for entity relationships. |
| 119 | + |
| 120 | +- Feature dependency graphs |
| 121 | +- Release dependency analysis |
| 122 | +- Initiative impact mapping |
| 123 | +- Product overview aggregation |
| 124 | +- Raw Cypher query support |
| 125 | + |
| 126 | +### In-Memory Cache (cache/) |
| 127 | + |
| 128 | +LRU cache with TTL for API response caching. Thread-safe, configurable size and expiration. |
| 129 | + |
| 130 | +## HTTP API |
| 131 | + |
| 132 | +REST server (`httpserver/`) exposing AQL queries, sync management, saved filters, full-text search, and Neo4j graph endpoints. See ROADMAP.md Phase 11 for the full endpoint list. |
| 133 | + |
| 134 | +## Ecosystem Position |
| 135 | + |
| 136 | +```text |
| 137 | +Grokify Org |
| 138 | +───────────────────────────────── |
| 139 | +aha-go Aha.io API client |
| 140 | +aha-studio AQL + MCP + sync + graph |
| 141 | +
|
| 142 | + │ |
| 143 | + │ OmniSignal adapter |
| 144 | + │ (Aha Ideas → enhancement signals) |
| 145 | + ▼ |
| 146 | +
|
| 147 | +PlexusOne Org |
| 148 | +───────────────────────────────── |
| 149 | +omniskill MCP skill framework |
| 150 | +omnisignal Signal normalization |
| 151 | +
|
| 152 | + │ |
| 153 | + │ references |
| 154 | + ▼ |
| 155 | +
|
| 156 | +ProductBuildersHQ Org |
| 157 | +───────────────────────────────── |
| 158 | +market-spec Market intelligence entities |
| 159 | +organization-spec Customer/prospect entities |
| 160 | +prism-roadmap Strategic planning |
| 161 | +``` |
| 162 | + |
| 163 | +Aha Studio bridges Aha.io into the broader ProductContext ecosystem. The OmniSignal adapter converts Aha-specific concepts (Ideas, Idea Portals, custom fields) into vendor-neutral signals that OmniSignal can aggregate with evidence from other sources. |
| 164 | + |
| 165 | +## Dependencies |
| 166 | + |
| 167 | +| Module | Purpose | |
| 168 | +|--------|---------| |
| 169 | +| `github.com/grokify/aha-go` | Aha.io REST API client | |
| 170 | +| `github.com/plexusone/omniskill` | MCP skill infrastructure | |
| 171 | +| `github.com/modelcontextprotocol/go-sdk` | Official MCP Go SDK | |
| 172 | +| `github.com/spf13/cobra` | CLI framework | |
| 173 | +| `github.com/c-bata/go-prompt` | Interactive REPL | |
| 174 | +| `github.com/xuri/excelize/v2` | Excel export | |
| 175 | +| `modernc.org/sqlite` | Pure Go SQLite driver | |
| 176 | +| `github.com/neo4j/neo4j-go-driver` | Neo4j graph database | |
0 commit comments