What the agent does
The agent starts at go.mod (github.com/gotify/server/v3) and app.go, where serve() loads config, opens the database with database.New, builds the gin engine with router.Create and blocks in runner.Run. Before writing a line it runs go build ./... and go test ./... on the untouched clone, and both fail: ui/serve.go embeds the git-ignored ui/build/, and with no C compiler go-sqlite3 returns a stub error.
It installs gcc, runs yarn build in ui/, and changes no tracked file. Then it reads router/router.go, auth/authentication.go, api/message.go, database/message.go, api/stream/stream.go, api/stream/client.go and plugin/manager.go, and rechecks its cited lines with grep -n, fixing five that pointed at the wrong line.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Write architecture.md for this Go repository: the commit, the module and its executable entry point; the main components with the package that owns each; the data models and how they are stored; and one request traced end to end with file:line at each hop. Run go build ./... and go test ./... before and after, report any setup the clone needs to pass them, and verify every cited line against the source. Change no application code.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
Tried on gotify/server at dd06dc7: 1 file changed, 66 insertions(+), a new architecture.md with a 9-row component table, 5 data models (User, Application, Client, Message, PluginConf) and a 10-hop trace from router/router.go:210 to ui/src/message/WebSocketStore.ts:30. After the setup, go build ./... exited 0 and go test ./... passed, ending ok github.com/gotify/server/v3/test/testdb 0.026s.
For the reviewer: whether architecture.md belongs at the root or under docs/. The trace is read from code; no server ran and no message was sent, though the api and api/stream tests pass. The UI's JavaScript tests were not run.
Run it on every merged pull request touching storage or the stream
An automation with a github trigger on pull_request.closed.merged, branch_patterns set to master and labels set to database or stream, runs this prompt after the change lands. The new document's hop list, diffed against the last one, shows a moved handler or a new step in the path.
The use case this job follows, with its automation and trigger: Produce a report or file, no repo.
Why run it on Rush?
The document records what a new contributor hits first: a fresh clone does not build, because the UI is embedded but never committed, and the tests need cgo for SQLite. It also found that migrations disable foreign keys, so relations between users, applications and messages are enforced in code, not by the database.
Frequently asked questions
Does the trace cover messages sent by plugins?
Yes, as a variant. A plugin's SendMessage pushes onto a channel, and the goroutine started in NewManager saves it with db.CreateMessage and calls notifier.Notify, joining the HTTP path at the stream registry.
How does a sent message find the right sockets?
stream.API keeps clients keyed by user id. Notify takes a read lock, looks up that user's clients and writes the message to each one's channel, skipping closed ones; each socket's write goroutine sends it as JSON.
More Go jobs
The same job on other stacks
- Explain the Architecture of a Rails Codebase (Rails)
- Explain the Architecture of a Spring Boot Codebase (Spring Boot)
- Explain the Architecture of an ASP.NET Core Solution (ASP.NET Core)