feat: ingest Kagi Assistant threads
Add a Kagi source that indexes Assistant conversations with the subscriber
session token, one entry per thread.
- Read the token from KAGI_SESSION_TOKEN, KAGI_SESSION_TOKEN_FILE, or the
kagi-cli config ([auth] session_token); accept full session-link URLs.
- List conversations through /api/conversations, load each thread via
/api/v2/conversations/{id}/init, and walk older turn pages through the
branch turns endpoint.
- Render one markdown document per thread (stable fingerprint by conversation
UUID, content hash for versioning), keeping the newest turns when a thread
exceeds the body budget.
- Skip re-fetching threads whose updated_at has not moved during this process.
- Wire the 30-minute watcher ticker + sync status, the `knox kagi` command,
the full ingest sweep, MCP scope filtering, thread anchoring, and web links.
This commit is contained in:
+4
-2
@@ -44,7 +44,7 @@ func NewMCPServer(kdb *db.KnoxDB) *mcp.Server {
|
||||
Query string `json:"query,omitempty" jsonschema:"Search query"`
|
||||
Limit int `json:"limit,omitempty" jsonschema:"Max results (default 10)"`
|
||||
Detail string `json:"detail,omitempty" jsonschema:"Zoom level: brief, normal, or full (default normal)"`
|
||||
Scope string `json:"scope,omitempty" jsonschema:"Source scope: all, skills, sessions, logs, snippets, code, notes, browser, karakeep, gitea, repos (default all)"`
|
||||
Scope string `json:"scope,omitempty" jsonschema:"Source scope: all, skills, sessions, logs, snippets, code, notes, browser, karakeep, kagi, gitea, repos (default all)"`
|
||||
}
|
||||
|
||||
mcp.AddTool(s, &mcp.Tool{Name: "knox_search", Description: "Search the knowledge index. Supports zoom levels: brief (lean), normal (default), full (verbose). Scope filters: all, skills, sessions, logs, snippets, code. A scope of all also appends the best-matching code snippets/techniques (separate index); scope 'snippets' returns only those."},
|
||||
@@ -98,7 +98,7 @@ func NewMCPServer(kdb *db.KnoxDB) *mcp.Server {
|
||||
type recentInput struct {
|
||||
Limit int `json:"limit,omitempty" jsonschema:"Max results (default 10)"`
|
||||
Detail string `json:"detail,omitempty" jsonschema:"Zoom level: brief, normal, or full (default normal)"`
|
||||
Scope string `json:"scope,omitempty" jsonschema:"Source scope: all, skills, sessions, logs, notes, browser, karakeep, gitea, repos (default all)"`
|
||||
Scope string `json:"scope,omitempty" jsonschema:"Source scope: all, skills, sessions, logs, notes, browser, karakeep, kagi, gitea, repos (default all)"`
|
||||
}
|
||||
|
||||
mcp.AddTool(s, &mcp.Tool{Name: "knox_recent", Description: "Show recent knowledge entries with zoom levels: brief, normal (default), full."},
|
||||
@@ -1266,6 +1266,8 @@ func filterByScope(entries []db.Entry, scope string) []db.Entry {
|
||||
return filterSource(entries, "obsidian")
|
||||
case "karakeep", "bookmarks":
|
||||
return filterSource(entries, "karakeep")
|
||||
case "kagi", "assistant":
|
||||
return filterSource(entries, "kagi")
|
||||
case "gitea":
|
||||
return filterSource(entries, "gitea")
|
||||
case "repos", "git":
|
||||
|
||||
Reference in New Issue
Block a user