docs: document backend code structure#41
Conversation
Greptile SummaryAdds a new
Confidence Score: 4/5Docs-only change; no production code is modified and the guidance is broadly accurate. The guide is well-written and matches the real codebase for every package it names. The "Current Tree" snapshot is incomplete — four packages that exist on disk are absent — which could mislead contributors about where new utility or infrastructure code belongs. docs/backend-code-structure.md — the Current Tree section needs the missing packages added before the doc is used as a definitive reference. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
CLI[internal/cli]
HTTPD[internal/httpd]
DAEMON[internal/daemon]
SERVICE[internal/service/*]
SESSION_MGR[internal/session_manager]
LIFECYCLE[internal/lifecycle]
PORTS[internal/ports]
ADAPTERS[internal/adapters/*]
DOMAIN[internal/domain]
STORAGE[internal/storage/sqlite]
CDC[internal/cdc]
TERMINAL[internal/terminal]
CONFIG[internal/config]
DAEMON --> SERVICE
DAEMON --> ADAPTERS
DAEMON --> STORAGE
DAEMON --> CDC
DAEMON --> LIFECYCLE
DAEMON --> HTTPD
DAEMON --> CLI
DAEMON --> CONFIG
HTTPD --> SERVICE
HTTPD --> TERMINAL
CLI --> HTTPD
SERVICE --> DOMAIN
SERVICE --> STORAGE
SESSION_MGR --> PORTS
SESSION_MGR --> LIFECYCLE
SESSION_MGR --> STORAGE
LIFECYCLE --> DOMAIN
LIFECYCLE --> STORAGE
ADAPTERS --> PORTS
ADAPTERS --> DOMAIN
STORAGE --> DOMAIN
CDC --> STORAGE
style DOMAIN fill:#d4edda,stroke:#28a745
style PORTS fill:#cce5ff,stroke:#004085
style ADAPTERS fill:#fff3cd,stroke:#856404
Reviews (1): Last reviewed commit: "docs: resolve backend structure doc conf..." | Re-trigger Greptile |
| ## Current Tree | ||
|
|
||
| The current main-line shape is: | ||
|
|
||
| ```txt | ||
| backend/ | ||
| cmd/ao/ # CLI entrypoint | ||
| main.go # daemon entrypoint compatibility | ||
| sqlc.yaml | ||
|
|
||
| internal/domain/ # shared product vocabulary and durable facts | ||
| internal/ports/ # capability interfaces | ||
| internal/service/ | ||
| project/ # project API/use-case boundary | ||
| session/ # session API/use-case boundary | ||
| pr/ # PR observation/action service | ||
| internal/session_manager/ # internal session command engine | ||
| internal/lifecycle/ # durable lifecycle fact reducer | ||
| internal/observe/reaper/ # runtime observation loop | ||
| internal/storage/sqlite/ # DB, migrations, queries, generated sqlc, stores | ||
| internal/cdc/ # change_log poller and broadcaster | ||
| internal/terminal/ # terminal session protocol and PTY handling | ||
| internal/httpd/ # HTTP API, controllers, OpenAPI, terminal mux | ||
| internal/cli/ # user-facing ao command | ||
| internal/daemon/ # production wiring and shutdown | ||
| internal/config/ # daemon env/default config | ||
| internal/adapters/ # concrete agent/runtime/workspace/SCM/tracker adapters | ||
| ``` |
There was a problem hiding this comment.
Current Tree omits several real packages
The "Current Tree" section is missing at least four packages that exist on disk: internal/daemonmeta/ (build/version metadata), internal/processalive/ (liveness checking for agent processes), internal/runfile/ (daemon run-file / lock management), and internal/integration/ (integration tests). A developer looking for the right home for code related to any of these areas won't find guidance here and may place new code in the wrong package or, worse, create a duplicate.
Summary
Notes
Testing