Skip to content
GitHub

DevelopServer & UI

@holtkeeper/server

The web server: the JSON API for the UI and clients, the active auth provider’s endpoints, the built web UI, and background credential rotation. Built on Hono over Bun.serve.

Add a server section to holtkeeper.config.ts and run holtkeeper serve. The file holds infrastructure only (see @holtkeeper/core); forges (with their fleet include/exclude), teams, triggers and settings are added in the panel:

import { passwordAuth } from '@holtkeeper/auth-password'
import { defineConfig, env } from '@holtkeeper/core'
import { sqliteStore } from '@holtkeeper/store-sqlite'
export default defineConfig({
server: {
auth: passwordAuth({
password: env('HOLTKEEPER_PASSWORD'),
sessionSecret: env('HOLTKEEPER_SESSION_SECRET'),
}),
store: sqliteStore({ path: 'holtkeeper.db' }),
vaultKey: env('HOLTKEEPER_VAULT_KEY'),
port: 7420,
},
})
Field Default
auth required: noAuth(), headerAuth(), passwordAuth() or usersAuth()
store required: sqliteStore(), postgresStore() (several processes) or memoryStore()
vaultKey required, at least 32 characters; seals credentials and secret settings
hostname, port 127.0.0.1, 7420
webRoot apps/web/dist; without a built UI only the API is served
rotationIntervalMinutes 60; 0 disables background rotation
artifactsDir .holtkeeper/artifacts; shorthand for artifacts: { kind: 'fs', dir }
artifacts { kind: 'fs', dir, quotaBytes? } or { kind: 's3', bucket, endpoint?, region?, accessKeyId, secretAccessKey, sessionToken?, prefix?, virtualHostedStyle?, quotaBytes? } (secrets accept env('NAME'); quotaBytes is the space the operator declares, shown against usage in Settings › System, never enforced)
retention none; { days?, maxBytes? } sweeps artifacts hourly (age first, then least recently used)
databasePath none; the SQLite file, so the storage overview can report its size
  • context.ts — ServerDeps (config, auth, store, vault, credential service, setting definitions, clock) and helpers: authorize, principalOf, repoTarget (adds a repository’s owner teams), withTeams (adds team grants and teamDefs to a principal; the app middleware applies it), teamLabeler (names team keys in chat, agent and MCP text, see Team titles), repoKey, readBody and readQuery (zod validation of a body or the query string → 400 with the first problem), ForbiddenException and ForbiddenToolError (see Refusals).
  • app.ts — createApp(deps): authenticates every request, mounts /auth/<provider>/* and the API routes, maps errors to ApiError (403: ForbiddenError). GET /api/me (MeResponse) answers the principal with its avatar, the auth info, the access.crossTeam level, version (ServerDeps.version, default the HOLTKEEPER_VERSION environment variable, left out when empty) publicUrl (server.publicUrl without a trailing slash, left out when not configured) and teamTitles (display titles of titled teams the principal may know about, by key: all of them with global settings:read, otherwise the teams it is a member of, the teams its grants name and the owner teams of fleet repositories it holds a listing permission on, reachableTeams in routes/repos.ts; empty when signed out).
  • routes/ — one module per area: Home (home.ts), the Inbox (inbox.ts) and personal snoozes (snoozes.ts), audits, repositories (repos.ts), analyses, credentials, settings, jobs, rules and learnings, webhooks, AI usage, the audit log behind Settings › Audit log (audit.ts), external accounts and avatars. Each checks permissions with @holtkeeper/access and filters lists to what the caller may see.
  • audit.ts — the audit middleware, appendAudit, diffChanges and audit retention (see Audit log).
  • setting-rules.ts — the shared setting resolver (routes, MCP tools) and the audit.allowlistPolicy rules that settings writes, policy drafts and allowlist renewals enforce (see Policies).
  • web.ts — static UI with SPA fallback and immutable caching for hashed assets.
  • agent.ts — settingsAgentFor and withServerDefaults: the LLM agent per repository (see Agents).
  • ai-language.ts — aiLanguageOf(deps, repo): the language AI prose for a repository defaults to, the language of the analyzers.review setting resolved for the repository, else English. QA test notes and release announcements check their own language first; compare summaries, release notes and the breaking-change check use it directly.
  • external-files.ts — dependencyPath and externalFiles: answers for dependency files a checkout does not hold, from the package tools (see Agents).
  • ask.ts, ask-citations.ts — askService behind the MCP tool ask and the check of an answer’s sources against what the run read (see Ask).
  • libraries.ts — the libraries setting, the library index leader duty and serverLibraryDocs (see Libraries).
  • freshness.ts — the freshness settings, the freshness sweeper leader duty and freshnessStatus (see Freshness).
  • go-guidelines.ts — goGuidelinesDuty and goGuidelinesSource: a leader duty that checks hourly whether a day has passed since the last successful refresh of the modern Go guidelines, then reads the newest release tag of JetBrains/go-modern-guidelines from the GitHub API (unauthenticated, with the previous ETag) and its guidelines.json, plus once each the release tags analyzers.review entries pin (goGuidelines.tag, at most ten). Validated copies go to the key-value store (review:go-guidelines:latest, review:go-guidelines:tag:<tag>); a failed or invalid refresh keeps the last good copy and logs go guidelines: .... Reviews read the pinned copy, else the newest, else the snapshot bundled with @holtkeeper/review. The scheduler pods reach api.github.com and raw.githubusercontent.com over HTTPS.
  • repo-health.ts — repoHealth, readHealthSources: the health cells of a repository and every threshold they use (see Repository health).
  • findings.ts, licenses.ts, fleet-cache.ts — readFindings, licensesOverview and createFleetCache: the Supply fleet tables, read from stored metrics, and the cache they share (see Supply fleet tables).
  • coverage.ts, assets.ts, bundles.ts, reviews.ts, branches.ts, fleet-metrics.ts — coverageCards, assetsTable, bundlesRow, listReviews, branchesOverview and withCurrentMetrics: the Quality fleet tables, read from stored metrics (see Quality fleet tables).
  • mr-status.ts, slack/ — MergeRequestStatusSink and noteReviewJob: told when a review job is queued, canceled or ends; the server wires the Slack review status (createSlackReviews) to it (see Slack review status).
  • release-announce.ts, slack/announcement.ts — createReleaseAnnouncer / releaseAnnouncerFor and announcementMessage: a Slack message per new version, with notes, tasks and the repositories an upgrade breaks (see Release announcements).
  • qa.ts, routes/qa.ts — qaServiceFor and qaRoutes: Releases › QA, tasks with the changes that name them (see QA tasks).
  • review-status.ts — reviewToolsAccess: the merge request review state and review requests behind the MCP code_review tool (see MCP).
  • mr-comments.ts — commentsOffFor: whether mergeRequests.comments keeps reviews and comments off a repository’s merge requests (see merge request reviews off).
  • managed.ts — startManagedConfig: the ConfigSource over the file config and store.config, panel forges limited and guarded by repo.freeze and mergeRequests.comments (see Managed configuration and merge request reviews off).
  • rules.ts — createRulesResolver, the one resolver every agent run goes through, with readForgeRuleFiles (rules files of a default branch, cached by head sha), learningPolicyFor, liveLearnings and settleLearnings (see Rules and learnings).
  • limits.ts — the shared @holtkeeper/limits limiter: limited forge fetch, job admission keys.
  • server.ts — startServer(config): builds deps from the config, starts rotation, logs provider start lines, listens.

Settings areas have their own pages: People, Integrations, Analyzers, Policies, System, Audit log. The Slack app’s review status and its setup: Slack review status.

Everything a route needs comes through ServerDeps, so tests build the app with memoryStore() and any auth provider (see test/app.test.ts).

Every 403 under /api answers ForbiddenError { error, missing: { action, target? } } (@holtkeeper/api). authorize() and every other permission check throw ForbiddenException(action, target?, message?), which onError renders; TaskError(403, message, missing) becomes one in the task routes. missing holds only what the client sent: the action and, for a repository, its key (forge:path). It never names teams, and a repository that does not exist gets the same body as one the caller may not see (unknown forges still answer 400). Routes that load the repository from a stored record by id (jobs, analyses, rules and learnings, checked against their stored scope) use authorizeRecord() or answer the same action-only 403, whose 403 names the action only, so an id never reveals its repository; an unknown id answers 404. Writes to a read-only repository (release steps) answer 403 with releases:run on that repository.

Refusals that are not about a permission use other statuses: an MCP token calling the token routes gets 401 (sign in instead), and a repository webhook delivery about another project gets 400.

MCP tools refuse a missing permission with ForbiddenToolError(message, action, target?) (or a ForbiddenException from shared code); the MCP adapter answers it as an error result whose text is the message and whose structuredContent is the same ForbiddenError body. Internal agents and chat get the message only.

/auth/<provider>/* answers are the provider’s own. With HOLTKEEPER_AUTH=users, GET /auth/users/link/:token returns LinkInfo only for a live, unused link: who it is for and grants: { count, role } without scopes, group names or the issuer’s name; a used or expired link answers 410 with { error, state, at } only (see @holtkeeper/auth-users).

Endpoint Needs
GET /api/audits/fixes audits:read on each repository; repositories the caller may not read are left out
GET /api/repos any of repos:read, audits:read, analyses:read, releases:read on the repository lists it; each health cell needs its own permission (see Repository health), freshness and lastAnalysedAt analyses:read, updates settings:read on the repository or a scope covering it, latestAudit audits:read, configurable marks settings:write
GET /api/dependencies catalog reach on each repository (canSeeCatalog, see Cross-team catalog); also /api/dependencies/library, /api, /upgrade and /docs; upgrade call sites need snippet reach (canSeeSnippets), advisories audits:read, decisions knowledge:read or a shared entry (see Dependencies)
GET /api/audits/findings audits:read on each repository; a repository the caller may not read is left out, ?repo= on one of them answers no finding groups (see Supply fleet tables)
GET /api/licenses analyses:read on each repository; totals, mix and violations count readable repositories only; policy only with settings:read on the organization scope (see Supply fleet tables)
GET /api/ci analyses:read on each repository; releaseGate on a card only with releases:read on its repository (see Quality fleet tables)
GET /api/ci/repo?repo= analyses:read on the repository; its newest ci-jobs record as CiJobsData with problems (problemJobs) and per-job flags (jobProblems); without data when there is no record or it is in an older shape
GET /api/ci/jobs?repo= analyses:read on the repository (see Quality fleet tables)
GET /api/ci/jobs/fleet analyses:read on each repository; jobs of the readable repositories only (see Quality fleet tables)
GET /api/bundles analyses:read on each repository (see Quality fleet tables); /api/bundles/targets and /report need it on the repository
GET /api/assets analyses:read on each repository; team and repo narrow within what the caller may read and never widen it (see Quality fleet tables)
GET /api/assets/repo?repo= analyses:read on the repository; effective assets.policy and the newest assets record as a summary (see Assets)
GET /api/coverage analyses:read on each repository; a card per repository with a coverage record, plus /api/coverage/repo?repo= for one repository (see Coverage)
GET /api/reviews analyses:read on each repository; ?repo= needs it on that repository; GET /api/reviews/:id answers 404 when the caller may not read the record’s repository (see Quality fleet tables)
GET /api/branches analyses:read on each repository (see Quality fleet tables)
/api/api-surface/*, /mcp catalog reach on each repository (lists filtered; usages/sites, usages/impact, the code of package_usage and the affected uses of package_changes need snippet reach); MCP advisories need audits:read, knowledge and rules tools knowledge:read, the releases topic of repo_rules releases:read (see MCP); the commits topic, check_commit_message, test_ids and code_review keep analyses:read; ask runs with the caller’s own reach; GET /api/api-surface/symbol needs catalog reach on the package’s repository; POST /api/api-surface/rescan needs global analyses:run; tokens are the caller’s own; usage of other people needs global users:read
GET /api/stack catalog reach on each repository; convention problems, diffs and fix ids need analyses:read
/api/system/library-index* global settings:read; POST /api/system/library-index/reindex needs global analyses:run
credentials credentials:read / credentials:write on the credential’s scope
settings settings:read / settings:write on the entry’s scope; resolve needs settings:read on the repository (?repo=) or the team (?team=, a scope { teams: [team] }), see Settings resolver
jobs analyses:read on the repository (lists, GET /api/jobs?analysisId=, GET /api/jobs/count and GET /api/jobs/stats cover only repositories and teams (group-scope jobs) the caller may read, applied in the store query; the stats’ workers need analyses:read over everything); queueing and canceling need analyses:run
agent tasks proposing: see every target; approving: tasks:run on every target (explicitly for other teams’ repositories); reading: proposer, approver or repos:read on a target (see Agent tasks)
Rules and learnings knowledge:read / knowledge:write on the rule’s or learning’s scope (lists are filtered; an edit that moves the scope needs write on the old and the new one); GET /api/rules/effective needs knowledge:read on the repository; reaction totals knowledge:read on the repository, or global without repo
AI usage ai:read (or ai:admin); rows limited to repositories the grants cover, using the owner teams recorded on each run; ?repo= needs ai:read on the repository; teams= (/api/ai/usage, /runs, /overview, /week) narrows within what the caller may read and never widens it; /api/ai/overview budgets only for scopes the caller may read, the default one only with ai:read on everything
egress cache global settings:read to view, global settings:write to delete entries
/api/database/* global settings:read; POST /api/database/queries/reset needs global settings:write
managed config global settings:read to view (incl. schedule previews), global settings:write to change (incl. webhook secrets)
GET /api/home any signed-in principal; each part only from what the caller may read: job items, stale and not-analysed repositories analyses:read (Retry also needs analyses:run on every repository of the item), vulnerabilities audits:read, releases releases:read (Review needs releases:run), pending learnings knowledge:read and knowledge:write on their scope, allowlist entries settings:read and settings:write on their scope, What changed as the audit log filters it, spend ai:read
GET /api/inbox, /api/inbox/count any signed-in principal; an item only where the caller may decide it: task groups the caller sees on the task-group endpoints (repos:read on one of their repositories, or proposed or approved them) with tasks:run (and repos:read or catalog reach) on every proposed task’s repository, pending learnings knowledge:read and knowledge:write on their scope, releases that await an acceptance releases:run on the repository, allowlist entries settings:read and settings:write on the setting’s scope
chat threads seeing the thread (its repository or team readable; unscoped threads: any chat access); contextRepos, message refs and context repositories only show repositories the caller may read (visibleRepos), context costUsd only with ai:read; mute is per caller
GET /api/qa/tasks, GET /api/qa/task releases:read on each repository; tasks, changes and summaries come only from repositories the caller may read
POST /api/qa/summary analyses:run on the repository of the task’s newest change, and an AI agent configured for it
POST /api/releases/dismiss releases:run on the repository
POST /api/audits/allowlist/renew settings:write on the setting entry’s scope
own snoozes any signed-in principal (GET/POST/DELETE /api/me/snoozes), only its own
history (/api/history*) repos:read somewhere; repository events only for repositories the caller can repos:read, everything with global audit:read
audit export and verify global audit:read
own external accounts any signed-in principal, only for its own links
avatars none (GET /api/avatars/*); PUT /api/me/avatar needs a signed-in users account
own preferences any signed-in principal (GET/PUT /api/me/preferences), only its own
bot messages (/api/messages*) global settings:read to view, global settings:write to change

agent.ts builds the LLM agent jobs get (settingsAgentFor({ config, store, vault, now?, runner?, onRun?, budgets?, log?, models? }), the default agentFor of startServer). For a repository it reads the settings:

  1. The global llm.provider (only its { all: true } entry counts; PUT /api/settings refuses narrower scopes for it) set to the id or name of an AI provider credential (kind anthropic, anthropic-compatible or ai-sdk, scope covering the repository): the credential’s secret is opened with the vault and createAgent from @holtkeeper/agent builds the agent from its kind, url and options. A named credential that is missing, out of scope or has invalid options is logged and yields no agent.
  2. llm.provider unset: no agent. API keys live only in credentials, never in settings.
  3. Tasks run on the routes of their tier (fallbackAgent from @holtkeeper/agent): first the global llm.tiers entries of that tier in order, each on its credential (id or name, scope covering the repository; default the llm.provider one) and the model resolveModelReference finds in that credential’s listing, then the newest Claude model of the tier’s family that llm.provider lists (resolveTierModels). A route whose credential is missing or does not list the model is skipped and logged once. A tier left without routes takes the nearest tier’s (deep → main → fast, fast → main → deep, main → deep → fast); no routes at all yields no agent. When a route fails (overloaded, rate limited, unknown model, refused key or balance, network) the task starts over on the next route and the server log says so; the failed route waits five minutes behind the others, across every agent of the server. Usage records the credential and model that answered.
  4. The loop a task runs on follows runtimeFor of @holtkeeper/agent: with an anthropic or anthropic-compatible credential (direct Anthropic, or Waibee’s Messages root) tool-loop tasks (reviews, thread replies, chat) run on the Claude Agent SDK unless the credential’s stored probe (capabilities.agentLoop, see below) failed, then on the AI SDK tool loop; one-shots (capabilities: [] and no toolsets: release notes, library digests, learning capture, the rule miner) run on the AI SDK, priced with the catalog’s anthropic prices. ai-sdk credentials run everything on the AI SDK.
  5. Models are not configurable. Tasks ask for a model tier (fast, main, deep), resolved with resolveTierModels against the credential’s model listing (cached per credential for an hour in models, default modelCatalog()); a tier whose family the provider does not list runs on the nearest listed tier (logged once per credential version); a provider that lists no Claude model at all is logged and yields no agent. Runs of one credential share its maxConcurrency.

GET /api/credentials/:id/models (credentials:read) lists an AI provider credential’s models with prices (listProviderModels, 15 s timeout); a provider API failure comes back as error next to the configured models.

ai-sdk credentials (see @holtkeeper/agent) use the models.dev catalog (ServerOptions.aiCatalog, default modelsDevCatalog()) with the catalogs of the config’s ai.providers plugins added (provider plugins; credentials may name their packages): GET /api/ai/providers lists the providers Holtkeeper can talk to and the AI SDK packages (shipped and plugins’) a provider of your own can use (any signed-in caller; a catalog that cannot load comes back as error), GET /api/ai/providers/:id/models one provider’s models. Their credential models come from the catalog, catalog prices price their runs (a credential’s pricing wins), and POST /api/credentials/:id/test { model? } (credentials:write) asks the model (default the main tier model of the credential’s listing) for a one-word reply: CredentialTestResult { ok, model, reply?, latencyMs?, error?, capabilities? }. For anthropic and anthropic-compatible credentials the test is the agent-loop probe instead (probeAgentLoop: one tiny Messages request with a tool, a cache breakpoint and tool_choice: auto, 30 s timeout); its outcome is stored on the credential as capabilities: { agentLoop: 'ok' | 'failed', checkedAt, error? } (setCapabilities) and returned when it is conclusive (a successful answer, or a 400 rejecting the request); transport errors, timeouts, 401/403, 429 and 5xx are only reported, and the stored result stays as it was. A credential never probed counts as unknown and runs tool loops on the Claude Agent SDK; changing its URL, secret, kind or options clears the result, so re-test after editing.

The agent is wrapped by withServerDefaults(agent, options), so every task gets:

  • the toolsets its task kind mounts (taskToolsets in tools/registry.ts; tool schemas cost prompt tokens): every task but reviews gets code (codeTools; without code.grep and code.read when the task has the read and search capabilities, the default, since the adapter’s own file tools cover them), docs (docsTools, with the job’s runner when the caller passes { runner } as second argument of agentFor, else runner), knowledge (knowledgeTools(knowledgeAccessOf(...)) for the repository and the task’s kind: search_knowledge over panel rules and active learnings that apply to the repository, propose_learning storing a learning of origin agent for it through addLearning; the review analyzer’s own knowledge access is the same; a run for a person keeps search_knowledge only, and only with their knowledge:read on the repository) and packages (the toolset of the tool registry over the organization’s packages and third-party libraries alike: find_packages, package_api, package_changes, package_usage, evaluate_dependency, and package_docs and package_source with the library index, below; calls without repo are made for the task repository, so versions default to what it uses); review tasks (reviews and thread replies) also get stack (stack_usage, repo_stack), within the cross-team catalog policy, and assets (asset_policy, repo_assets, see Assets), so a review can check new images against the policy, and git (gitTools: git.show, git.log, git.diff, git.blame, read-only history of the checkout through the same runner as docs, else localRunner), so a review or a thread reply can check a commit someone names or what changed since an earlier one. Reviews mount code, knowledge, packages, git, stack and assets; review-verify tasks (the verification of review findings) mount code, knowledge, packages and git: they check a finding against the checkout, so they skip the cross-repository stack. Neither mounts docs: dependencies are not installed in their checkouts, and packages answers for them. ask tasks (questions of MCP callers, see Ask) get knowledge, packages, stack, rules and assets and no checkout tools. review-plan tasks (the scenario plan of split reviews) get no toolsets. The breaking-change check’s upgrade-check area passes mount code, knowledge, packages and git; its upgrade-plan plan and verdict calls get no toolsets. The review analyzer’s issueTrackerFor is issueTrackerFor of issues.ts (the most specific jira credential covering the repository), so reviews get the ticket a merge request names only when it can be read. The review analyzer’s apiChangesFor is reviewApiChanges (review-api-changes.ts): branchApiChanges of @holtkeeper/api-surface over a temporary worktree of the merge request base, limited to packages another repository imports according to the newest usages records; nothing is stored. A task toolset with the same name wins. Tasks that run in a merge request checkout without installed dependencies (review, review-verify, review-split and triage; dependenciesMissing in tools/registry.ts) and mount packages also get externalFiles (external-files.ts, unless the task brings its own); other tasks install their dependencies and read them from disk: a read of a file inside a dependency the checkout does not hold is answered from the package index at the version the task repository uses, and a search there gets the calls to make instead (see @holtkeeper/agent). dependencyPath recognizes a package under node_modules (dot folders such as .bin name none), a module in the Go module cache (…/pkg/mod/<module>@v<version>/…, the version taken from the path, !x escapes undone) and a vendored Go package at the root (vendor/<host.tld>/<name>…, with an owner before the name on github.com, gitlab.com and bitbucket.org; a versioned name such as yaml.v3 is a package, not a file); a glob that names no package still counts, and the repository’s own pkg/mod folder, nested vendor folders and root vendor folders named like files (chart.js) do not. externalFiles(context) answers a read with package_api for the package folder, its package.json, declarations and build output of npm packages (dist/, lib/, .d.ts, …), for vendored Go packages and whenever the library index has no docs, and with package_source for any other file (with the lines asked for); the first line says dependencies are not installed and which call produced the text. When the index has nothing for the package, the answer says so instead of standing in for the file. Its hint names package_api, package_source and package_usage with the package filled in, or find_packages when the path names none. With onEvidence (ServerDefaultsOptions, or AgentJob.onEvidence through settingsAgentFor) the caller hears every text the run’s model is given beyond the prompt: the rules context (source context) and each capped tool result (source the tool’s name);
  • the repository’s resolved rules as context (createRulesResolver of rules.ts, for the rule agent of the task kind: review for review*, chat for chat*, release for release*, upgrade-plan and upgrade-check, task otherwise; see Rules and learnings), unless the task brings its own context: the review and thread replies resolve rules themselves with the rules files of their checkout (guideFor of the review analyzer), so they get no second copy;
  • package_docs and package_source in the packages toolset (over serverLibraryDocs), and third-party coverage of the other package tools, when the store has libraries and settingsAgentFor gets artifacts (startServer passes its artifact store);
  • the supply tools security_findings and license_overview in the packages toolset for a chat answering a person, when settingsAgentFor gets supply (startServer passes deps.supply, the one supplyToolsAccess(deps) the HTTP routes use too; MCP does not offer them), narrowed to that person; internal agents never get them;
  • every tool result, task toolsets included, capped by capToolsets at RESULT_CAPS of @holtkeeper/agent-tools (about 4k tokens and 20 hits per call; code searches report at most 20 hits); no external MCP server is mounted (a task’s own mcpServers still are);
  • a JSONL transcript of every run that reached the provider (createTranscript of @holtkeeper/agent: start with runtime, model, tools, system prompt and prompt; model messages and tool calls; tool results cut at 4000 characters; the outcome with usage and cost), stored in the artifact store as application/x-ndjson tagged { kind: 'transcript', repo, taskKind, job? } (transcripts.ts) when settingsAgentFor gets artifacts. The provider secret, rendered headers and well-known token shapes are redacted before a line is kept, and adapters never write their options or environment. The artifact id is result.transcriptRef, reported to onRun and stored on the AI usage record; failed runs keep theirs too. A failing artifact store is logged and never fails the run;
  • a budget check (budgetGuard over llm.budget, the default $150 weekly budget when none is set): a run a block budget refuses throws BudgetDeniedError, an allowed run is capped at what the budget has left (maxCostUsd). Runs of jobs a person asked for (trigger manual or command) and of ServerDeps.agentFor (routes a person calls) are interactive and may spend the reserve; every other run is automatic, ServerDeps.automaticAgentFor (learning capture, actor agent:learning) included. Then an onRun({ repo, taskKind, provider, providerKind, model, result | error, durationMs, at, actor?, analyzer?, jobId?, interactive?, subject?, transcriptRef? }) call after every run, denied ones included; subject (what the runs work on: a job’s task title, merge request, version or ref, a chat thread’s title) is stored on the usage record. The default onRun is usageRecorder(store.aiUsage) from @holtkeeper/ai-usage; provider is the credential’s name (or anthropic), model the provider’s model name of the task’s tier. onRun failures are logged and never change the run’s outcome.

Tasks without taskKind run as agent. agentFor(repo, { runner, jobId, analyzer, actor }) accepts the job’s details; the job engine currently passes only the repository.

createApiSurface(deps) (routes/api-surface.ts) serves the newest api-surface records (@holtkeeper/api-surface) to the UI and to agents. The catalog (api-surface/catalog.ts) indexes records without their data: the 20 newest are checked at most every 15 s, every record is relisted at most every 10 minutes (records of backfilled releases carry the release date, so they land anywhere in the list); both read analyses.heads and fetch data only of records not indexed yet, four at a time; record data is read on demand and the 48 most recent are kept parsed. Versions of a package are one per released version (the newest record of each) plus the newest default branch run as head; latest is the newest release. Go packages (ecosystem: 'Go', named by import path) take versions only from module tags (ApiPackage.version): a release record whose module was not tagged adds no version, and the default branch is head, never the ref. Versions of every major of a Go module are listed together (packageFamily: the import path with the module’s /vN dropped); a version of another major carries that package’s name in package, and a module path whose packages only exist under another major resolves to them. Summaries, versions, search hits and symbols carry ecosystem (absent for npm) and summaries the Go module. The repository overview’s Public API card reads the goImportable, goInternal and goMain metrics: a Go service without importable packages shows “Internal only” with its main and internal package counts, an empty snapshot “No packages”, both neutral.

A package is removed (PublicApiPackageRemoval) when at least two default branch runs of its repository since its newest record lack it; empty snapshots do not count, since they mean the extractor read nothing. at is the first such run, renamedTo the package that took its folder in the newest run, movedTo the readable repositories that still have it. Removed packages stay listed and resolvable with removed set; without repo, a package resolves in a repository that still has it. MCP answers about a removed package start with a warning not to use it in new code, and find_packages lists them last under their own heading.

  • GET /api/api-surface/packages?q=&repo=&kind= — PublicApiPackageList: the newest version of every package in readable repositories, with removed on dropped ones, narrowed to one repository or to packages exporting a symbol kind; facets counts kinds, packages and repositories over the list before repo and kind apply.
  • GET /api/api-surface/package?name=&version=&repo= — PublicApiPackageDetail; version is a version, a tag, a record id, latest (default) or head; exact versions prefer releases over head. repo picks one of several repositories with the same package name (alsoIn).
  • GET /api/api-surface/package.md?name=&version=&repo=&subpath=&docs=false — the same as Markdown for agents (renderPackage).
  • GET /api/api-surface/diff?name=&from=&to=&repo= — PublicApiDiff; to defaults to latest, from to the release before to.
  • GET /api/api-surface/search?q=&package=&repo=&subpath=&kind=&match=&limit=30 — PublicApiSearchResult over the newest record of each repository: exact names, prefixes, substrings, then doc comment text (within each, hand-written code before generated code such as protobuf and gRPC output or files under gen/ and generated/, and top-level names before members such as Type.method), at most limit (1–100) hits with more counting the rest. Each hit carries its match (exact, prefix, part, doc; match= keeps one, anything else answers 400), subpath, importPath, the release ref (absent for the default branch), deprecated and removed. facets counts kinds, packages, repositories, subpaths and match types over the hits before the facet filters apply, so the UI can show how many each value would leave.
  • GET /api/api-surface/symbol?package=&name=&subpath=&version=&repo=&limit=20 — PublicApiSymbol: one exported symbol in full (declaration, doc comment, deprecated, source location, import path, other subpaths exporting the name, removed) and its history over the recorded versions, newest first: where it was added, changed, deprecated or removed, at most limit entries (1–100, else 400) with capped when older versions were left out. 400 without package and name, 404 when no readable record has it. Answers are kept in the fleet cache while the catalog’s records stay the same.
  • GET /api/api-surface/usages/package?name= — PackageUsageView: every readable repository whose newest usages record uses the package, with versions, counts and the exports it uses (members and props, no sites), and the exports summed over them. name may be a Go module path or a package import path inside it; the answer’s name is then the module, with ecosystem: 'Go' and the package’s subpath.
  • GET /api/api-surface/usages/sites?package=&export=&member=&prop=&kind=&repo=&limit=50 — UsageSitesView: kept sites with snippets (findSites), at most 200.
  • GET /api/api-surface/usages/repo?repo=forge:path — RepoUsageView: the packages one repository uses; 404 without a readable record.
  • GET /api/api-surface/usages/published?repo=forge:path — PublishedPackagesView: the packages the newest API records of that repository describe, each with the readable repositories using it and their uses and files, most used first (Go packages count the uses of that import path only, and carry ecosystem); empty when the repository is not readable or has no API record.
  • GET /api/api-surface/usages/impact?package=&from=&to=&repo= — UpgradeImpactView: the catalog’s diff between two versions (as /diff resolves them) joined with the usage records (upgradeImpact), with the old version’s declarations to find exports that use a changed type. Repositories whose versions are all at or above to are left out; with to on head, none are. A Go package counts the uses of that import path in its module (resolveUsedPackage), and across majors the uses of the package at from. 404 when there are no two versions.
  • POST /api/api-surface/rescan — rereads every record now, usage records included.
  • GET|POST /api/api-surface/mcp/tokens, DELETE /api/api-surface/mcp/tokens/:id — the caller’s personal access tokens (McpTokenList, CreateMcpTokenInput { name, expiresInDays = 90, scopes? }, scopes any of ['release', 'tasks'] or absent, secretReports one of named (default), anonymous, off → CreateMcpTokenResult with the secret once). CreateMcpTokenInput.toolsets picks the toolsets the token serves (McpToolsetNames, default defaultMcpToolsets: all but qa); PUT /api/api-surface/mcp/tokens/:id/toolsets (McpTokenToolsetsInput { toolsets }, session only, 404 for another person’s or an unknown token) changes them from the token’s next call and is audited as mcp_token.toolsets with the new list; every McpTokenView carries its toolsets and McpTokenList.toolsets the catalog (mcpToolsetCatalog) with labels and defaults. PATCH /api/api-surface/mcp/tokens/:id (UpdateMcpTokenInput { secretReports }, session only) changes how a token reports exposed secrets; it is the one mutating request the audit log skips, and the create event leaves the choice out, so administrators never learn who reports how (see Secret reports). Logged as mcp.token.created / mcp.token.revoked. Needs Store.kv; without it tokens are unavailable.
  • GET /api/api-surface/mcp/usage?days=30 (1–90) — McpUsageOverview: calls and failures per day, by tool, package and client, the 50 newest calls, people (calls, errors, last call, the 10 most used tools, packages and clients, calls and failures per day, home teams and unexpired token count per person: everyone for global users:read, else only the caller), me (the caller’s own row) and tokens (calls per token of the caller’s own tokens only).

The usage index (api-surface/usages.ts) keeps the newest usages record of every repository (@holtkeeper/usages), rereading it at most every 2 minutes (newestRecords: one record per repository) and reusing parsed data of records that did not change.

Tokens (api-surface/tokens.ts) are hk_mcp_… secrets of which only a SHA-256 is stored in Store.kv (mcp:token:<hash>, with the owner’s list under mcp:tokens:<principal>). A token acts as its owner, cut down to analyses:read, repos:read, audits:read, knowledge:read and releases:read, plus releases:run when it was issued with the release scope and tasks:run with the tasks scope (McpTokenScope, both off by default; the API still accepts them, but Account › Connect agents no longer offers them and no MCP tool uses them): for users accounts with the current grants of the user, and disabling the user or bumping its session version (sign out everywhere) revokes the token; for other providers with the grants at issue time. Each token stores only the toolsets its owner turned on or off against the catalog defaults (toolsets, a name → boolean map, absent while it follows the defaults), so a toolset added later reaches existing tokens only when it is on by default, and a toolset that replaced others (packages for the former catalog and libraries) stays off for a token whose owner had turned one of those off; authenticate resolves them, and /mcp mounts only those (McpToolsetsContext.toolsets) plus security, which the reporting choice governs. Signed-in sessions without a token (the panel’s tool reference) get every toolset. Tokens authenticate only /mcp, GET /api/api-surface/* and GET /api/dependencies*, and cannot issue or revoke tokens. lastUsedAt is written at most once an hour.

Repository arguments — over MCP every repo argument goes through repoArgResolver (api-surface/repo-arg.ts, applied by mcpToolsets with resolveRepo) before the tool and its usage subject see it: a forge:path of a configured forge stays as it is (the forge prefix in any case), a git remote (git@host:path, ssh://, git://, git+ssh://, ssh+git://) becomes the path on the forge with that host name, a web URL the path on the forge whose URL has the same host and port and whose path prefix it starts with (the prefix is stripped; the longest prefix wins), a web address without its scheme (host/group/app) is read as https://, GitLab web suffixes (/-/merge_requests/1, /-/tree/main, …) are dropped from paths, and a bare path gets the only configured forge, or with several the one forge whose fleet patterns cover it. Forges that share a host are told apart the same way, by whose fleet covers the path. Anything else is passed on unchanged, so the tool answers with its own “no repository” message. A resolved forge:path of a forge that is not configured, or of a configured forge that Holtkeeper does not know (no stored analysis, and its forge answers 404 for it), is refused before the tool runs; one the forge knows under another spelling (case) reaches the tool in the forge’s spelling (knownRepoChecker returns the canonical forge:path), so a misspelled path never gets a plausible answer for a repository that does not exist (knownRepoChecker, applied with repoExists; answers kept 30 minutes for a known repository and 1 minute for an unknown one; a forge outage or a forge client that cannot be built counts as known, and an analyzed repository never reaches the forge). The check runs only for repositories the caller’s own grants (repos:read) cover; any other repository falls through to the tools’ own “may not read” answers, so it never tells which repositories exist out of the caller’s reach. report_secret_exposure is exempt, so a report is never lost to a misspelled repository. The argument’s description says so in place of forge:path. Internal agents still pass forge:path.

MCP — POST /mcp is a stateless Streamable HTTP endpoint (a fresh server per request, @modelcontextprotocol/sdk; JSON responses, except calls of ask, see Ask) authenticated by a token (Authorization: Bearer hk_mcp_…) or a signed-in session; anonymous requests get 401 with WWW-Authenticate: Bearer, GET/DELETE 405. The packages tools (tools/packages.ts, packagesToolset) answer for the organization’s own packages from the API catalog and for third-party libraries from the library index under the same names, and every result says which it is: the catalog answers first for npm and Go alike unless ecosystem names the other ecosystem; a name with a / and no @scope defaults to Go for the fallback, and a Go name with /vN or a package import path resolves to its indexed module (resolveLibrary). repo (forge:path, counted only when the caller may read it; internal agents default to their task repository through defaultRepo) is the repository the caller works in: the version of a third-party library defaults to what it uses, else the newest release. It picks the publishing repository of an organization package only when it publishes one of that name; a repository that does not publish the package at all (one that merely uses it) is ignored there, so the package still resolves, while a publisher that lacks the requested version still answers that it has none (resolveOwn). An organization package defaults to the version repo (or defaultRepo) uses according to its usage record, when that version is recorded (atConsumerVersion; package_api then starts with “<repo> uses ; the newest release is .”, or says the used version has no recorded API and shows the newest), else to its newest release, and head is its default branch; package_source passes that version on too. Folder-mapping twins of an entry point (./services/ next to ./services) are dropped when records are read (withoutFolderTwins of @holtkeeper/api-surface), for third-party APIs as well. A library the index knows but whose API was not extracted answers package_api with a note pointing at package_docs, package_changes and package_source instead of “not indexed”. Third-party text is fenced as third-party data. find_packages (query?, repo?, kind?, limit): with query, the organization packages and indexed libraries matching it and the exports of organization packages matching by name or doc comment; with repo and no query, what that repository imports with resolved versions and use counts (repo does not narrow a search); without arguments every organization package, removed ones last. The repository listing and the full list stop at limit (default 20, at most 50) with a count of the rest. A search lists at most limit organization packages (closest names first: an exact name or last path segment, then names containing the query, then description or repository matches; removed ones last) with a count of the rest; with kind the exports come before the packages. Go internal/ packages of repositories other than repo are left out, with a count of how many, since code outside their module cannot import them; package_api reading one starts with that warning. package_api (package, symbol?, query?, kind?, subpath?, docs?, version?, ecosystem?, repo?, limit): the API of one version, one export in full with the import statement (symbol), or the exports matching query. package_changes (package, from?, to?, include? of api/notes/impact, ecosystem?, repo?): without from and to the recorded versions with removed/changed/added counts between the newest ones, the version repo uses marked (used) with a line naming it (for libraries also the index’s version matrix with who uses which); between two versions (to defaults to the newest release, from to the version repo uses when that is older, for organization packages too, else to the release before to; a from newer than to is refused with “from X is newer than to Y”) the API diff (a changed declaration that loses members is marked breaking and calls for a major), for libraries the changelog and migration notes in (from, to] (still served, with a line saying why there is no API diff or impact, when a version has no indexed API; a missing from is then the version repo uses and a missing to the newest release), and the uses the upgrade affects with their code (impactOf; from the library index impactOfChanges, for Go impactOfGoChanges, which joins each package’s changes with the uses of that package, Go packages pairing across majors by their path without /vN). When the caller passes repo and it is a readable repository other than the package’s own (an agent’s defaultRepo does not narrow), the impact keeps the uses of that repository only (narrowImpact of @holtkeeper/usages) and says how many other repositories are affected; the publishing repository itself sees every user. When several parts are asked for, the API diff and the affected uses are cut on their own (SECTION_CHARS: about 24 000 and 32 000 characters; the changelog keeps its own 20 000 limit of whole blocks) with a hint, after any code or data fence the cut closes, to pass include with that part alone for all of it, so a large upgrade keeps every part under the 80 000-character cap. package_usage (package, export?, member?, prop?, kind?, repo?, code?, ecosystem?, limit): without narrowing, one list of teams → repositories → versions with how many majors each is behind libraries:latest (packageUsers in tools/who-uses.ts, which returns that text and the repositories it counted; direct dependencies and imports from fleetLibraryUses, at most 40 rows, counted as direct dependencies and saying so (“a direct dependency of N repositories”); internal packages: their own repository’s version), then the exports used with props and members from the usage index (renderPackageUsage with repositories: false), then the repositories of that list whose code was read with no use of it (they depend on it without importing it, or their usage record is missing); with a narrowing argument or code: true, the code of the uses, which needs snippet reach; with repo and code: false and no other narrowing, that repository’s summary (exports used with props and members, no code), or an error when no usage record of it is readable. Every row names the repository’s team. package_docs (package?, query?, issues?, path?, heading?, version?, ecosystem?, repo?, limit) and package_source (package, path?, start?, end?, version?, ecosystem?, repo?) are offered with the library index (over serverLibraryDocs): docs search, one document or its list, issue search with issues: true, and source listings or files; usedBy lists show readable repositories only, and libraries no repository the caller may read uses answer as not indexed. evaluate_dependency (tools/dependency.ts) answers what the organization knows about a dependency before it is added or upgraded, from stored records only: whether it is an internal catalog package, the newest release (libraries:latest, else the library index), repositories in reach using it (fleetLibraryUses over depgraph and usages, with use counts, majors behind and each repository’s team; the count is of direct dependencies and the answer says so) and deprecations, advisories of the newest main-line audit record of each repository the caller may read with audits:read (from its stored advisories metrics, auditHeadFindings; findings and allowlisted ones; a version seen in a finding is marked), licenses from the newest licenses record of each readable repository with that repository’s verdict (counting every resolved version, transitive ones included, as the section notes), and with repo the verdict under repo’s policy when its scan does not list the package, the gzip share of every target of the newest bundle records that includes it (npm only), and the panel rules and active learnings that mention the package (search_knowledge). The rules tools (tools/rules.ts): repo_rules (repo, optional files: the repository-relative paths the client touches, optional agent: task (default), review, chat or release, optional topics) returns the rules from createRulesResolver, the same resolver internal agents use: panel rules, the repository’s rules files read from its default branch (root and nested AGENTS.md/CLAUDE.md, .github/instructions, .cursor/rules, …; cached by head sha), policies and active learnings, then the rules offered on demand (requested; panel rules listed as rule:<id>, rules files by path), the block manifest (what was included, cut or left out) and warnings; it needs knowledge:read on the repository. Each topic appends one convention in full, offered when its part of RulesAccess is given (under its own title when it renders one, as commits, releases and assets do, else under # <Topic> of <repo>); a topic the caller may not read becomes a note under its heading (and so do the rules themselves when only topics can be served), and the call fails only when nothing at all could be served: commits (renderCommitConventions of @holtkeeper/commit-conventions with the forge client of the config and the commits.conventions setting that applies: the setting, the forge’s push rules, the commitlint config and the last 100 commits of the default branch; reused for 10 minutes per repository and setting version, failed reads not kept; analyses:read), releases (releaseRules of tools/releases.ts with teamRules: false, releases:read: the team rules are already above, so it ends with “Team rules for release notes: repo_rules with agent: 'release'.”), assets (assetPolicy of tools/assets.ts, with what applies to each asset file among files, at most 10; analyses:read) and test-ids (the test id convention). check_commit_message takes message, branch or both and checks them against the same conventions; a text with no rule known for it is reported as not checked rather than passing, and merge titles git or the forge wrote meet only the explicit patterns. test_ids (repo, optional path: file, folder or component name, limit; or file and content: the file’s text, saved or not) needs analyses:read; it reads the newest testids record and the analyzers.testids entry that applies (testIdsReader), learns the convention from the catalog with the team’s overrides on top (@holtkeeper/testids), and with file and content runs findUntaggedInText with it, deterministic and without an LLM. get_rule (id: rule:<id>, learn:<id> or a rule id; or a rules file path with repo) returns one panel rule, one learning (with sources and counters) or one rules file of a readable repository in full (readRule); with repo and a bare id it tries the rules file of that path first, then the panel rule. Internal agents have it, while the MCP endpoint builds rulesToolset(access, { reader: false }) and reads the same through search_knowledge with id; a token whose knowledge toolset is off keeps get_rule, so on-demand rules stay readable. The server instructions include “Call repo_rules before changing code in a repository”. The knowledge tools (tools/knowledge.ts) check knowledge:read like /api/rules and /api/learnings: search_knowledge (query or id, optional repo, limit) is the one full-text search over store.rules.search and store.learnings.search (learnings settled to now, active ones only), kept only when the rule or learning mentions at least one word of the query (three letters or more, not a stop word; a long word by its stem), filtered to scopes the caller may read and, with repo, to scopes covering it (which needs knowledge:read on the repository); rules rank above learnings at equal score, bodies are cut at 600 characters and results are cited as [rule:<id>] and [learn:<id>]; with id it returns what get_rule does. propose_learning (repo, text of at most 200 characters, optional reason, files; the one knowledge tool without readOnlyHint) needs knowledge:read on its repo and stores a learning of origin agent scoped to the repository through addLearning: pending for the repository’s learnings.approvalDelayDays, or merged as a new source into the learning that already states it; audited as learning.create or learning.reinforce. A tool gets the request’s abort signal and, when the client sent a progress token, a progress callback (ToolContext.progress) that reaches the client as notifications/progress on streamed responses. Outputs over 80 000 characters are cut at a line break (capText) with the tool’s own hint for asking for less (RegistryTool.narrow, e.g. include with fewer parts for package_changes), else a generic one; a call of a tool this caller is not offered answers with an error result instead of the SDK’s “not found”: for a renamed or merged tool (RETIRED_TOOLS in api-surface/mcp.ts, e.g. get_package_api → package_api, review_status → code_review) what to call instead, for any other the tools on offer, and in both cases that the client keeps the tool list it read when it connected and should reconnect to load the current one; a ToolError reaches the client as it is, other failures as Failed: <message>, and a missing permission also carries the ForbiddenError body as structuredContent (see Refusals). Every call is counted (api-surface/usage.ts): daily counters under mcp:usage:<date> (kept 90 days) and the newest 200 calls under mcp:recent, buffered and merged every 5 s with compareAndSet; the client is the first word of the User-Agent. Per person and day a counter keeps calls, errors, the last call and full counts per tool, token and client (the token id comes from tokenPrincipal for bearer requests; the tool registry and each person’s tokens keep these small), plus calls per package for the 200 most asked about, so a day key grows with people, not with calls. Nothing is cut at merge time below those bounds; the overview shows each person’s 10 most used tools, packages and clients.

Inbox decisions are not available through MCP. No tool approves a proposed task group waiting in the Inbox, approves or rejects learnings, dismisses a release or renews an allowlist entry; those stay in the web UI and the REST endpoints (see Inbox). MCP offers three tools that write: propose_learning, which adds a learning that waits for the approval delay, code_review, which queues at most one review per merge request head (see Code review tool), and report_secret_exposure (see Secret reports) (MCP_WRITE_TOOLS in tools/registry.ts): the endpoint mounts no ops or tasks toolset and mounts the releases toolset read-only (release_step is not readOnly and not in MCP_WRITE_TOOLS), so release_step and task tools are not offered, whatever scopes the token carries.

Release tools (tools/releases.ts, toolset releases, built per caller by releaseToolsAccess in release-steps.ts over the release assistant): release_rules (repo) explains the flow in plain language from the resolved releases setting (branches, merge request or trunk flow, scheme and tag format, how the bump follows commit conventions, acceptance, gates, environments in order) followed by the repository’s resolved rules for agent release (createRulesResolver); release_status (repo) renders ReleaseRepoView: where it stands (stageText, the same sentence order as the Releases screen: forge error, failed deploy, “Waiting for acceptance” while the flow asks for one nobody gave, the pending step, a ready or running deploy), latest and next version with the bump reasons, unreleased and ahead counts, the candidate merge request, acceptance, the row’s blockers, failing gates other than those blockers (non-blocking ones marked with their severity), the version on each environment (row.environments), deploy state per environment and the steps allowed next (nextReleaseSteps, which the chat release card uses too; Accept only when the caller’s can.accept holds, i.e. releases:run and an acceptance waits); release_changes (repo, from?, to?: versions or tags; default latest version → target branch, with only to the version before it) renders tasks, the grouped changelog, a ## Public API section when the repository has api-surface records (each changed own package with its removed, changed, deprecated and added counts, the bump it calls for and got, at most 20, and the packages without a record at one end; ReleaseService.changesWithDependencies with publicApi, see GET /api/releases/compare/api) and a ## Dependencies section of the range (ReleaseService.changesWithDependencies: rangeChanges of @holtkeeper/release, cached for good between two tags, and renderDependencyDiff of the dependency changes GET /api/releases/compare answers, or why they were not read), tasks with the tracker’s title, type and status when a tracker answers and the range ends at a version or the configured target or source branch (any other ref shows plain keys, so a pushed branch cannot read tickets through the credential), keys linked only when the tracker or changelog.ticketUrl gives a URL. They need releases:read on the repository. On MCP the releases toolset is toggleable (Releases, off for tokens unless their owner turns it on) and serves release_rules, release_status and release_changes from McpToolsetsContext.releases, which routes/api-surface.ts builds with releaseToolsAccess and releases:read; the same access feeds the releases topic of repo_rules (releaseRules, exported from tools/releases.ts), and no caller passes steps anymore, so release_step is not mounted anywhere. The description below is what releaseToolsAccess builds with steps. release_step (repo, action propose/accept/version/deploy, environment?, tag?, override?, writeNotes?, note?, confirm?; not readOnlyHint) is offered only to requests authenticated by an MCP token that has the release scope (never to signed-in sessions, even with a bearer header, or internal agents) and each call needs releases:run on a repository Holtkeeper may write to; a call refused for either is audited as release.<action> denied. Without confirm it previews (previewReleaseStep, shared with the chat confirmations): what the step does, failing gates, or why it is blocked (Accept is blocked unless can.accept: already accepted, or a flow without acceptance); note is the acceptance note for accept and the recorded reason for deploy; an unblocked preview stores a one-time token in Store.kv (release:confirm:<token>, 10 minutes) bound to the caller, the arguments and a SHA-256 of the release state the step depends on. The second call with the same arguments and the token takes it atomically (compareAndSet, so two concurrent calls run the step once) and runs the step through the release service with channel mcp, so it lands in the release history and the audit log (release.<kind>, via: api, details.channel: mcp); an unknown, expired, reused or mismatched token, or a release state that changed since the preview, is refused and audited as release.<action> with outcome denied, a failing step with error. The releases toolset’s instructions add “Before releasing, call release_rules and release_status” and, with steps, “Never pass override to release_step unless the user asked.”; on MCP the rules instructions name the releases topic among the topics of repo_rules.

Supply tools (tools/repos.ts, in the packages toolset when the context has supply): security_findings (repo?, severity?, status? of open/fixing/allowlisted, limit ≤ 200, default 50) renders readFindings for the asker: severity counts, then one entry per advisory and package with aliases, status (and the fixing task), summary, fixed versions, first seen and a line per repository with versions, lockfiles and status; license_overview (repo?) renders licensesOverview for the asker: totals, the organization’s policy, violations, a row per repository and the license mix, or with repo only that repository’s row and violations. Both answer exactly the groups and rows GET /api/audits/findings and GET /api/licenses answer the same principal, through the same supplyToolsAccess(deps)(principal) the endpoints answer from (ServerDeps.supply, else one built per createApp and passed to auditRoutes, licensesRoutes and createApiSurface), so HTTP and chat share one fleet cache per endpoint across askers. The license policy line appears only for askers with settings:read on the organization scope. They are not offered over MCP (McpToolsetsContext omits supply; people read findings and licenses in the panel); chat gets them for its asker through agentCatalogContext’s supply (internal agents without an asker never do).

Tool registry (tools/): the MCP and internal agent tools are defineTool toolsets (@holtkeeper/agent-tools): packages (packagesToolset: the API, changes, usage, docs, source and evaluate_dependency tools, plus security_findings and license_overview with supply, which only chat passes), stack (stackToolset in tools/stack.ts, offered with stack access: stack_usage with tool and optional version or release line lists the repositories using a runtime, package manager, image or chart grouped by team with end-of-life status; repo_stack with repo lists one repository’s runtimes and images, conventions status and its first 25 direct dependencies from the newest depgraph record; both read stored records only, built by storedStackTools; internal agents only, the MCP endpoint does not serve it), knowledge (knowledgeToolset), rules (rulesToolset: repo_rules with its topics, get_rule unless reader: false, check_commit_message and test_ids, each part offered when its access is given), assets (assetsToolset; { policy: false } leaves out asset_policy), ask (askToolset, MCP only, see Ask), reviews (reviewsToolset, MCP only, see Code review tool below), releases (releasesToolset) and ops (opsToolset), each built per caller from a context that holds what the caller may read. The MCP endpoint serves only the developer toolsets MCP_TOOLSETS, in this order: packages, knowledge (reading one rule in full by id), rules (with any of its parts, no get_rule), assets (repo_assets only; off for tokens by default), reviews, qa, releases (read-only: release_step writes and is never offered; off for tokens by default), ask (only while mcp.ask is on and an AI provider answers) and security (secret reports, unless the token chose off or server.secretReports is false), each but security only when the token’s toolsets name it; stack, ops, security_findings and license_overview stay with chat and the web panel. mcpToolsets mounts them and api-surface/mcp.ts is the adapter: mcpToolsets then drops every tool with readOnly: false except those MCP_WRITE_TOOLS names (propose_learning, code_review, report_secret_exposure), and toolsets left empty. registryServer registers every tool under its name and input schema, readOnlyHint unless the tool sets readOnly: false, joins the toolsets’ instructions into the server instructions and records each call with the tool’s subject. MCP callers keep their grants: canRead is their catalog reach and canReadSnippets their snippet reach (see Cross-team catalog), audits need audits:read, knowledge knowledge:read. Internal agents get the packages and stack toolsets through agentCatalogContext (every task with a checkout mounts packages; reviews, chat and ask mount stack too): without an asker, every repository’s packages, usages, stack and shared notes while access.crossTeam is not off (usage snippets of other teams only under snippets), only repositories sharing an owner team with the task repository when it is off; audits and repository-scoped knowledge of the task repository only. The internal knowledge toolset stays the task-scoped knowledgeTools of @holtkeeper/agent-tools. Chat replies and ask mount rules through agentRulesAccess: repo_rules of other configured repositories that share an owner team with the task’s repository (asking for the task’s own repository is refused, its rules are already the task’s context; reviews do not mount rules) and test_ids of any configured repository; no proposals and no commit conventions. Chat mounts the read-only releases toolset too (agentReleaseAccess): release state of the task’s repository and of repositories sharing an owner team with it, never release_step and never who accepted, and the read-only ops toolset (agentOpsAccess): jobs of the same repositories and the AI budgets that cover the task’s repository, the default one included (taskToolsets names what each task kind mounts). For chat every one of these, agentCatalogContext and agentRulesAccess included, is narrowed to the asking person’s grants (see Agent replies).

Asset tools (tools/assets.ts, toolset assets, built by storedAssetTools over stored settings and records, never an analysis or an LLM): asset_policy (repo, optional path) renders the effective assets.policy as plain facts (assetsPolicyFacts) with the scope it comes from and, for a path, whether it is ignored, allowed, its size limits, the dimension limit and the siblings it needs (pathFacts); repo_assets (repo, severity error/warning (default)/all) renders the newest assets record’s summary: totals per kind, errors and warnings, budgets and up to 30 files with size, problems and the best conversion. Both need analyses:read on the repository for MCP callers and chat askers; reviews read their own repository and repositories sharing an owner team with it. The instructions add “Before adding or changing images, fonts, audio or video in a repository, call asset_policy”. The MCP endpoint mounts the toolset with { policy: false }: repo_assets only, and the policy (assetPolicy) as the assets topic of repo_rules.

Ops tools (tools/ops.ts, toolset ops, built per caller by opsToolsAccess in ops-tools.ts): jobs (repo?, analyzer?, status?, trigger?, signature?, limit ≤ 30, default 15) lists readable jobs newest first, one line each with status (blocked jobs with the budget’s reason), analyzer, target, ref, trigger and schedule, created, duration, attempts and the failure signature; job_log (job, attempt?, tail ≤ 300, default 120, grep? over the last 300 lines) renders the attempt’s steps as an outline with their outcome and duration, then the tail as n time [step] text lines in a fence marked as data; queue_stats renders jobStats for the caller, the same numbers as GET /api/jobs/stats narrowed the same way (workers only for a person’s access (principalOpsAccess) with global analyses:read, never for chat agents; the spend line only with AI read access); why_job (job) renders explainJob: origin (a freshness job’s reason included), outcome, and for queued jobs the wait reasons and the due jobs ahead; analysis_status (repo, forge:path or forge:<team>) renders, for a repository, its health with only the cells the caller may read (the release cell needs the stored release cards, which routes/api-surface.ts and the chat setup in server.ts pass as releaseCards), then freshnessStatus per analyzer: state and reason, refresh class, last run, record sha vs the head freshness last saw, next eligible time and whether the sweeper would queue it now; fleet_health (team?, health?, query?, limit ≤ 200, default 50; offered with fleet access) lists every fleet repository the caller may see, worst first, with the same health, readable cells, freshness and updates as GET /api/repos; the coverage and CI cells of both read the same stored coverage and ci-jobs metrics as GET /api/coverage and GET /api/ci; budget_status (offered only with budget access) lists this week’s budgets with scope, spend, limit, reserve, projection and whether they block. None of them names who requested a job. They are not offered over MCP; chat mounts them read-only for its asker (agentOpsAccess). principalOpsAccess builds them for a person’s own grants: jobs they may analyses:read, health cells they hold the permission of and, with any ai:read/ai:admin grant, the budgets whose scope those grants cover (the default budget with instance-wide ai:read); the instructions add “For a failing or stuck job, call why_job, then job_log”.

QA tools (tools/qa.ts, toolset qa, MCP only, off for tokens unless their owner turns it on; built per caller by qaToolsAccess(deps, principal) in qa.ts over the QA service, so they answer exactly what GET /api/qa/tasks and GET /api/qa/task answer the token’s principal): qa_tasks (days 7, 30 (default) or 90, query? over key, title and repository path, team?; an unknown team is a tool error) lists at most 100 tasks with title, tracker status, repositories, merged / open / direct counts, the last change and whether stored test notes are current or outdated, plus repositories still being read, failed reads and the count of untracked changes; qa_task (key) renders the changes per repository (kind, no review for direct commits and local merges, draft, branches, authors, time, URL, the first 15 files with line counts, test attributes added and removed) and the newest stored summary with what makes it outdated. Read-only: neither tool writes a summary, so agents spend no AI tokens; a key no readable change names is a tool error. The instructions add “For testing a task, call qa_tasks to find it and qa_task for its changes, test ids and test notes.”

Task tools: the MCP endpoint has no tasks toolset and no task tool; people start and approve task groups in Chat, Supply chain › Libraries and Ops › Tasks (see Agent tasks), and a developer’s agent follows a task’s merge request with code_review on the task’s branch.

Code review tool (tools/reviews.ts, toolset reviews, MCP only, built per caller by reviewToolsAccess(deps, canRead) in review-status.ts; routes/api-surface.ts passes canSee(principal, 'analyses:read', target), deps.readOnly and noteReviewJob as onQueued): code_review (repo as forge:path, and branch, the source branch, or mergeRequest, the iid; one of them is required; no other arguments) asks for a review and reports how it stands in one call, so an agent calls it after a push and again a few minutes later. It is one of the MCP_WRITE_TOOLS (readOnly: false, so readOnlyHint is false).

  • Finding the merge request. Through the forge: by number, or the open merge request of the branch, else the newest one of that branch. A branch without one answers that Holtkeeper reviews merge requests and to push the branch, open one and call again; a forge error is told apart by its HTTP status: 404 on a number answers that Holtkeeper sees no such merge request (check the number and its access), 401, 403 and any other 404 that Holtkeeper (naming its forge user from jobs.botUsernames when set) could not read the repository’s merge requests and needs access to read and comment, anything else that the forge did not answer and to try again.
  • Making sure a review is coming (ReviewToolsAccess.review). Nothing is queued when reviews are off, the merge request is not open, a review job is queued or running, or a run already covers the head (reviewedHead: the head of the newest run that is not a thread reply, runs that found nothing new included, in which case nothingNewSince is set; else the ref of the newest succeeded review job). When the first 100 review records of the repository hold none of this merge request, up to 20 further pages of 100 are looked through for its newest run; only when they too end without one while more remain (runsComplete false) is nothing queued, rather than review a head twice. A repository frozen by repo.freeze gets no review and says so. A review of this head the AI budget blocked is not queued again within that budget week, and is after the weekly reset; one that failed is queued once more per head (review-retry:… in store.kv, set only once the retry was queued; without store.kv not at all) and a canceled one never. Otherwise it queues a plain review of the head: the analyzer of jobs.commands.review (default review), ref the head and options { mergeRequest }, trigger command — the job a webhook queues, so the event dispatcher’s duplicate check holds between them. Where jobs.onMergeRequest reviews new commits by itself, the first call for a head only remembers the request (review-request:<forge>:<path>!<iid>:<head> in store.kv, one day) and answers that a review is on its way; a call at least AUTOMATIC_REVIEW_GRACE_MS (60 s) later queues it when still nothing is queued, so a webhook that is seconds away and the request never both start a review. Without store.kv the wait is skipped. Requests made at the same time queue one job: a claim (review-queued:…, compareAndSet) and a fresh look at the waiting jobs precede the enqueue, and the loser answers with the review as queued; the claim is released when queueing fails, so the next call can queue.
  • The answer in Markdown: title, state, draft, branches, head and URL; the newest review run with verdict, mode, time, the reviewed head and whether it is older than the merge request’s head, and the summary; the run’s posted findings by severity with path:line, title, body (cut at 600 characters) and “(has a suggestion)”; the earlier threads the run re-checked (Resolved, or Still applies with the reason); the open Holtkeeper threads read live from the forge (listDiscussions: unresolved resolvable threads whose first note is a Holtkeeper finding comment, with the severity of the stored finding, else the one the comment states, and the count of human replies; left out when the forge cannot list discussions); up to 4 earlier runs (time, mode, head, verdict, findings, threads resolved); and a Next section.
  • Next says that reviews are off for the repository (mergeRequests.comments, or repo.analyzers turning review off) and why; that the merge request is closed or merged; that a review was queued just now (after naming a last job that failed, was stopped by the AI budget or was canceled), is on its way by itself, or is queued or running for a head, each with the advice to call code_review again in a few minutes; that the repository is frozen; that the AI budget stopped the review of this commit, that it failed again or was canceled (with the advice to comment /holtkeeper review or push), or that Holtkeeper could not tell whether the commit was reviewed, each without queueing; that the newest commits brought nothing new to review (nothingNewSince); to fix or answer the open threads, push and call again, after which the next review re-checks them; or “Nothing left to fix.”

Runs are the stored review analyses with ref !<iid> (the newest 100 of the repository are read); thread-reply runs and runs that found nothing new are left out. It needs analyses:read on the repository; an unreadable or unknown repository and missing arguments answer with a tool error. The instructions add “After you push a branch or open a merge request, offer the user a Holtkeeper code review: call code_review with the repository and branch, call it again a few minutes later for the findings, then go through them with the user and fix what is right.”

Connect Claude Code with claude mcp add --transport http holtkeeper <publicUrl>/mcp --header "Authorization: Bearer <token>"; Account › Connect agents in the web UI shows the command, issues tokens, lists the tools and shows usage.

ask (tools/ask.ts, toolset ask, MCP only) hands one question (question, optional repo as forge:path and files) to an agent instead of making the client chain tools. askService (ask.ts) builds the caller’s AskAccess per request, only while the global setting mcp.ask is enabled, llm.provider is set, ServerDeps.askAgentFor yields an agent (the settings agent) and the token’s toolsets include ask.

  • Run. Task kind ask (rules read as agent chat, AI usage feature chat), tier main, maxTurns 14, capabilities: [], no checkout: it mounts knowledge (search only), packages, stack (internal agents keep it; only the MCP endpoint dropped it), rules and assets, every one narrowed to the asker (requester), so it reads what the asker may read and nothing a working tree holds. The target is repo when given (the asker needs repos:read on it), else the stand-in mcp:ask owned by those of the asker’s home teams they hold repos:read and knowledge:read on. An asker without knowledge:read on repo gets a run without its rules context. The run is interactive work of the asker, capped at perAnswerUsd (asked for its final answer at 70 % of it) and 50 seconds (under the 60 seconds MCP clients wait for a tool by default), and follows the request’s abort signal.
  • Sources. The system prompt (ASK_SYSTEM) requires every statement to end with a source copied from a tool result: [rule:<id>], [learn:<id>], [pkg:<name>@<version> <export>], [file:<repo> <path>:<line>], [doc:<name>@<version> <path>] or [url:<link>]. onEvidence collects the rules context and every tool result of the run, and checkAnswer (ask-citations.ts) checks each citation against that text: a rule or learning by its rule:<id>/learn:<id> form, anything else by every space-separated part of its value (verbatim, a path whose :line the evidence need not repeat, or name@version whose version stands with the package: on a line that names it, under any ancestor heading that names it, or in a heading whose section names it). Everything matches as a whole token only, never inside a longer id, version or URL, and a tool result of one line backs nothing: such results are messages (nothing found, no such version) that quote what was asked for. Unbacked citations become [unverified]; renderAnswer appends the backed ones as Sources: and a count of the dropped ones. With no backed citation the tool answers No grounded answer with the tools the run called instead of the text.
  • Limits. perPersonPerDay answers per person a day (counter mcp-ask:<principal>:<date> in Store.kv, taken with compareAndSet once the agent is found, so parallel questions cannot pass it together), weeklyUsd for all ask runs of the week (usageTotals of task kind ask), on top of llm.budget. A grounded answer is reused for ten minutes for the same person, question, repo and files, in process memory, without counting. Quota, budget, cap, timeout, a missing provider or an unreadable repo reach the client as a ToolError.
  • Transport. handleMcpRequest answers a single tools/call of ask as an event stream when the client accepts text/event-stream (STREAMED_TOOLS), so notifications/progress (read <tool> per tool result, when the client sent a progress token) arrive while it runs, with a keep-alive comment every 4 seconds under the idle timeouts of the server and of proxies; every other request stays JSON. A request the client aborts closes its server, which aborts the running tool (one already aborted when it arrives is answered 499 without starting a tool), and Bun.serve runs with an idleTimeout of 120 seconds so an ask answered as JSON is not cut.

It does not search repository source across repositories: code reaches it only as usage snippets, package source and docs the index holds.

secret-reports.ts and routes/secret-reports.ts serve @holtkeeper/secret-reports, under the Holtkeeper Secret Reports License and its use condition. server.secretReports (default true) turns it on; with false, or without Store.kv, MCP offers no security toolset, the routes answer 404, the token list carries no secretReports info and the security.secretReports setting is not registered.

  • Per token. mcpTokens stores secretReports on each token (absent: DEFAULT_REPORTING_MODE, named); authenticate returns it, and /mcp gives the caller secretReportsFor(deps).accessFor(principal, mode). Signed-in sessions without a token (the panel’s tool reference) get the default.
  • What is accepted. A report must name a repository that is in the fleet (inFleet) and that the caller may read with repos:read, or, without repo, a service matching security.secretReports › services or the host of a configured forge (matchesService). Everything else is answered with a reason and not stored. The tool’s own checks (no value in text fields, masks, fingerprints) run before.
  • Named reports store reporter and the exact time and are audited as secret_report.create (via: 'api', details: { kind, identifier, through: 'mcp' }).
  • Anonymous reports store no reporter and a reportedAt moved back by up to 10 minutes. /mcp passes unrecorded: { report_secret_exposure }, so registryServer records no usage for the call, not even in totals; no audit event is written. Only the token’s hourly lastUsedAt moves, as with any call.
  • Slack. Each new report (not repeats) posts kind, identifier, mask, service, repository and a link to every channel of security.secretReports › channels through the Slack connection, never naming the reporter, as soon as it is stored. A failed post is ignored.
  • GET /api/secret-reports — SecretReportList, newest first, with canWrite; needs credentials:read on everything.
  • PATCH /api/secret-reports/:id — UpdateSecretReportInput { status?, note? } → SecretReportView; needs credentials:write on everything; audited as secret_report.update with the status and whether the note changed.
  • GET /api/secret-reports/license — SecretReportsLicense { name, text } for anyone signed in, so the panel shows the license next to the choice.

The third-party library index of @holtkeeper/libraries (setup and use: docs/libraries.md; design: docs/library-docs.md) runs when the store has libraries and an artifact store is configured.

Setting libraries (section Libraries, librariesSetting): only the entry for All repositories counts; without one the index runs with the defaults (librariesConfigFrom answers them), so it is on out of the box and enabled: false turns it off; a stored value that does not parse turns it off too. Every field is optional: enabled (default true once the setting exists), interval (1d; <n>m|h|d, at least 1h), github (ids or names of credentials whose secrets are GitHub tokens, a list; a single string counts as a list of one; unset: every credential of kind github (githubReferences), so adding one is enough; []: anonymous), digests (false), goPrivate (Go module path patterns in GOPRIVATE syntax that are private, see below), and the indexer’s exclude, include, maxVersions, firstOfMajor, sources { repository, releases, issues, site } and graceDays, defaulting to defaultLibraryIndexSettings.

Uses (fleetLibraryUses, also behind the Dependencies API): exact versions of the direct dependencies in the newest depgraph record of every repository (npm and Go, the resolved or selected version; directDependencies) and of the packages the code imports in the newest usages record (npm and Go, by each package’s ecosystem, absent meaning npm; Go modules with their go.mod versions; local packages and node: imports left out). An accept filter limits which repositories contribute uses. Packages the fleet defines are internal: workspaces of any depgraph layer, versioned or not (definedPackages; Go modules also under their name without /vN), local usages packages (npm or Go; Go also without /vN) and the API catalog’s packages (npm by name, Go by module path and without /vN, so fleet Go modules api-surface covers stay out of the third-party index); defined keeps the highest version an internal package carries in its own repository. The index leaves internal packages to api-surface.

Latest versions (latestVersions(kv) of @holtkeeper/libraries, libraries:latest in Store.kv): each index run records the registry’s newest release of every third-party library in use, indexed ones from the metadata it fetches anyway and excluded ones (exclude globs) from a registry lookup of their own, and drops libraries nothing uses any more. While indexing is off nothing is recorded. The Dependencies API reads latest only from here; “behind” has one definition, breaking releases behind it (majorsBehind: majors, and minors below 1.0).

Duty startLibraryIndex(deps, log) (scheduler leader): about 2 minutes after start, then on a 30 s poll whenever interval passed since the last run or a run was requested (now, or a debounced request whose time came), one run at a time; stop aborts a running run. A run (runLibraryIndex) reads uses with fleetLibraryUses (direct dependencies of depgraph records and the packages usages records import, Go modules under their module path with /vN, so a repository whose depgraph failed on private modules still contributes its imported public modules) and calls indexLibraries with npmRegistry() and goRegistry({ isPrivate }) over the global fetch (Bun honors HTTP(S)_PROXY, so the egress proxy applies), the GitHub client over the tokens of the github credentials (githubClientFor: revealed through the credential service, unreadable ones logged and left out, ETags cached in Store.kv, waiting up to 65 minutes for a rate limit reset and aborted with the run; MCP and agent clients wait at most 10 s), the default issue hook and siteSource() when sources.site is on; it stores the LibraryIndexRun (failures capped at 200) under libraries:last-run in Store.kv and logs a one-line summary. requestLibraryIndex(kv) sets libraries:reindex to true, which the leader picks up on its next poll. A new usages or depgraph record (a finished job’s record through the worker’s onFinished, or POST /api/analyses) calls noteLibraryUses, which sets it to { after } 10 minutes ahead, moved again by every further record, so a batch of jobs leads to one run; an explicit request is never postponed. libraries:running (15-minute TTL, refreshed while running) answers started: false while a run is going.

GitHub use (github-usage.ts): every client githubClientFor builds (index runs, MCP, agents) reports its answers and waits (GitHubClientOptions.onEvent) to githubUsageFor(kv), which counts requests, 304s answered from the ETag cache, rate-limit answers and waits per UTC day, credential (anonymous without a token) and resource, buffers them and merges them every 5 s into Store.kv (github:usage:<day>, kept 90 days) with compareAndSet, so every process adds up.

Private Go modules (privateGoPatterns, goPrivatePatterns in go-private.ts; privateGoModules adds the setting): the whole host (with sub-path) of every forge, from the panel and the config file; on github.com, gitlab.com and bitbucket.org only host/<top> for the top-level namespaces the forge’s fleet (fleetPatterns: the forge’s include plus what teams own or consume there, panel and config file) includes, without wildcards, and for the top-level namespace of every repository of that forge with a depgraph or usages record; and the setting’s goPrivate. A run treats matching modules as internal (fleetLibraryUses({ isPrivateGo }), isInternal) and the Go registry never asks proxy.golang.org or the go-get host about them, so private module paths do not leave the instance. A public-host forge with no specific fleet pattern and no analyzed repository adds nothing: list such modules in goPrivate. The same patterns reach job commands (goPrivateJobEnv, the jobEnv of the job engine, reread at most once a minute): GOPRIVATE joins them with the egress proxy’s patterns in mise and container mode, with or without an egress proxy, so go list, go mod download and go test in jobs never ask proxy.golang.org or sum.golang.org about them. Host mode jobs do not get it. propagate resolves latest through createHttpRegistry({ isPrivateGo: privateGoModules(...) }), so a private module is never looked up on the proxy and needs an exact version.

Visibility (libraryReader, shared by the Dependencies routes and MCP; visibleLibraries wraps a LibraryStore so libraries a caller may not see do not exist for its reads): a library is visible when the caller may read (analyses:read) a repository that uses it; libraries no repository uses are visible with global analyses:read.

Progress (library-progress.ts): an index run writes { startedAt, total, done, library?, libraries?, waitingUntil?, updatedAt } to libraries:progress from indexLibraries’ onProgress and the GitHub client’s waits, at most every 3 s and with a 15 minute expiry renewed on each write, and removes it when the run ends or is aborted, so any process can show it.

Admin routes for Settings › System (routes/library-index.ts, types in @holtkeeper/api):

  • GET /api/system/library-index?q=&ecosystem= (global settings:read) — LibraryIndexStatus: every indexed library by ecosystem and name, repos counting its users, versions the ones in the matrix, chunks and issues (one libraryStats query), failed sources, lastRun, enabled, progress (the run going on now, from libraries:progress) and coverage (librarySourceCoverage: per source, how many matrix versions, or libraries for issues and site, are ok, missing, failed, skipped or not fetched yet).
  • GET /api/system/library-index/github?days=30 (global settings:read, days 1–90) — GitHubTokenUsage: every credential libraries.github names with its GitHub account and live limits (githubTokenInfo: GET /user and GET /rate_limit, which GitHub does not count, cached a minute per token), duplicateOf for a token of an account listed before, error for unreadable credentials or rejected tokens; requests per token and resource over the range, per UTC day by token, totals, and capacity, the live limits summed over distinct accounts.
  • POST /api/system/library-index/reindex (global analyses:run) — LibraryReindexResult; 409 while the setting is off, 503 without libraries or kv.

Answers (serverLibraryDocs): libraryDocs with ownPackage from ownPackageOf(catalog, canRead) (a name, or a deep import path, of an API catalog package the caller may read gets a pointer to package_api and package_source instead of “not indexed”), ownSource from ownPackageSource({ catalog, filter, forgeOf }) (package_source of such a package reads its folder in its own repository through the forge, at the commit the catalog recorded for the version — default the newest release, head the default branch — with paths relative to the package folder), libraryIssues (live GitHub search cached in Store.kv for a day) and sourceSnapshots made on demand (Go from the module proxy’s zip, else the GitHub tarball), the GitHub client resolved once per MCP request or agent. With digests: true, issue threads are digested by the agent of the caller repository (ServerDeps.agentFor; for MCP only when repo is given and readable, for agents the task’s agent) in one turn without tools, task kind library-digest, so it counts against llm.budget and AI usage like other runs.

catalog:read (implied by analyses:read) covers derived facts about a repository: package and version inventory, public API, usages, stack and tool versions; never findings, audits, jobs, releases or review output. The global setting access.crossTeam (off, metadata, snippets; default snippets) widens it: under metadata and snippets any principal with a read grant somewhere (repos:read, analyses:read, catalog:read or *) reads the catalog of every repository, MCP tokens included (catalog:read is a token action and reach is decided per request); snippets adds the code snippets of other teams’ uses (package_usage with code, upgrade call sites). visibility.ts holds the checks: canSeeCatalog, canSeeSnippets, canReadShared (catalog facts of a scope within cross-team reach), catalogReach (reads the policy once per request), and scopeOwner, the teams a scope names (its teams plus the owner teams of exact repositories it names). Results carry the owner (teams on repositories) so the web UI folds other teams into a collapsed section; that is a UI default, not a permission. Chat replies follow the asker: their reach under the policy.

The Supply › Libraries API (routes/dependencies.ts, mounted with the API catalog so it shares its usage index and catalog; helpers in dependencies.ts, types in @holtkeeper/api). Every answer is limited to the caller’s catalog reach; analyzer results (licenses, bundles, Renovate merge requests) only come from repositories the caller may read with analyses:read, here and in evaluate_dependency (internal agents without an asker: the task’s team). Answers read stored records, the library index and libraries:latest only: no forge, registry or model call on page load. Libraries are keyed <ecosystem>:<name>; Go modules join their library without the /vN suffix.

  • GET /api/dependencies — DependencyTable: repositories (owner teams for team folding, the depgraph record, libraries used) and one row per library from fleetLibraryUses: users and versions, the version spread with breaking releases behind latest, latest (registry latest from libraries:latest; for internal packages the version in their own repository, or for Go modules, which carry none, the highest version any repository requires), majorsBehind and reposBehind, advisories from the stored advisories metrics (allowlisted ones included) of the newest main-line audit record of each repository the caller may read with audits:read, the same records GET /api/audits/findings reads (auditHeadFindings; distinct ids, worst severity), license expressions and the worst verdict from the stored byPackage metrics of the newest main-line licenses records, and Renovate’s state from the stored pending metrics of the newest main-line renovate records (broken when an open Renovate merge request carrying an update of it has a failed pipeline or error, open, none; managers npm, pnpm, yarn, bun and gomod). The table reads no data of licenses, renovate, audit or bundle records (auditHeadFindings, licenseStates, renovateStates in dependencies.ts); records stored before those metrics fields existed add no licenses or Renovate state until their next run. Internal packages are flagged internal, sorted last and left out of the third-party totals. The table is kept in the fleet cache under the ids of the newest depgraph, usages, licenses, audit and renovate records, the API catalog’s records and the checked latest versions, together with which repositories the caller reaches through each predicate, so a repeat read with nothing new reads no record.
  • GET /api/dependencies/search?q=&limit= — DependencySearchResult: libraries from the same uses whose name contains q (case-insensitive; 400 without it), name prefixes first, then by readable repositories using them, at most limit (default 10, at most 50); each hit is { ecosystem, name, internal, latest?, usedBy } with no audits, licenses or Renovate joined. The ⌘K palette’s library source.
  • GET /api/dependencies/library?ecosystem=&name= — DependencyDetail (Overview and Docs): users with owner teams and versions, advisories (from the same audit metrics as the table), licenses per version with each policy’s verdict, the gzip share of every measured bundle target (npm), open Renovate merge requests, the versions the library index keeps and the documents of its newest indexed version. 404 when no readable repository uses it, the caller’s library index does not know it and, for npm, no readable API catalog record defines it (an internal package only the catalog knows answers with no users); 400 for an ecosystem other than npm or Go.
  • GET /api/dependencies/api?ecosystem=&name= — DependencyApi (API tab header): for an internal package the newest API catalog record defining it (definedIn: repository, release ref, analysis id), otherwise the library index’s API at the newest indexed version; api counts exports and documented exports of that version and subpaths lists its entry points, . first. Without a recorded API both are empty; 404 when the library is neither in the catalog nor indexed nor used by a readable repository.
  • GET /api/dependencies/upgrade?ecosystem=&name=&from=&to= — DependencyUpgrade: from defaults to the oldest version in use, to to latest. For third-party libraries, the changelog text in (from, to] (LibraryDocs.changes) and the diff of the two indexed APIs; for internal packages the API catalog’s diff; for an internal Go module, the diff of every catalog package of the module (any major), so a module without a root package still gets one. npm uses the diff affects come from the usage index (impactOfChanges within snippet reach, repositories already on to left out). notes says why a part is missing, and adds impactNotes: Go interfaces that only gained methods (their implementations elsewhere must add them) and the users whose uses were read without the Go type checker.
  • GET /api/dependencies/docs?q=&ecosystem=&name=&version=&limit=20 — LibrarySearchResult: chunks of libraries a readable repository uses, limit at most 100.

Supply › Security, Supply › Licenses and the Libraries table read the newest record of each repository from stored metrics only (latestHeadsWithMetrics: analyses.latestHeads, with metrics computed once from data for a newest record stored without them); record data is read for a sheet or a detail, never for a table row.

  • GET /api/audits/findings?repo= — FindingsResponse (readFindings in findings.ts): the findings of the newest main-line audit of every repository the caller may read audits of, one FindingGroup per advisory and package with the repositories it affects (versions, lockfiles), severity, fixed versions and firstSeenAt, which the audit metrics carry from record to record at ingest (the record time where none was stored); severities counts groups per severity. A repository is fixing while an approved, queued, running or mr-open dependency-upgrade task upgrades that package there (joined from store.tasks on every read, past the cache), allowlisted while every finding there is hidden by an audit.allowlist entry that has not expired, otherwise open; a group takes the status of its first repository (open, then fixing, then allowlisted). With store.kv, a group carries urgency (findingUrgencies of security-alert-state.ts): the verdict of the urgent alerts with the Slack permalink once posted, else for malware (isMalwareAdvisory) an urgent verdict by rule, even while alerts are off; urgent counts urgent groups not allowlisted everywhere. Urgent groups first, then worst severity, then most repositories.
  • GET /api/audits/fixes?ids=&repos= — AuditFixesResponse: per repository the caller may read audits of (narrowed to repos, comma-separated forge:path, when given) whose audit is not turned off, the fix attempts (data.fixes) its newest main-line audit record made for any of ids (comma-separated advisory id and aliases); repositories without one are left out. 400 without ids. The finding sheet’s Fix attempts reads it.
  • GET /api/licenses — LicensesOverview (licensesOverview in licenses.ts, routes/licenses.ts): over the newest licenses record of every repository the caller may read analyses of, totals, the license mix, violations (denied, unlisted and unknown packages with versions, licenses, culprits and their repositories, from the stored flaggedDetails metrics; records stored before it have their metrics computed from data), a row per repository with counts per verdict and the license file state, and the organization’s analyzers.licenses policy with its matching preset and the number of narrower overrides (only for callers with settings:read on the organization scope, the check GET /api/settings applies to that entry).

Narrowing: every fleet endpoint first lists the newest heads of all repositories, then keeps the ones the caller’s grants allow with the endpoint’s action (canSee: audits:read for findings, analyses:read for licenses, catalog reach for dependencies); totals, mixes and facets are computed only over what is kept, so a narrow grant never sees another team’s counts. ?repo= narrows further and never widens. The chat tools security_findings and license_overview (not offered over MCP) call the same functions with the asker’s principal (see Public API catalog and MCP).

Fleet cache (fleet-cache.ts, createFleetCache): each fleet endpoint keeps its answer per endpoint key (with every parameter that changes it, the licenses policy entries and whether the caller may read them included) and set of visible repositories, valid while the set of newest analysis ids it was computed from stays the same; one entry per endpoint and visibility, at most 200 entries overall, least recently used dropped first, failed loads not kept, concurrent reads sharing one load. A new record, a changed grant or a changed policy is a new key, so answers are never stale; data that changes without a new record (tasks for fixing, the allowlist expiry against today) is joined after the cache. The cache lives in the process: each web replica keeps its own.

Quality › Bundles, CI, Assets, Reviews and Branches read stored metrics only, like the Supply fleet tables: record data is read for a sheet or a detail, and for a newest record stored before its metrics existed, never for a table row. Every endpoint narrows the same way (newest heads first, then canSee with analyses:read, totals over what is kept); Assets and Reviews also take team and repo, which narrow further and never widen. Every one except Reviews keeps its answers in its own createFleetCache, keyed on the newest analysis ids and the visible repositories. Coverage is described under Coverage.

  • GET /api/bundles — BundlesOverview (routes/bundles.ts): a BundlesRepoRow for every readable repository with a bundle record whose bundle analyzer repo.analyzers does not turn off, built from its newest main-line head (latestHeadsWithMetrics, so a newest head without metrics gets them computed from its data once) and the newest 20 heads of that line (OVERVIEW_RECORDS in bundles.ts, found among the newest 60 heads as mainLineRecords), so a run on another branch neither becomes the row nor joins the series. Per target: status, gzip, initial and delta of the newest measurement, budget and verdict from the current budgets option of analyzers.bundle (bundleBudgetsFor and judgeTarget, the rule the bundles health cell uses), overBudget and a series of the records read, oldest first; per repository the failed and overBudget counts and records read. Sorted by repository. The cache key holds the ids and update times of the analyzers.bundle entries, so a budget change is a new key.
  • GET /api/ci — CiOverview (routes/ci.ts): a CiRepoCard for every readable repository whose newest main-line ci-jobs head (latestHeadsWithMetrics) saw a run in the last 30 days: pipelines, median and p90 pipeline time, success rate, week-over-week change, weekly medians, the problem-job count, teams, status (CiStatus), flakyJobs and queueMedian. Heads whose metrics predate weeks get them recomputed from their record’s data (withCurrentMetrics in fleet-metrics.ts, stored fields kept). releaseGate { pipeline, branch } is joined after the cache, only on cards whose repository the caller may releases:read and only while releases are on for it: pipeline is the gates.pipeline of its resolved releases setting, branch the flow’s target branch, else the card’s ref. The releases entries are read only when a card qualifies.
  • GET /api/ci/jobs?repo=&limit= — CiJobsView: the jobs of the repository’s newest ci-jobs record (ciJobTable of @holtkeeper/ci-jobs): at most limit rows (default 50, capped at 200 as CI_JOBS_MAX; 400 like the Assets table’s when not a positive integer), jobs with problems first, then the slowest; each row with outcomes of its final attempts (success, failed, canceled). total counts every job of the record and outcomes sums over all of them, rows left out included; range is the record’s window and ref its branch option. 404 without a record in the current format. The parsed data of the newest 20 records is kept in memory, keyed on the newest record id.
  • GET /api/ci/jobs/fleet?sort=&limit= — CiFleetJobsView: the jobs of the newest ci-jobs record of every repository the caller may read, each with its repo, ranked by sort (rankFleetJobs): slowest (default; slowest median first), unreliable (only jobs that failed or passed on retry, highest failure rate first) or slower (only jobs whose median grew, most first). At most limit rows (default 50, capped at CI_JOBS_MAX); total counts every job the ranking kept and repos the records read. The rows are cached per set of newest records and visible repositories (createFleetCache), so page views re-read nothing until a new record lands. A bad sort or limit answers 400.
  • GET /api/assets?team=&repo=&status=&kind=&problem=&format=&sort=&cursor=&limit= — AssetsOverview (assetsTable and assetsPage in assets.ts): over the newest main-line assets head of every readable repository whose assets analyzer repo.analyzers does not turn off (latestHeadsWithMetrics: a newest head stored without metrics gets them computed from its data once), repos summarizes every repository matching team (owned by it) and repo, largest first, each with moreRows counting the file rows its metrics left out (they keep 50), which no filter or total sees, and items are the file rows the metrics keep (AssetsMetrics.rows) that match the filters: status policy (a problem above info), saving or any, kind, problem (a rule), format. sort is severity (default, then size), saving or size; ties go by repository and path. Pages hold limit rows (default 50, at most 200); cursor is the previous page’s nextCursor, present while rows remain; total counts every matching row. Unknown values, and a repo that is not forge:path, answer 400 with the first problem (readQuery in context.ts, the shape readBody uses). The cache keeps the whole sorted table per filter set; pages are cut from it.
  • GET /api/reviews?repo=&team=&verdict=&since=&before=&limit= — ReviewList (listReviews in reviews.ts): review runs newest first from review heads created at or after since (default 30 days ago) and before before, rows from the stored ReviewMetrics (records without readable metrics are left out): merge request, mode, verdict, posted findings in total and per severity, threads resolved, model, durationMs and ruleSources (where the rules the review read came from; absent or empty for records stored before them) and costUsd. limit defaults to 50, at most 200; heads are read in pages of limit + 1 and at most 1000 per request (REVIEWS_SCAN), so filtered-out rows cannot make a request read without bound. nextBefore is set whenever older rows may follow, also when the scan stopped first; totals sum the rows returned. The first page (no before) also carries window: reviews, per-verdict counts, findings in total and per severity, resolved threads and cost over every row the query matches in its window (windowTotals, heads read in pages of 200 up to REVIEWS_SCAN; partial when the scan stopped there). A bad query, and a repo that is not forge:path, answers 400 like the Assets table’s.
  • GET /api/reviews/:id — ReviewDetail (reviewDetail): the run’s row, summary, reviewed head, source and target branch, every finding (posted ones and the ones the forge rejected, with the error) and the tokens used. 404 when the record is not a review, its data does not parse or the caller may not read its repository, so an id never reveals one.
  • GET /api/branches — BranchesOverview (branchesOverview in branches.ts): a BranchesRepoRow for the newest main-line branches head of every readable repository (latestHeadsWithMetrics): counts by reason, delta of each count against the main-line record before it (found among the repository’s newest 10 heads), up to 50 authors with branches to clean up and the 20 oldest branches worth deleting, with more counting the rest. Most to clean up first.

GET /api/stack (routes/stack.ts) — StackOverview: the newest stack record of every team (a group-scope run per team and forge, { forge, path: <team> }), one StackTeamView per team with a repository in the caller’s catalog reach, limited to those repositories (each with its owner teams, for folding other teams). Views are built by stackTeamViews in stack.ts, which the stack tools share. Tools carry every use judged at the record’s checkedAt (lag, support, release line, end-of-life date); convention results of repositories the caller may read with analyses:read carry the id of the suggested fix, which POST /api/analyses/:analysisId/changes turns into a merge request, and its per-file diff. For other repositories problems is only a count of the differences and a read error is generic, since problems quote values from the files; the stack tools quote them only where the caller has analyses:read (internal agents without an asker: the task’s team). changes compares with the team’s newest record at least a week older: uses that newly reached or left an ended or ending line, convention differences that appeared or were fixed. Reads stored records only.

Each StackTool carries cycles, the product’s release lines (cycle, releaseDate, eol as a date or a boolean, lts, newest latest) as the lifecycle source listed them when the record was made; absent when none is known. The UI draws version lines and support from them without another lookup.

Agents follow the rules of @holtkeeper/rules: the repository’s rules files, the rules people write in the panel (store.rules) and the rules Holtkeeper learned (store.learnings). rules.ts holds the one resolver every agent run goes through (createRulesResolver); the HTTP routes below manage rules and learnings and show what a run gets.

routes/rules.ts:

  • GET /api/rules?team=&repo=&text= — RuleList: rules whose scope the caller may read (knowledge:read), sorted by title; text searches (store.rules.search, best first), team keeps rules naming that team or covering everything, repo (forge:path) keeps rules whose scope covers the repository. Each is a RuleView with canEdit (knowledge:write over its scope); canCreate says whether the caller writes anywhere.
  • GET /api/rules/:id — RuleDetail { rule, history }, previous versions newest first. 404 for an unknown id, 403 naming only the action without knowledge:read over its scope.
  • POST /api/rules — RuleInputBody (title, body, scope naming everything, a team or a repository pattern, optional files globs, agents, description, alwaysApply); needs knowledge:write over the scope; the author is the caller. Answers 201 with the RuleView. Logged as rule.create.
  • PUT /api/rules/:id — replaces the content and bumps the version; needs write on both the old and the new scope. With version (the version the editor started from), a rule changed since answers 409 (RuleVersionConflictError). Logged as rule.update with field-level changes.
  • DELETE /api/rules/:id — removes the rule and its history; 204. Logged as rule.delete.
  • GET /api/rules/effective?repo=&agent=&files= — EffectiveRules: the resolver’s answer for one agent run (agent review by default, task, chat or release) on the repository, files a comma-separated list of touched paths: the prompt text, every block considered in order (panel rules, repository files, policies, learned rules) with chars, fullChars and cut, the rules offered by description (requested), warnings and the budget used. Repository files are read from the default branch with the instance’s forge client (cached by head sha). Needs knowledge:read on the repository.

routes/learnings.ts:

  • GET /api/learnings?status=&origin=&repo=&text= — LearningList: learnings whose scope the caller may read, most recently updated first (with text, store.learnings.search, best first). status (pending, active, rejected, expired) and origin (reply, miner, agent, person) are comma-separated lists (400 for unknown values); repo keeps learnings whose scope covers the repository. Statuses are brought up to the time of the request with the learning’s policy (settleLearning, policyOfLearning), so a learning past its approval delay reads active before the leader stores it. Each LearningView has canEdit (knowledge:write over its scope) and, when active, expiresAt (last reinforcement plus learnings.expiryDays); people names whoever decided or edited them.
  • POST /api/learnings — LearningCreateBody { text, reason?, scope, files?, agents? }: a person writes a learning (origin person), active at once (addLearning with approvedBy); needs knowledge:write over the scope. A text the fleet already has (findDuplicateLearning) reinforces that learning instead. Answers LearningCreateResult { status: 'added' | 'merged', learning } (201 when added). Logged as learning.create or learning.reinforce.
  • PATCH /api/learnings/:id — LearningPatch { text?, reason?, scope?, files?, agents? } (null clears reason, files or agents); a new text is re-keyed (learningKey), 409 when another learning already has that key; moving the scope needs write on the new one too. Logged as learning.update.
  • POST /api/learnings/:id/approve, POST /api/learnings/:id/reject — decideLearning: approving makes it active now, rejecting keeps it out for good (and keeps its text from being learned again); 409 when it already is. Logged as learning.approve / learning.reject.
  • DELETE /api/learnings/:id — 204. Logged as learning.delete.

Approving, rejecting, editing and deleting need knowledge:read and knowledge:write over the learning’s scope; without them the answer is 403 naming only knowledge:write, so an id never reveals the repository it belongs to.

Learnings come from four places, each through addLearning (learnings.ts), which merges a text the fleet already has (findDuplicateLearning, rejected ones included) into that learning as another source instead of adding it:

  • Replies (captureReplyLearning): a reply in one of Holtkeeper’s review threads that reads like feedback (looksLikeFeedback: a convention, a deliberate decision, “do not flag this”; thanks and “fixed” never pass) is sent once per note (claimed in the store) to a fast one-turn extraction on the automatic agent (task kind learning, $0.02 cap, no tools). The rule is one imperative sentence without names or @mentions (cleanLearningText), scoped to the repository, or to its owner teams when the model calls it a team practice, with optional files globs; origin reply, the note as its source.
  • The rule miner (rule-miner analyzer, below), origin miner.
  • Agents through propose_learning (MCP and internal tasks), origin agent.
  • People through POST /api/learnings, origin person, active at once.

A new learning is pending until its activeAt (learnings.approvalDelayDays, default 3; 0 activates at once) unless a person approves or rejects it earlier; it is then active and reaches prompts until it goes learnings.expiryDays (default 90) without reinforcement and becomes expired. Both settings are read for the learning’s repository when its scope names exactly one, otherwise for all repositories (policyOfLearning). The leader settles learnings hourly (settleLearnings: pending past activeAt → active, stale active → expired) and stores the changes; readers settle on the fly (liveLearnings), so a learning is never late for a prompt.

Reinforcement happens when a merge request Holtkeeper reviewed ends (harvestReviewSignals): every review comment citing [learn:<id>] counts one use of that learning, an actedOn when its finding was fixed, and one vote per 👍 or 👎 on the comment (reinforceLearning), once per comment and learning (claimed in the store). A fixed citation, an up vote or a new source reinforces (an expired learning comes back); citations of [rule:<id>] are not counted.

Review comment signals:

  • GET /api/reviews/quality?by=&repo=&team=&since= — ReviewQuality: what became of Holtkeeper’s review comments on merged merge requests, grouped by by (category default, severity, model, promptVersion, source), from signals updated at or after since (default 90 days ago) in repositories the caller has analyses:read on; each row counts comments by outcome and gives acceptance (fixed over judged) and addressed (fixed or resolved over judged), absent when nothing is judged. 400 for a bad by, since or repo.
  • GET /api/learnings/reactions?repo= — ReactionTotalsList: 👍/👎 per finding category for a repository (knowledge:read), or over all repositories for a global knowledge:read grant.

Agent runs recorded by @holtkeeper/ai-usage:

  • GET /api/ai/usage?from=&to=&repo=&group=&model=&provider=&taskKind=&feature=&analyzer=&origin=&outcome=&groupBy= — AiUsageBuckets: aggregate buckets plus ungrouped totals. feature (reviews, tasks, chat, knowledge or releases, see featureTaskKinds of @holtkeeper/ai-usage) narrows to that feature’s task kinds; anything else answers 400. /api/ai/runs takes the same filters. groupBy is a comma list of day,week,month,repo,group,model,provider,taskKind,analyzer,origin,phase,mergeRequest; from defaults to 30 days ago.
  • GET /api/ai/runs?…&before=&limit= — AiRunList, newest first; next is the before of the next page. Records carry jobId / analysisId for links. people names the users behind the page’s interactive runs (peopleOf), only for callers with users:read in some grant; others get no names and the web shows a short id.
  • GET /api/ai/overview?period=week|month|30d&teams=&feature=&origin=&model=&taskKind= — AiUsageOverview (default week). feature, origin, model and taskKind narrow the totals, top lists and forecast like teams=; budgets, automaticStopsAt and caps ignore them and always show the real figures. It holds: totals and automatic spend of the period so far (current) against the same elapsed span of the period before (comparison: Monday 00:00 to the same weekday and time last week, the same days of the previous UTC month, or the 30 days before; periodSpans of @holtkeeper/ai-usage), the top 5 repositories, models, task kinds and analyzers by cost, the status of every readable llm.budget entry plus the default budget for callers who read everything when no global entry exists (spend and automatic spend this week, weeklyUsd, reserveUsd, warnPercent, %, forecastUsd, automaticStopsAt, the week’s range), cache hit ratio (cache read tokens over all input tokens), error rate, automaticStopsAt of the broadest budget (broadestBudget) and forecast: this budget week’s spendForecast over everything the overview covers, whatever the period. A forecast is the week’s spend so far plus the mean spend of the same remaining span over the last 4 full weeks (weeks before the first recorded usage are skipped; without any, the week’s pace so far is extended), and forecast.days splits the rest of the week by local day, today first (perDay). caps are the read-only spend caps fixed in code: a write task’s default and highest cap (DEFAULT_TASK_BUDGET_USD, MAX_TASK_BUDGET_USD of @holtkeeper/write-task), a chat reply’s cap (CHAT_REPLY_LIMITS) and the mean cost of the period’s chat replies (task kind chat, denied runs left out) within what the caller may read. Unknown periods and features answer 400.
  • GET /api/ai/reviews?period=week|month|30d&teams= — ReviewAnalytics (default week, unknown periods answer 400; reviewAnalytics in review-analytics.ts), for Ops › Review analytics. Spend comes from usage records of the reviews feature within the caller’s ai:read: per phase (initial, update, recheck, reply, and other for runs recorded without one), per UTC day and phase, and per merge request (count, total, mean, median, nearest-rank 90th percentile, the 10 most expensive with their phases and, when a review record of the period names them, title and link; untrackedUsd is spend of runs recorded without a merge request). Runs and findings come from the period’s review records on repositories the caller may read analyses of (ReviewMetrics, at most REVIEWS_SCAN records, partial past that): full and incremental reviews, skipped runs, threads answered after a reply by how (explain, concede, update, fixed for a confirmed fix, open for a problem still there; unknown counts replies runs that recorded no answer), posted comments per severity, suggestions and findings verification refuted. outcomes is ReviewQuality.total over the comment signals of merged merge requests read in the period, plus discussed (threads a person replied in), and costPerFixedUsd divides the period’s review spend by the fixed comments. trend gives each UTC day’s spend, comments posted and the outcomes of comments judged that day; repos the repositories by spend with their merge requests, comments posted, outcomes and spend per fix; noise outcomes per severity and for the 8 most commented categories, and comments per reviewed merge request (clean ones got none, mean and 90th percentile over the others); speed median and 90th percentile of queued-to-finished, queue wait (from runAfter) and work time of finished review jobs (at most 2000), reviews and replies apart, and full reviews by size class of reviewMinutes (sizeClass: under 15, 60 and 180 minutes) with mean cost, duration and comments. teams= narrows all of it.
  • GET /api/ai/week?week=YYYY-MM-DD&teams= — AiWeekBreakdown: one budget week (week is its Monday, default the current week; anything else answers 400) with totals and spend by task kind, analyzer (runs without one share the empty key) and provider, most expensive first (weekBreakdown).

GET /api/home (routes/home.ts, rules in home.ts) answers HomeView, Home in one read. It reads only stored data, never a forge, and keeps each answer per principal and grants for 30 seconds or until a successful /api/* write (invalidateHome).

  • attention — Needs attention, most urgent first, then newest (not-analysed repositories after the other low items): jobs that failed in the last 24 hours grouped by analyzer and errorSignature, or by analyzer and repository for failures without one (the item id is failureSnoozeId of snoozes.ts: job-failures:<analyzer>:<signature> or job-failures:<analyzer>:<forge:path>); jobs an AI budget stopped in the last 24 hours, by reason; one urgent-vulnerability item (severity critical, sorted before other critical items) per finding group with an urgent urgency that some readable repository has not allowlisted (readFindings), naming the verdict’s reason and opening /supply/security?urgent=only&finding=; critical and high vulnerabilities of each repository’s latest audit (with the change since the audit before); audit.allowlist entries the caller may write that expired (allowlist) or expire within 7 days (allowlist-expiring), one per entry with its Inbox item id (allowlistNotices of inbox.ts, shared with the Inbox); releases that need a person (from the release overview snapshot, ReleaseService.snapshot, which never refreshes it): a failed read, a failed deploy, an acceptance nobody gave while there is something to release (awaitsAcceptance of releases.ts, the Inbox rule) and a version blocked by a gate; ready to propose, ready to create a version and ready to deploy need no decision and stay on the Releases page; pending learnings the caller may decide, one item per repository a learning is scoped to and one for wider scopes; repositories whose newest analysis of an existing analyzer is older than 14 days; repositories the caller may see (jobs, audits, release cards, analyses, exact fleet paths) and read analyses of that have no record at all (not-analysed). Every item names its repositories with their owner teams, a sentence and a panel path to act on it, built with @holtkeeper/web-paths: releases the caller may decide in the Inbox (releaseAwaitsDecision of inbox.ts and can.run), pending learnings and allowlist entries open their Inbox item (/inbox?item=<InboxItem.id>&kind=; learnings the oldest one).
  • action — the one action of each item: retry (analyzer; the client re-queues the analyzer on every repository of the item) only for repository jobs when the caller holds analyses:run on each of them and the analyzer can be queued through POST /api/jobs; review for releases and learnings that open the Inbox; renew for allowlist entries; open for the rest, with the item’s page.
  • snoozed — items whose id the caller snoozed (/api/me/snoozes) and whose snooze has not run out are kept and marked snoozed: true. Snoozes are read on every request, outside the 30-second cache, so a snooze shows at once. Allowlist items share their id with the Inbox, so a snooze covers both.
  • changes — What changed: one row per audit log event of the last 7 days the caller may see that succeeded, newest first, at most 40, for the high-signal actions only (versions, proposals, acceptances, dismissals, deploys, setting changes, allowlist renewals, rule edits (rule.*), learnings written, approved or rejected (learning.create, learning.approve, learning.reject), new repositories, credential changes, invitations, sign-ups, recoveries, issued sign-in links and rejected agent tasks (task.reject, linking the group on Ops › Tasks); sign-ins and personal preferences are left out). Each row has one deterministic sentence without the actor’s name, built only from whitelisted fields (the action, the repository path and short tokens of details: release version, tag and environment, setting key, allowlist advisory; never free text or changed values), the page that shows it, the time and the actor (people resolves users).
  • spend — with ai:read: this week’s spend of the readable budget covering the most (broadestBudget: a global one, else the least specific scope, the fullest among equals), its limit, reserve, warnPercent, action, forecastUsd and automaticStopsAt from the same forecast /api/ai/overview uses (no linear projection), and spend by task kind over the caller’s readable usage.

Repository health is not part of Home: the web reads the cells of /api/repos for Fleet health and the worst repositories. Scoping to the viewer’s teams happens in the UI, so one answer serves every scope position.

GET /api/inbox (routes/inbox.ts, rules in inbox.ts) answers InboxFeed: every decision the caller may make, from these sources: proposed task groups, pending learnings (status brought up to now with liveLearnings, so one past its approval delay leaves; dueAt is when it activates by itself), releases that await an acceptance and are not dismissed (releaseAwaitsDecision: the flow asks for an acceptance, nobody accepted the target head, and there are unreleased commits on the target branch (an open candidate merge request alone is no item: an acceptance names the target head, so it is possible only once the changes landed); from the release overview snapshot, never a forge; a card whose release state could not be read is not an Inbox item; proposing, creating or deploying a version is not a decision and stays on the Releases page), and audit.allowlist entries that expire within 7 days or have expired. The raw sources are shared by every caller and reused for 30 seconds; the permission filter (see Permissions per endpoint) and the split into sections run on every request, so one caller’s answer never leaks into another’s. mine holds what the caller may decide owned by one of their home teams (and items above every team), teams the rest; a caller without home teams gets everything in mine. Each section is oldest first, snoozed items stay with snoozed: true, and people resolves proposedBy.

Whether a release asks for an acceptance follows the current releases setting: ReleaseService.snapshot (and every card it builds) recomputes acceptanceRequired from the resolved setting (enabled, flow.mode not external, acceptance not none), and needsAction is false with releases off, so switching acceptance to none or releases off drops the item at the next read. The rest of a stored row (acceptance, stage, request) was read under the setting in force then; a row read under another flow.mode or acceptance mode asks for no acceptance until it is reread, which reading the card schedules (refreshSoon). Any panel write (setting writes included) drops the 30-second Inbox source cache and the cached Home answers (invalidateHome).

GET /api/inbox/count answers InboxCount (mine, teams, total) without snoozed items. It reads the same stored sources and the caller’s snoozes only, never a forge or releases.overview, and answers with an ETag (Cache-Control: private, no-cache); a matching If-None-Match gets 304.

Decisions go through each kind’s own endpoint, and only the caller’s own permission counts:

  • task groups: approve or cancel (see Agent tasks); learnings: approve or reject (see Rules and learnings);
  • releases: Accept (POST /api/releases/accept, offered when ReleaseCard.can.accept) or POST /api/releases/dismiss (see Managed configuration);
  • allowlist entries: POST /api/audits/allowlist/renew — AllowlistRenewInput { settingId, advisory, package?, expires, reason? } moves the expiry of one entry of an audit.allowlist setting entry (found by advisory and package; absent matches an entry without one) to expires (YYYY-MM-DD, not in the past: 400) and replaces its reason when reason is given. The renewed entry follows the governing audit.allowlistPolicy (setting-rules.ts): an expiry more than maxDays from today or a blank reason when requireReason is on answers 400 with the rule it breaks. Needs settings:write on the entry’s scope. There is no optimistic locking: the setting value is rewritten, last write wins, like any setting write. 404 for an unknown setting or entry, 409 when the stored allowlist does not validate. Audited as allowlist.renew with the expires and reason changes. Answers the SettingView.

Snoozes (snoozes.ts, routes/snoozes.ts) are personal marks kept in Store.kv under snooze:<principal> (at most 500, the ones ending soonest dropped first): GET /api/me/snoozes lists the caller’s snoozes that have not run out (SnoozeList, soonest to end first), POST /api/me/snoozes with { id, until } (until in the future, else 400) snoozes a Home attention item or an Inbox item, replacing an earlier snooze of the same id, and DELETE /api/me/snoozes?id= ends one. Both writes answer the new SnoozeList; 409 when concurrent writes kept the change from landing, 503 for a store without kv. Snoozes are not decisions and are not audited.

Inbox decisions are not available through MCP (see Public API catalog and MCP).

startServer always starts a scheduler and a worker (src/jobs.ts, configured by jobs of the config file, with defaults when it has none; see @holtkeeper/jobs) and stops them with the server. Pass the analyzers jobs may run as ServerOptions.analyzers and an agentFor(repo) for analyzers that use an LLM. Job outcomes stay on the job records (blocked when an AI budget refused or stopped the run); they are not audited. Schedules that name an analyzer the server does not have or have invalid options are skipped and logged.

Analyzer options per scope come from the setting analyzers.<kind> (section Analyzers; the panel edits them in a settings sheet on the page that owns the analyzer); analyzerSettings(analyzers) returns the definitions, with the analyzer’s presets as setting presets. A value is a partial options object, validated field by field and stored without defaults; it overrides schedule options and is overridden by a manual job’s own options. Options another setting owns (assets.policy; audit.fix, audit.allowlist, audit.upgrade) are not part of it. Analyzers in RUN_ONLY_ANALYZERS get no such setting: their options are set per run by their own endpoint.

Keys in retiredSettingKeys of @holtkeeper/settings are dropped everywhere: GET /api/settings lists neither their definitions nor their stored entries, GET /api/settings/resolve leaves them out and PUT /api/settings refuses them as unknown, so old rows never fail validation.

A stored value can carry keys its setting no longer reads, for example an option an analyzer dropped or one that moved to another setting. Readers ignore them (object schemas strip unknown keys), and writes refuse them (analyzers.<kind> answers 400 unknown option), but old rows are never migrated. GET /api/settings and GET /api/settings/resolve flag such entries: every SettingView (listed entries, settings, cascade and each row’s entry) carries unknownKeys: { key, movedTo? }[] from unknownSettingKeys of @holtkeeper/settings, with dotted paths for nested fields; it is absent when there are none and never set on secret entries. movedTo names the new home from the definition’s movedKeys: analyzerSettings lists the options another setting owns (policy → assets.policy; fix, allowlist, upgrade → audit.*) and MOVED_OPTIONS (analyzers.assets ignore and optimizeIgnore → assets.policy › ignore).

POST /api/settings/draft (PolicyDraftInput) saves several setting changes at once for Settings › Policies: it validates every change like PUT /api/settings first and stores nothing unless all pass, then writes one setting.draft audit event. POST /api/commit-conventions/check (analyses:read on the repository) checks a message, a branch name or both against the repository’s commit conventions. Both are described in policies.md.

GET /api/settings/resolve?repo=forge:path or ?team=<key> answers ResolvedSettings for the hub’s and the team page’s Settings tab: settings (the winner per key with an entry), cascade (every covering entry per key) and rows, one ResolvedSettingRow per defined key in definition order, built with effectiveSettings. A row carries the definition’s label and section (the web groups rows by it), the winning value, its source and, with an entry, the next broader source it replaces (with its value; the definition’s default when nothing broader covers the focus) and overrides (how many broader entries it beats). source.layer is repo when one of the entry’s path patterns matches the repository, team when one of its teams owns the focus (source.teams names them), org for an entry covering everything and default without an entry. analyzers.<kind> stays one row whose entry applies whole, never merged field by field. Retired keys, keys without a definition, secret definitions and releases.notify (instance-wide webhooks) get no row; a global key only ever shows org or default.

A team focus stands for a repository of the team no narrower entry names: only entries covering everything or naming the team count, and their path patterns are ignored. An unknown team is 404, neither parameter 400. Writing overrides goes through PUT /api/settings and is audited there.

At startup the server seeds the defaults of a fresh install (seedDefaultSettings from @holtkeeper/settings) against every setting it knows, plus defaultPolling from @holtkeeper/updates so polling is on everywhere; ServerOptions.defaultSettings replaces the values, false turns seeding off. Before loading the panel config it also seeds the default triggers (seedDefaults from @holtkeeper/managed-config) for the analyzers it has, and no schedule (see Freshness); first, once per store, it deletes the schedules earlier releases seeded (retireSeededSchedules); ServerOptions.defaultConfig replaces them, false turns this off. GET /api/settings returns each definition’s presets and people: name and avatar of the users among the entries’ updatedBy, like /api/history.

Endpoint Does
GET /api/jobs ?status=&repo=forge:path&repos=&analyzer=&trigger=&schedule=&signature=&analysisId=&q=&limit=&before=, newest first (JobList with people for actors that are users); repos is a comma list of forge:path (group jobs forge:<group>) narrowed to what the caller may read; signature matches errorSignature; analysisId lists the jobs that produced an analysis (indexed); q (at most 200 characters, 400 otherwise) is a JobQuery.search: id prefix, repository path, group or analyzer kind, plus the analyzers whose label contains it; visibility is applied in the store query, before limit; waitHints explains every queued row (waitReasons, as /why) and costs sums each row’s AI usage for analyzers that use an agent, only on targets the caller may ai:read or ai:admin (finished jobs’ sums are remembered), so a list needs no request per row
GET /api/jobs/count ?status=&repo=&repos=&analyzer=&trigger=&schedule=&signature=&analysisId=&q=&since=: JobCountView { total, byStatus } over the same filters as GET /api/jobs (since: created at or after it, 400 when not a date), counted in the store (JobStore.count) over repositories and teams the caller may read; byStatus has every status, zero included
GET /api/jobs/stats ?repos=: JobStats over the repositories and teams (group-scope jobs) the caller may read (job-stats.ts): live queued/running counts and failed/blocked jobs created in the last 24 hours (JobStore.count), claim latency p50/p95 from runAfter to the latest startedAt of up to 500 jobs started in that window, a histogram of the wait reasons of the oldest 50 queued jobs in claim order (capacity when only a worker slot is missing), what running jobs’ agent runs spent so far (only those the caller may ai:read or ai:admin; absent without any AI read permission), and for global analyses:read the live workers from the workers registry key with the jobs each runs. No night-window label: heavy freshness waits show up as their own jobs’ reasons
GET /api/jobs/targets JobTargetList: every repository or team (group-scope jobs, team) with jobs the caller may read, with its owner teams (the web scope switch builds repos from it)
GET /api/jobs/failures ?days=&analyzer=&repos=&limit=: jobs that failed for good in the last days (default 7, at most 90) grouped by analyzer and errorSignature (JobFailureList)
GET /api/jobs/analyzers JobAnalyzerList: every analyzer with label, scope, needs, refresh, presets and its options as JSON Schema (for run forms); any signed-in caller
GET /api/jobs/analyzers/health AnalyzerHealthList: runs, failures, budget stops, targets and median duration per analyzer over 7 days, narrowed to the jobs the caller may read; see analyzers.md
GET /api/jobs/:id one Job with its attemptsHistory and errorSignature
GET /api/jobs/:id/log ?attempt=&offset=&limit=&tail=: a page of one attempt’s log (JobLog; default the latest attempt, 500 lines from 0, at most 2000; tail for the last lines) with every step of the attempt (steps), read from the artifact store
GET /api/jobs/:id/why JobWhy: why the job ran (origin: trigger, schedule, retry), how it stands (outcome: worker, failing step, budget stop) and for a queued job wait: the claim rules that hold it back (waitReasons of @holtkeeper/jobs over the queued and running jobs and the analyzers’ exclusive/after) and the due jobs ahead; mode is jobs.execution.mode (default host) and costCapUsd the job’s budgetUsd option when it has one (write tasks); people resolves actor (job-why.ts)
GET /api/jobs/:id/runs JobRunList { runs, costUsd }: the job’s AI usage records, newest first, and their summed cost; same visibility as the job
GET /api/jobs/:id/transcripts/:ref AgentTranscriptView { ref, lines }: one transcript of the job’s own runs; 404 for transcripts of other jobs and for artifacts that are not transcripts
POST /api/jobs CreateJobInput { analyzer, repo?, group?, ref?, options? }: repo for repo-scope analyzers, group for group-scope ones; options are validated; write-task is refused (400, use /api/task-groups), and so is upgrade-check (use POST /api/releases/compare/check).
POST /api/jobs/:id/cancel cancels a queued or running job; 409 when it already finished
GET /api/egress/rules rules for the egress proxy, see Egress rules
GET /api/egress/cache the egress proxy’s download cache, see Egress cache
POST /api/webhooks/gitlab GitLab webhook, see below
POST /api/webhooks/r/:token one repository’s webhook, see Repository updates

Audit jobs. The audit analyzer (@holtkeeper/analyzers) scans the checkout with osv-scanner, applies the allowlist and, with fix: true, runs the fixers in the job’s checkout (changes are not pushed). Before it runs, the server fills its options from the settings audit.fix, audit.allowlist and audit.upgrade (the largest version jump osv-scanner fix may make) that apply to the repository and from the repository’s config traits. These settings own fix, allowlist and upgrade: analyzers.audit cannot set them (SETTING_OPTIONS drops them from its schema and form, and scopedAnalyzerOptions ignores them in stored entries), so the allowlist policy, enforced only on audit.allowlist, cannot be bypassed there. analyzers.audit may still override traits, and a manual job’s own options win as for every analyzer. Its audit record is the repository’s current security state: Supply › Security, Home, health, security alerts and MCP read the newest one.

Group-scope jobs run per team: Job.group holds the team key and repo is { forge, path: <team> }, permission-checked as { forge, path: <team>, teams: [<team>] }. POST /api/jobs takes team for them (400 <kind> runs on a team: pass team, not repo, unknown team, or when the team owns nothing on any forge) and runs on the first forge the team lives on (teamForges); repository analyzers refuse team (pass repo, not team).

Code changes go through task groups (tasks.ts, routes in routes/tasks.ts, stored in AgentTaskStore): one source, one or more target repositories, one write task per repository on the shared branch holtkeeper/<group id>-<slug>. A group starts proposed; a person approves or cancels it.

  • POST /api/task-groups (AgentTaskGroupInput { kind?, title, prompt?, plan?, patch?, repos, run?, source? }, createTaskGroup) proposes; the caller must see every target (repos:read, or catalog reach of another team’s repository under access.crossTeam), and proposing a patch needs canRunTask on every target too (403 ForbiddenError naming the repository), since the patch runs before any agent. source takes every type but chat (400): only the chat panel sets chat sources, so a request cannot point a group at another thread’s card. 400 for unknown repositories, more than maxRepos (default 10) or neither prompt nor patch. With run: true it is approved at once. Answers 201 AgentTaskGroupView (the group without its patch, derived status, tasks with their branch and can: { retry, cancel }, summed costUsd, hasPatch, and can: { approve, cancel } for the caller).
  • POST /api/task-groups/:id/approve (approveTaskGroup) queues one write-task job per proposed task, moving each task from proposed to approved atomically first (AgentTaskStore.transition), so a double click or two approvals at once queue each task once (maxAttempts 1, actor the approver, options taskId = the group id, task = the task id, the kind mapped to the write task kind, group when there are several targets). The approver becomes every task’s requester. Refused with 409 while the global setting tasks.write has enabled: false (the default), for read-only repositories, once the group’s tasks spent or hold perGroupUsd, or when this week’s AI spend of task kind write-task plus the budgets of other approved, queued and running tasks plus the new budgets would pass weeklyUsd (default $40), and with 403 unless canRunTask: tasks:run on the repository plus repos:read there, or, for another team’s repository, catalog reach and a tasks:run grant that covers it (team grants never do, so it must name the repository, a path pattern covering it or one of its owner teams explicitly). Each job’s budget is perRepoUsd (default $1.50), lowered so the group stays within perGroupUsd (default $5): what its tasks spent and still hold counts, so retries and added repositories get only what is left. A click approves as trigger manual and a start_task call (not offered over MCP) as command, both interactive work for the budget that may use the reserve; groups created by automation with another trigger run as automatic work (budgetClass: automatic, jobs with trigger schedule).
  • A propagate run whose checks fail in some repositories proposes one propagate-fix group for them (proposePropagateFixes, injected into the analyzer as its FixProposer): proposer analyzer:propagate, source { type: 'propagate', group }, automatic budget, each task with its own prompt (failing output, release notes) and the bump as its patch, so the write task tries git apply -3 before its agent. Nothing runs until a person approves it in Ops › Tasks. While tasks.write is off nothing is proposed, and the rollout opens its needs-attention drafts instead.
  • POST /api/task-groups/:id/cancel (cancelTaskGroup) cancels every task that has not opened a merge request or ended, and its job; the proposer may cancel their own group, anyone else needs tasks:run on every target. Open merge requests stay.
  • POST /api/task-groups/:id/reject (rejectTaskGroup) is the Inbox and Tasks reject: a cancel of a group whose status is still proposed (409 otherwise), with the cancel’s permissions, audited as task.reject (target task-group, with repo when the group has one target), which Home’s What changed lists. Proposed groups never expire on their own.
  • POST /api/task-groups/:id/retry (retryTaskGroup) runs every failed or cancelled task of the group that ran once and has no open merge request again, as POST /api/tasks/:id/retry does for one: the same checks (tasks.write, canRunTask on each target, read-only, the group and weekly caps) for all of them at once, so a refusal retries none; 409 when nothing can run again. Audited as task.retry on the group.
  • GET /api/task-groups/needs-approval (TaskApprovalCount { count }, countGroupsAwaitingApproval) counts the groups the caller sees (canSeeGroup) with a task still proposed, reading only proposed tasks and their groups, for the Tasks tab badge.
  • POST /api/task-groups/:id/requests ({ repo, approve }, decideRepoRequest) decides a repository a running task asked for (request_repository): approving adds a task for it, approved and queued at once when the group already was (tasks:run there); rejecting needs the same or being the proposer.
  • POST /api/tasks/:id/retry (retryTask) runs a failed or cancelled task again as a new job on the same branch for the caller, under the same checks as approving; a task whose merge request is still open, or one that never ran (cancelled or rejected before approval: retrying is no approval), is refused (409). POST /api/tasks/:id/cancel cancels that one task and its job (cancelTaskGroup with a task id): its proposer, or tasks:run on its repository.
  • GET /api/write-tasks (WriteTasksStatus): the tasks.write switch and caps, and the write pool read from write-task jobs (queued and running counts, when the oldest queued one was queued, when a worker last started one; writePoolStatus). spentUsd (this week’s write task spend) needs global ai:read or settings:read, pool.workers (ids of workers running write tasks now) global settings:read. Everyone gets pool.busyWorkers (how many workers run write tasks now) and pool.totalWorkers, the live workers in the workers registry key (absent without a KV store). The registry does not record pools, so the total counts workers of every pool and an idle write pool and a missing one still look the same here until a task waits.
  • GET /api/task-groups?source=&repo=&limit= (AgentTaskGroupList, with people: names and avatars of proposers, approvers, cancellers, requesters and deciders) and GET /api/task-groups/:id (AgentTaskGroupDetail, the same with people, the group’s patch in full and taskPatches for tasks with their own, so approvers see what runs), GET /api/tasks/:id: groups the caller proposed or approved, or with a target they may repos:read (other teams’ catalog reach does not cover tasks). Reading one group, and listing groups (only those on the page with an open merge request), first refreshes their open merge requests from the forge (refreshTaskGroup, at most once a minute per merge request): getMergeRequest for the state and head commit, the branch’s latest pipeline for CI, and getMergeRequestDiff whenever the head commit moved, for the diffstat; merged makes the task done, closed cancelled. Each AgentTaskView carries ci (the open merge request’s CI, none without one) and diffstat ({ files, additions, deletions, source }: the merge request’s when read, else the task’s or group’s patch counted by diffstatOf), and each group can: { approve, cancel, retry, reject }.
  • Task progress: the write-task analyzer’s onStart calls taskStarted, which refuses a job no approved task queued (no stored task, another repository or group, another job’s task, or a task no longer approved or queued), so a write-task job from anywhere else never runs, and marks the task running. The job engine’s onFinished (also for jobs stale recovery fails after their worker died) calls taskJobFinished, which ignores jobs the task no longer runs and stores mr-open with the merge request, done when there was nothing to change (or a dry run), failed/cancelled otherwise, with the transcript; the job’s cost (its AI usage records, whatever the outcome) is added to what earlier runs spent. Groups from a chat thread get their card rewritten in place (syncTaskCard) and a system message linking each new merge request or naming the failure.
  • Audit events: task.propose, task.run, task.approve, task.reject, task.cancel, task.retry, task.add_repo, task.reject_repo (target task-group).

The server replaces the registry’s write-task analyzer with one whose policy (writeTaskPolicy) reads tasks.write, repo.freeze, the config’s dryRun, jobs.execution.mode (host refuses: checks run repository scripts) and this week’s write task spend against weeklyUsd (reached: a budget stop) when each task starts, so turning the switch off or marking a repository read-only stops tasks still in the queue. A worker serving the write pool does not start in host mode. Events, merge request policies and note commands never queue write-task jobs. It reads the repository’s commit conventions with commitConventionsReader (the commits.conventions setting, push rules, commitlint, history) and hands the agent’s commands the egress proxy variables of jobs.execution.egress. Agent runs go through the same wrapper as every job agent (withServerDefaults: rules context, the weekly budget, the transcript in the artifact store, an AI usage record with task kind write-task). Only workers of the write pool run the jobs (serve --pool write); /api/jobs/:id/why cannot tell that a write task waits for such a worker.

The server also replaces the registry’s browserslist analyzer with one that reads the repository’s commit conventions through the same commitConventionsReader, so its commit message and merge request title follow them (see @holtkeeper/browserslist).

Analyses stay current without schedules: every analyzer declares refresh (@holtkeeper/analyzer), and a leader duty (startFreshness, a sweep one minute after taking the lead, then every five minutes; only with a key-value store) queues what is stale. decideFreshness of @holtkeeper/jobs decides each analyzer on each listed repository (and each team on each forge it lives on, teamForges, for group-scope analyzers); sweepFreshness adds:

  • Heads. freshness:head:<forge:path> holds the default-branch head ({ sha, at, checkedAt }; a new sha restarts the debounce, 30 minutes unless the analyzer’s refresh.debounce is shorter). Push webhooks and polled pushes set it at once; each sweep also reads up to 25 heads not checked for headPollMinutes (oldest first, one headCommit request each, skipping saturated credentials). A head that cannot be read (empty or inaccessible repository) is noted in freshness:head-miss:<forge:path> and tried again only after four times headPollMinutes.
  • Records. The record compared with the head is the newest one on the main line (mainLineHeads of analyses.ts, the same rule as latestHeadsWithMetrics): a newer run on a release tag (api-surface) or another branch does not make the default branch look stale.
  • Applicability and setup. Analyzers whose options do not validate with the target’s analyzers.<kind> setting (automaticJobBlocker, the same rule triggers use through automaticJobReady, which also yields the no-tests-by-design and turned-off (repo.analyzers) reasons) or whose appliesTo says no (cached per head in freshness:applies:*) are skipped. An uncached appliesTo is read only while picking jobs under the hourly caps, stopping once they are full or the credential is saturated, so the first sweep does not read every repository. refresh.paths compares the record’s commit with the head (compareCommits, memoized in freshness:paths:*); no matching file means fresh.
  • Budget. Analyzers that may call an LLM (needs.agent) skip records without a sha (the first sweep after an upgrade queues none of them) and wait while automatic work reached the weekly budget minus its reserve (budgetGuard, interactive: false).
  • Caps. At most maxJobsPerHour freshness jobs (default 10) and maxAiJobsPerHour of LLM analyzers (default 2) are created in any hour, longest-stale first (no record, then the oldest); the rest wait. A job already queued or running for the analyzer and target is never doubled, and a freshness job that failed holds the next try back by the analyzer’s interval, at least 30 minutes, until the head moves again.
  • Jobs get trigger freshness and the decision’s reason (sha 1a2b3c4 != head 5d6e7f8, cadence 7d elapsed, no record yet), shown by why_job and the job’s Why.

After each sweep the same duty runs the release announcements’ sweep (startFreshness(deps, log, alongside)): tag polling of repositories with releases.announce channels and posting what is due (Release announcements).

Settings (section Automation): freshness (scoped, e.g. one entry per team) { mode: 'on' | 'off' | 'slower', factor }, default on, slower multiplies every interval and cadence by factor (default 3); freshness.sweep (global) { maxJobsPerHour, maxAiJobsPerHour, nightWindow: { from, to }, headPollMinutes }, night window default 01:00–07:00 in the instance time zone. freshnessStatus(deps, target) evaluates one target without queuing or reading heads, for the analysis_status tool. Each sweep also keeps its decisions per analyzer and target in freshness:summary (one day); freshnessSummary(deps, visible) sums them per team (every target, and each owner team of each target; FreshnessTeamSummary.team) for GET /api/automation/freshness, the Freshness cards of Ops › Automation, with the next sweep five minutes after the last.

Analyzer Refresh Analyzer Refresh
depgraph change, 1m, debounce 2m, manifests and lockfiles audit never: the vulnerability index covers it
api-surface change, 1m, debounce 2m, JS/TS and Go sources, manifests ci-jobs, stack, tracker every 1d
usages change, 1m, debounce 2m, JS/TS and Go sources, tsconfigs, lockfiles renovate every 1d, heavy
licenses never: the license index judges npm and Go branches every 7d
testids change, 30m review, propagate, browserslist never automatically (they write to repositories or run on MRs)
coverage, bundle, assets change, 1d, heavy i18n never automatically until its records have a consumer

Point a GitLab project or group webhook at https://<server>/api/webhooks/gitlab with the secret token set to jobs.webhookSecret, and enable the events you use: “Tag push events”, “Merge request events”, “Comments”. The token is compared in constant time; without webhookSecret the endpoint answers 404, a wrong token 401. The server finds the configured gitlab forge whose url prefixes the project’s URL (or the only one). Events that queue nothing are acknowledged with { enqueued: [], ignored: <reason> }; malformed payloads of handled events get 400.

New repositories (new-repos.ts) — when a fleet listing of polling (scheduled or by hand) finds repositories that the forge’s previous stored listing did not have, jobs.onNewRepo queues its analyzers for them once, with trigger new-repo and the audit event repo.discover. Only repository analyzers that are not exclusive (do not push, commit or open merge requests) are queued: analyzers when set, else every such analyzer, minus exclude (the default trigger so also runs rule-miner once), limited to the trigger’s teams and repos (selectionCovers), to analyzers whose appliesTo matches and to ones whose options are valid with the repository’s analyzers.<kind> setting. Kinds with a dailyLimit get the jobs beyond it per UTC day queued with runAfter on the next days (here, in schedules and in Run now). A forge that never listed counts all its fleet repositories as new, so a fresh install analyzes everything once; a repository changing owner teams does not. The default new-repo trigger ({ on: 'newRepo' }) is seeded into the panel; delete it there, or set jobs.onNewRepo in the file, to change that. Repositories known before the trigger existed get the same jobs by hand: POST /api/triggers/new-repo/run. GET /api/jobs/analyzers marks analyzers that change repositories with exclusive: true.

Repository cleanup (repo-cleanup.ts) — the leader duty repoCleanupDuty runs runRepoCleanup at start and every 6 hours: it lists the fleet of every forge (knownRepos) and compares it with the repositories that have analysis records (analyses.latestHeads; records of group-scope analyzers and paths that are team keys are never candidates). A repository missing from its forge’s listing (deleted, moved, renamed or no longer included) is remembered with the time it was first missed (Store.kv key repo-cleanup:missing); once it has been missing for 7 days (REPO_CLEANUP_GRACE_MS) every record of it is deleted (analyses.removeRepo: dependency graphs, audits and every other kind), with the audit event repo.forget (details: { records, missingSince }) and a log line. A repository listed again is forgotten. A forge whose listing fails, or lists nothing while records of it exist, is skipped that run and keeps the times already recorded, so an outage or a broken token deletes nothing. The vulnerability index, Security and the Libraries pages read the newest records, so a removed repository leaves them with its records.

Breaking-change check (server.ts, upgrade-check.ts) — the server builds the upgrade-check analyzer (@holtkeeper/upgrade-check) with inputsFor: upgradeCheckInputs(...), which hands the agents the range’s public API changes (renderApiChanges over the repository’s own api-surface records) and dependency changes (renderDependencyDiff), read by the release assistant for exactly the commits the job checks: by the ends’ labels (version tags, the target branch) while those still resolve to the job’s commits (compareRange), else between the commits, so a moved branch or tag never feeds the agents another range; and puts it in place of the registry copy. Its agents run through the server wrapper like every job agent: rules of the release agent as context, task kinds upgrade-plan and upgrade-check (AI spend feature Releases and QA; upgrade-check searches knowledge but cannot propose learnings, knowledgeSearchOnly in tools/registry.ts, since it reads untrusted diff text), the budget of the job’s trigger. The analyzer is in RUN_ONLY_ANALYZERS: only POST /api/releases/compare/check queues it; it has no analyzers.upgrade-check setting and no freshness, POST /api/jobs refuses it, schedules skip it (automaticSkip) and events, triggers and note commands never queue it.

Rule miner (server.ts) — the server builds the rule-miner analyzer (@holtkeeper/rule-miner) on its store with the forge’s bot username (jobs.botUsernames) and the learning policy of each repository (learningPolicyFor), and puts it in place of the registry copy. It mines merged merge requests for review comments that led to changes and stores them as learnings of origin miner. The new-repository trigger queues it (new-repo+rule-miner). Its spend counts under the knowledge feature and its agent task mounts no toolsets (taskToolsets('rule-miner') is empty).

Push Hook — a push to a branch queues jobs.onPush.analyzers (repo-scope only) with ref = the pushed commit, { branch } as options and trigger push, when the branch matches one of onPush.branches (Bun.Glob; * stops at /, ** does not) and the trigger’s teams/repos selection covers the repository (selectionCovers), if given. Queued jobs of the same analyzer and branch for an older commit are canceled first, so a burst of pushes runs once for the newest. Deleted branches, tag refs and pushes by the forge’s bot username are ignored. Polling reports branch pushes the same way (pushes of the polling setting). Unlike other events, pushes to read-only repositories still queue their analyzers. Tag, push and merge request triggers leave out analyzers the server does not have (a stored trigger may still name a removed one) and analyzers whose options stay invalid with the repository’s analyzers.<kind> setting; they and merge request policies also leave out analyzers marked defaultBranchOnly (rule-miner) whenever the job would carry a ref. The webhook itself is unchanged. The hook’s before, project.default_branch and the paths of its commits (when it lists all of them; GitLab sends at most 20) go into the event.

Default-branch pushes also record the pushed commit as the repository’s head for freshness (noteDefaultBranchPush; the default branch from the event, else getRepository); they queue nothing by themselves. Webhooks Holtkeeper registers subscribe to every event GitLab has (webhookEvents of @holtkeeper/forge); deliveries no trigger cares about are answered with ignored and queue nothing, so a new trigger never needs a new registration.

Tag Push Hook — queues jobs.onTag.analyzers for the repository with ref = the tag and trigger tag (for monorepo package tags such as @scope/name@1.2.3 the tagged commit’s sha — checkout_sha, so annotated tags resolve to the commit, as polling reports it — so every package one commit releases makes one job), only when the trigger’s teams/repos selection covers the repository, if given. Group-scope analyzers are queued once per owner team of the repository (only the trigger’s teams when set) without a ref. Jobs already queued for the same analyzer, repository and ref are skipped. Deleted tags are ignored.

Merge Request Hook — queues jobs.onMergeRequest.analyzers with options { mergeRequest: <iid> }, ref = the head commit (last_commit.id) and trigger webhook when the merge request is opened, reopened or updated with new commits (oldrev present) or out of draft; other updates (title, description, approvals) are ignored. actions narrows that to some of open, update, reopen; drafts are skipped unless draft: true; teams and repos limit repositories. Labels added in the event (changes.labels) queue jobs.onLabel[<label>], drafts included. Group-scope analyzers are not queued from merge request events. Closed and merged merge requests are ignored.

Note Hook on merge requests:

  • /holtkeeper <command> [args] on any line goes to the chat router (chatFor, see Chat) with the merge request as the conversation. jobs.commands[<command>] queues its analyzer with { mergeRequest: <iid>, ...options }, ref = the head commit and trigger command, so its agent runs count as interactive for the AI budget. Arguments key=value set options by name, --flag sets flag: true, the others fill the args option names in order, the last name taking the rest as a list (lint: { analyzer: 'widget-lint', args: ['targets'] } turns /holtkeeper lint web api into targets: ['web', 'api']); double quotes keep spaces. Options are validated against the analyzer before queueing; a command whose analyzer the server does not have (a leftover of a retired one) is not offered, and events never queue unknown analyzers. Anyone who can comment on the merge request can run these. The built-in release, verify and help are always there. Answers are a standalone note (not a resolvable thread), or a reply when the command was posted in a thread.
  • A reply in a thread Holtkeeper started (first note by the forge’s bot username or carrying its review marker, but not a chat note) queues review (or jobs.commands.review.analyzer) with { mergeRequest, replies: true }, no ref, runAfter = now + REPLY_DELAY_MS (1 minute) and trigger command, since a person asked, so it counts as interactive for the AI budget; the review analyzer then answers every reply waiting in the merge request in one run (replies). A reply that arrives while such a job is still queued queues nothing (that job will see it); one that arrives while it runs queues the next job, since the running one has already read the threads. The reply note gets the seen mark (addNoteMark, in the background, when the event carries the note id and the forge has marks), which the run takes off when it answers. This needs the forge’s listDiscussions. The reply is also looked at for a lasting rule in the background (Learning lifecycle).
  • A merge request seen closed or merged that Holtkeeper reviewed has the reactions on its review comments counted, and the learnings they cite reinforced, in the background (Learning lifecycle).

Events by the forge’s bot username (botUsername of the panel forge, jobs.botUsernames.<forge> of the effective config) and notes carrying Holtkeeper’s hidden markers (<!-- holtkeeper:review ... -->, <!-- holtkeeper:chat -->) are ignored, so the bot never answers itself. Jobs already queued or running for the same analyzer, repository, ref and options are skipped. Audit events: job.command and chat.command (built-in commands that ran), with the note’s author as actor, and mr_policy.<status> for every policy outcome; queued jobs themselves are not audited.

chatFor(deps) (chat.ts) is the server’s side of @holtkeeper/chat: its surfaces (merge-requests and web), a router per message with the built-in commands (merge requests add jobs.commands), and deploy cards that follow release events on whichever surface posted them.

Authorization goes through @holtkeeper/identities: in merge requests the note author’s numeric user id (authorId of the note event, from the webhook’s user.id or the polled note) as gitlab:<forgeId>; authorizeExternal for the repository. Unlinked or unverified accounts are told how to link and verify them, with the provider and id to link.

Slack review status (routes/slack-settings.ts, routes/slack-events.ts, slack/, mr-status.ts). The Slack app marks messages that link merge requests with a review status emoji and, for a message linking several, keeps one status reply in its thread; setup, gates and statuses are in Slack review status. Its credential (bot token and signing secret sealed with the vault, emoji overrides, when and by whom it was set) is one per instance in store.kv under chat:slack:connection.

Route Needs Does
GET /api/slack global settings:read configured, connectedAt and connectedBy when stored, emoji (the overrides), defaultEmoji, fallbackEmoji and eventsPath
PUT /api/slack/connection global settings:write Stores { botToken, signingSecret, emoji? } sealed; 400 when the token is not an xoxb-…; without emoji the stored overrides stay
PUT /api/slack/emoji global settings:write { emoji } replaces the overrides (Slack emoji names, colons stripped); 409 while no credential is stored. Audited as slack.emoji
DELETE /api/slack/connection global settings:write Forgets the credential with its emoji
POST /api/slack/events Slack signature Slack Events API: url_verification, message events; 401 for missing, bad or stale signature headers, 413 over 1 MB, 404 without a credential; not audited (see below)

Team chat (routes/chat.ts, chat-threads.ts, chat-prompt.ts, chat-web.ts). Threads, messages and read markers live in store.chat (@holtkeeper/store). A thread is scoped to a repository (repo), a team (team, stored as the thread’s group) or nobody (canSeeThread): repository threads are visible with repos:read on the repository, team threads with repos:read on { teams: [key] } (a member’s team grant or a grant naming the team), unscoped threads to everyone with chat access (repos:read anywhere, hasChatAccess); callers without chat access get 403 and threads they cannot see answer 404 on every route.

Route Does
GET /api/chat/threads?archived=true&q= ChatThreadList: visible threads (archived ones only with the flag; q keeps titles containing it, ignoring case) by last activity, archivedCount (visible archived threads matching q, from one listThreads({ archived: 'all', q })), each thread with messageCount (one messageCounts aggregate for the page, no message is read), muted (the caller’s own mute) and contextRepos filtered to repositories the caller may read, each with unread, replying, teams (its repository’s owner teams, or its team; empty for unscoped threads), participants (label, name from the users account or the name the person last posted under, avatarUrl); the commands for hints (verify left out); and teams, the configured teams the caller may start a team thread in
POST /api/chat/threads { title?, repo?, team?, autoReply?, contextRepos? } (400 give repo or team, not both, 400 team <key> is not configured); a missing or blank title starts the thread as New thread with titlePending (see Thread titles); the scope must be configured and readable (400/403), every context repository readable by the caller (403). Audited as chat.thread.create
GET/PATCH /api/chat/threads/:id The thread; PATCH { title?, archived?, autoReply?, contextRepos?, muted? } by anyone who sees it (chat.thread.update). contextRepos replaces the repositories the caller may read and keeps the ones they cannot see; each given one must be readable (403). muted mutes the thread for the caller only (setMuted), is not audited and never changes the thread for others
GET /api/chat/threads/:id/people ChatPeopleView: enabled users accounts that can see the thread, by name, with the handle that mentions them (email before @, else the name without spaces)
GET /api/chat/threads/:id/messages ChatMessageList (each message with its stored refs, minus refs to repositories the caller may not read; bodies are never parsed for them; task cards without the steps, merge requests and subtitle entries of such repositories, a task in none of the caller’s repositories shown as “A change in repositories you cannot see.”; costUsd only with ai:read): ?before=&limit= pages back (hasMore), ?after=<cursor>&changedSince=<serverTime> polls for new messages and cards changed in place; cursor is the newest seq of the page, serverTime trails the clock by 30 s so late commits are not missed; messages carry authorLabel
POST /api/chat/threads/:id/messages { body, repo? } (409 in archived threads). Mentions are parsed (parseMentions); the author and mentioned enabled users who can see the thread join participants (addParticipants, atomic), and the author’s current name and email are kept on the thread (rememberPeople, people). /command runs the command about repo or the thread’s repository (400 for a repo outside a repository or team thread’s scope, and for every command in an unscoped thread: commands run in repository and team threads) and its answer is a system card; a body mentioning @holtkeeper, or any message with autoReply, starts an agent reply in the background (replying: true). Audited as chat.message
GET /api/chat/threads/:id/context ChatThreadContextView from store.chat.context: messageCount, costUsd only with ai:read, repos the caller may read (context repositories, then repositories of message refs) with hiddenRepoCount for the rest, tool totals and human participants with their message counts and labels; 404 for threads the caller cannot see
GET /api/chat/threads/:id/export The whole thread as text/markdown (download), authors by participant label and name as the caller sees them, refs and task card entries of repositories the caller may not read left out as in the messages; audited as chat.thread.export; 404 for threads the caller cannot see
POST /api/chat/threads/:id/read { messageId } moves the caller’s read marker forward; posting marks the caller’s own message read
GET /api/chat/unread Unread counts of visible unarchived threads the caller did not mute, and their total
GET /api/chat/messages/:id/transcript The transcript (AgentTranscriptView) of an agent reply in a visible thread; 404 otherwise and for artifacts that are not transcripts

Commands use the web surface: a card is posted as a system message to { thread } and updated in place, so deploy cards keep following release events. With server.publicUrl set, release cards link to the repository’s Releases › Timeline (webPaths.releaseTimeline). Actions are checked against the signed-in person’s own grants.

Agent replies (chatReplies): one reply per thread at a time across processes (a trigger during a reply runs one more afterwards). A process first takes the thread’s reply claim (claimReply, stale after 10 minutes, STALE_REPLY_MS) and waits for it while another process replies; it releases it when done. The agent comes from ServerDeps.chatAgentFor(target, { actor, interactive: true, requester, subject }) (subject the thread’s title), the settings agent in production, so every run is interactive work of the person who asked (it may use the budget reserve, and ai-usage records them as actor). target is the thread’s repository, chat:team/<key> with owner teams [key] (so the team’s rules apply), or chat:team with no teams for unscoped threads; the rules, provider credential and toolsets follow it. The reply runs on tier main, taskKind: 'chat', maxTurns 12, $0.40 (CHAT_REPLY_LIMITS), capabilities: [] and no checkout; it mounts knowledge (search only, and only with the asker’s knowledge:read), packages, stack, rules, assets, releases (read-only) and ops, plus propose_task (repos, title, summary as the plan), which records up to three proposals; each becomes a task group (kind chat, source the thread, proposed by the asker, createTaskGroup) and a task card with the group id and its spend cap (postTaskCard), approved or cancelled from the card (see Agent tasks). A proposal the asker may not make (a repository they cannot see) leaves a cancelled card and a notice. The answer is stored with costUsd, transcriptRef and toolTrace (tool calls counted from the transcript). No agent, a weekly budget refusal, the per-reply cap or an error leave a system notice instead. The tools read only what both the thread’s target and the asker may read (requester): catalog packages, usages and test_ids need the asker’s analyses:read, audits audits:read, repo_rules and knowledge knowledge:read, release state releases:read, jobs analyses:read and budgets ai:read/ai:admin (the default budget only instance-wide). release_status never says who accepted a release.

Thread titles (chat-titles.ts, chatTitles): a thread created without a title is named from its first human message that is not a slash command, in the background after a post answers. Every ordinary post to a thread whose title is still pending starts a run (one per thread at a time in a process; slash commands start none), so a run lost to a restart is repaired by the next message. The message alone, anonymized like reply prompts and cut to 1,200 characters, goes between <message> tags as data (<message> tags inside it are removed) to a fast one-shot (TITLE_SYSTEM, one turn, $0.02, task kind chat-summary so it counts under Chat spend) as interactive work of the poster, recorded under the subject Title of thread <first 8 characters of the id>; the answer keeps its first line as plain text without quotes or a trailing period, at most 60 characters (cleanTitle, fenced code blocks skipped); the system prompt asks for the topic without people, participant labels in the answer are mapped back to the participants’ names, and an answer that still holds an unknown label, a teammate or [email] is dropped. Without an agent, with the weekly budget used up, on an empty answer or any failure (logged, never posted) the title is the message’s first line outside fenced code blocks, cut at a word boundary (fallbackTitle). It is stored with the generatedTitle patch, which applies only while titlePending is set; a rename with PATCH clears it first, so a person’s title is never replaced.

Prompt (chat-prompt.ts): the system prompt (CHAT_SYSTEM) is fixed and the target’s resolved rules for agent chat come as context, so the prefix caches; replies cite [rule:<id>] and [learn:<id>], which textRefs stores as message refs. The user prompt is the running summary, the conversation up to the agent’s last reply and every message since, merged into one block. Humans appear only as Participant A, Participant B, … by first appearance in the thread (stable, stored as participants); the agent is assistant, Holtkeeper’s own messages system (cards as title, subtitle and task summaries). anonymize replaces ids, emails, user names, names and their parts of every users account, every poster the thread remembers (people, so header principals without an account are covered once they posted) and the asker with labels (a teammate for people outside the thread) and any other email with [email]. A header person who never posted in the thread is unknown to the server, so their name in free text stays. Agent replies store the run’s transcriptRef (the server defaults save every run’s transcript to the artifacts) and the tool trace counted from it. Once the history after the summary passes ~20k estimated tokens (SUMMARY_THRESHOLD_TOKENS), a fast one-shot (chat-summary, $0.02) folds everything but the newest ~8k tokens into the summary (planSummary), so the summary is recomputed only after another threshold’s worth of messages.

Command Needs Does
verify <code> nothing Completes the challenge of the author’s linked account
release [status] releases:read The stage in words, the flow (changes → candidate → version → deploy) as stages in a row, latest and next version, unreleased changes, candidate, acceptance, failing gates, deploy state of the latest version and the next steps as commands
release propose releases:run Opens or updates the release candidate
release accept [note=...] releases:run Records the acceptance with the linked person and the surface (merge-requests, web) and answers who accepted
release version [--yes] releases:run Without --yes: the plan (changes, range, failing gates) and the command that confirms it; with it: creates the version
release deploy <environment> [tag=] [--yes] releases:run Without --yes: asks, pinning the tag (default: the latest version); with it: starts the deploy and posts a card with one step per environment, which is edited in place as the deploy runs and finishes (deploy-* release events)

Every release step takes repo=<forge>:<path> for another repository than the merge request’s (or the thread’s). Read-only repositories refuse steps; gate failures are answered with the failing gates. Followed cards are kept in store.kv (chat:live-deploys:<forge>:<path>, the last 20 per repository, three days), so they survive restarts of the server that watches the deploy; server.publicUrl adds a link to the release page.

Triggers are panel documents (Automation); the effective config they produce looks like this:

jobs: {
botUsernames: { work: 'holtkeeper' }, // from the forge's bot username
onMergeRequest: { analyzers: ['review'], teams: ['games'] },
onLabel: { 'deep-review': ['review'] },
commands: {
review: { analyzer: 'review' },
},
}

Each forge can have its own webhook: POST https://<server>/api/webhooks/<forgeId> with X-Gitlab-Token equal to jobs.webhooks.<forgeId>.secret. The forge is known from the URL, so no URL matching is needed. Forges get the secret from POST /api/forges/:id/webhook (below). POST /api/webhooks/gitlab with jobs.webhookSecret of the config file keeps working. URLs are built from server.publicUrl (e.g. https://holtkeeper.example.com), else from the origin of the request that asks for them.

Auto-registration. POST /api/forges/:id/webhook { register?, targets? } generates a new secret (32 random bytes, base64url, sealed in the forge document and returned once) and, with register: true, registers the hook through the forge’s ensureWebhook for each target with every event of webhookEvents. Targets default to the forge’s fleet (fleetPatterns: the fleet include globs plus the paths teams own or consume on that forge): the static prefix of every glob as a GitLab group (games/* → group games), exact paths as projects, and a target nested under another one is dropped. GitLab group hooks need Premium; on Free (404/403) the adapter registers one project hook per project of the group and the response’s notes say so. Registration is idempotent by URL: an existing hook with the same URL is updated. Rotating (calling it again) re-registers on the hooks registered before, so GitLab gets the new secret at once; failures per target are in errors and do not undo the new secret. Removing the forge removes the hooks it registered.

Keeping registrations current. Each registered hook records its events. The leader runs syncWebhooks at start and every hour: forge webhooks of panel forges and repository webhooks of the repositories polling has listed whose recorded events differ from webhookEvents (or were registered before events were recorded) are registered again through ensureWebhook with the same URL and secret, so they start delivering new event kinds without a rotation. Failures are logged as webhooks: ... and retried on the next run.

Disabled hooks. GitLab disables a hook that keeps failing (for example while Holtkeeper is down): for a while after 4 failures in a row, for good after 40. The leader runs checkWebhookHealth (webhook-health.ts) at start and every 15 minutes over the same hooks (forge webhooks of panel forges, repository webhooks of listed repositories): webhookStatus asks the forge about each one by id and URL, so other hooks on the group or project are never touched. When webhookStatus finds a hook under a new id (it was recreated by hand), the stored registration (panel forge document or repository hook) takes the new id and the health entry is keyed by it. A disabled hook (temporarily or for good) is re-enabled through enableWebhook (GitLab: a test delivery of an event the receiver ignores, a test push only as a last resort). While the test delivery runs, the repositories the hook reaches carry a short-lived webhook-test:<forge>:<path> mark and the receiver answers pushes to them 200 with ignored (reenableTestRunning), so a synthetic push never queues jobs.onPush, updates freshness or reaches the release assistant. The attempt is audited as webhook.reenabled (target: { type: 'webhook', id, repo? }, outcome ok or error, actor system, or the person behind a manual run) and logged as webhooks: re-enabled ... / webhooks: could not re-enable .... A failed attempt waits 15 minutes, doubling up to a day (failures, retryAt); a forced run skips that wait but never sends a second test delivery for a hook within a minute of the last (attemptedAt, stored only). A 429 from the forge is not a failure: it retries after a minute, without counting, backing off or an error audit. Runs of one forge never overlap: each holds the webhook-health-lock:<forge> lease (renewed per hook); a run that cannot take it within 30 seconds reports that forge’s hooks as last stored, so a manual click during the leader’s run joins its result. Before writing, a run re-reads webhook-health:<forge> and merges by hook, the newer checkedAt winning; a full run drops hooks no longer registered. A disabled hook with no retryAt is one the forge cannot re-enable. While a hook is disabled the repositories it reaches forget their last delivery (webhook-seen:<forge>:<path>), so polling takes over at its normal interval at once; the next delivery marks them again. Results are kept per forge in webhook-health:<forge> (state, disabledUntil, checkedAt, reenabledAt, lastError, failures, retryAt; unknown when the forge could not be asked, e.g. a token without the rights). Forges without webhookStatus are skipped.

The forge’s token needs scope api and the Maintainer role (project hooks) or Owner role (group hooks) on the targets.

Pipeline Hook — for a pipeline of a merge request’s head commit that ended success or failed, the merge request policies run again as an update event (the engine loads the latest pipeline fresh), so approvals and merges deferred while the pipeline ran happen now. Only enqueue intents queue jobs. Pipelines of other commits are ignored.

Webhook deliveries are turned into ForgeEvents (routes/webhooks.ts) and handled by createEventDispatcher(deps) (events.ts), which does everything described above. Polling (updates.ts) finds the same events and hands them to the same dispatcher, so a repository behaves the same whichever way it learns about a change; jobs queued from polling have trigger poll, and audit events from polling have actor poll and via: 'system'. A job already queued or running for the same analyzer, ref and options is not queued twice, so a change seen both ways runs once.

Repository webhooks. Each repository can have its own URL https://<server>/api/webhooks/r/<token>. The token (24 random bytes, base64url) is the secret: it is sealed with the vault in store.kv (repo-hook:<forge>:<path>) so the URL can be shown again, and found by its SHA-256 (repo-hook-token:<hash>). Deliveries about another project answer 400, unknown tokens 404; only GitLab payloads are understood for now. The hook keeps its last 50 deliveries, newest first (a ring under its own key repo-hook-deliveries:<forge>:<path>, so recording one never rewrites the token or the registered hooks; kept across rotation, deleted with the hook): forge event header, a one-line summary (push to main, 3 commits, merge request !7 open, comment on !7, pipeline failed on !7, tag v1.2.0), jobs queued or why it was ignored, the error of a rejected delivery (bad body, another project) and its duration. createdBy is the principal who issued the current URL.

Polling. A leader duty ticks every 15 s. Repositories are those of the fleet, listed per forge (every 30 minutes or by hand; the result, what the fleet patterns matched before excludes (matched) and the last 20 attempts are kept in poll-fleet:<forge>, and a failed listing keeps the previous list, or the forge’s exact fleet paths when there is none) plus exact repositories the polling setting names. For each with polling enabled (@holtkeeper/updates):

  • The interval is the setting’s, or withWebhook while any webhook URL reported about the repository in the last 24 hours (webhook-seen:<forge>:<path>); withWebhook: 'off' stops polling then.
  • Repositories are grouped by limiter key (the forge’s credential id, forge:<id> for a forge without one). Each key’s polling budget is pollShare (default 0.2) of its requestsPerMinute from limits.credentials or the kind defaults; when the repositories of a key ask for more, all of them are slowed by the same factor (stretch). A never-polled repository starts at a stable point within its interval.
  • Due repositories run one at a time per key, oldest first. A key is skipped while the limiter reports it saturated (cool-down after 429, queue, no free slot) or while the requests spent on it in the last minute would pass its budget; it is tried again next tick.
  • State lives in store.kv (poll:<forge>:<path>: cursor, last poll, requests, events, error, next poll, effective interval, stretch and the last 20 attempts, each scheduled or manual with its result and duration). A lease (poll-lock:<forge>:<path>, 2 minutes) keeps two processes from polling one repository at once.
Endpoint Does
GET /api/repos/updates?repo= RepoUpdatesView: effective polling settings and state with recent attempts, webhookSeenAt, viaWebhook, the repository webhook (its url only with settings:write, createdBy with the user’s name, deliveries and deliveries24h { total, failed })
POST /api/repos/updates/poll { repo }: polls now, whatever the schedule; RepoPollResult { events?, enqueued?, error?, skipped? }
GET /api/repos/updates/fleet/:forge FleetListingView { forge, patterns, repos, matched?, listedAt?, nextAt?, attempts }: the fleet patterns of the forge (fleetPatterns), the repositories of the last successful listing, matched (pattern matches before excludes, for previewing patterns; only with global settings:write, since excludes keep other teams’ paths out), listedAt, nextAt (30 minutes after the last attempt) and recent attempts; global settings:read; 404 for an unknown forge
POST /api/repos/updates/fleet/:forge/list lists the forge’s fleet now (listFleet) and answers the new FleetListingView; the next tick polls what it found; global settings:write
POST /api/repos/updates/webhook { repo, register? }: issues or rotates the URL; the previous one stops working. register (default: when it was registered) replaces the forge hook through ensureWebhook on the project; 502 when that fails (the new URL stays active)
POST /api/repos/updates/webhook/reenable { repo }: runs the disabled-hook check now for Holtkeeper’s hooks that reach the repository, ignoring the retry wait (forge-wide hooks only with global settings:write, the repository’s own hook otherwise); answers the RepoUpdatesView
DELETE /api/repos/updates/webhook?repo= turns the URL off and removes hooks Holtkeeper registered for it

Reading needs settings:read on the repository, the rest settings:write. All answer 503 without store.kv. Audited as repo.webhook_create, repo.webhook_rotate, repo.webhook_delete, repo.webhook_reenable (plus one webhook.reenabled per hook). RepoUpdatesView.webhookHealth lists the last check of Holtkeeper’s hooks that reach the repository (its own and forge-wide hooks on its project or a parent GitLab group); absent before the first check.

Merge request, note (/holtkeeper <command>, as a command event) and pipeline events first run the policies of the setting mergeRequests.policies (see @holtkeeper/mr-policies) that cover the repository, through the repository’s GitForge. Every outcome is logged as mr_policy.<status> (done, skipped, deferred, failed, intent, …) with the policy, action and detail; invalid settings entries as mr_policy.invalid. The configured analyzers are then queued minus the policies’ skipAnalyzers (* skips all), plus their enqueue intents. Done actions are remembered per head commit in store.kv (policy:<engine key>, 90 days), so a redelivered event does not approve twice. config.dryRun evaluates without changing anything. Without policies nothing extra is loaded from the forge.

Every forge event of a repository with releases on (releases.enabled, default off) except notes also goes to the release assistant (src/releases.ts, one per server, shared by routes and the event dispatcher), in the background: it rereads that repository’s overview row once events stop for 30 s (releaseRefreshDelayMs), so bursts cost one read; a tag drops the cached tag list (release:tags:<forge>:<path>, otherwise kept 30 minutes; read in pages of 100 that double until the timeline page, the version or the release_changes range asked for is covered, at most 3200 tags; a version whose predecessor in the list is dated after it, such as a maintenance tag, does not count as covered); a push to the release flow’s source branch rewrites the description of the open candidate merge request Holtkeeper opened; merging the candidate (source into target) records merged and, with acceptance: merge, accepts; adding release-accepted to the merged candidate accepts with acceptance: label. Versions are never created on their own. Release events are kept per repository in store.kv (release:history:<forge>:<path>, newest 100), audited as release.<kind> and sent to the releases.notify targets. Ranges between two version tags are read once with listCommits and kept for good under release:range:<forge>:<path>:<from sha>:<to sha>. Servers without store.kv keep this state in memory.

Tracker issues (issues.ts, optional): with a credential of kind jira (@holtkeeper/issues-jira; url the Jira site, options { authKind: 'basic', email } for a Cloud API token or { authKind: 'bearer' } for a Data Center personal access token, checked by validateJiraCredentialOptions) whose scope covers the repository (the most specific one wins), ticket keys of the repository view’s plans (ReleaseRepoView.issues), of a version’s tasks and of release_changes get the issue’s title, status, category, type and page. Lookups go through cachedTracker in Store.kv (issues:jira:<credential>:<key>, one hour for open issues and unknown keys, a day for done ones), one batched search per range. Without such a credential, or when Jira fails (logged), pages and tools show plain keys; nothing is ever written to Jira and the credential never reaches agents. ServerDeps.issueTracker replaces the lookup in tests.

Announcements (release-announce.ts). Tags, from webhooks and polling alike, also go to the release announcements, which post one Slack message per new version (or per batch of package tags) to the releases.announce channels, independent of releases.enabled and the flow mode; finished api-surface jobs move waiting announcements on. A Go module tag (v1.2.0, libs/paint/v1.2.0) announces the Go packages whose version is that tag (the leading v ignored), limited to the tagged module’s directory. See Release announcements.

See the /api/releases/* endpoints under Managed configuration and @holtkeeper/release.

src/qa.ts (one service per server) answers Releases › QA with @holtkeeper/qa. The repositories are the listed fleet (listedRepos) with the qa setting on (default on) that the caller may read releases of. Nothing is read until someone asks:

  • GET /api/qa/tasks?days=7|30|90&team= starts a background read (four repositories at a time) of every repository never read or read more than five minutes ago, and answers at once from what is stored: tasks with changes in the period, newest first, with their title (the Jira issue’s when a tracker credential covers the task’s newest repository, else from merge request and commit titles), tracker link (the issue’s, else releases › changelog.ticketUrl), repositories and owner teams, counts of merged, open and direct changes, authors and whether a summary is fresh or stale. untracked counts the period’s changes with no key or only placeholder keys; repos.pending counts repositories not read yet, so clients ask again while it is above zero. A failed read is logged, listed in repos.failed and tried again after ten minutes.
  • Histories are kept per repository in kv (qa:history:<forge>:<path>, 30 days, 90 days of history each) and read incrementally; branches are the qa.branches setting, else the release flow’s source and target when releases are on, else the default branch.
  • GET /api/qa/task?key= answers one task over 90 days with each change’s files and test attributes. The files of the newest 40 changes are read from the forge on first view and kept in kv by commit range (qa:detail:..., 30 days; open merge requests by their head). 404 when no readable change names the key.
  • POST /api/qa/summary { key } reads the diffs of the newest 30 changes (older ones reach the agent by title), asks the agent of the newest change’s repository (agentFor) through summarizeTask, in that repository’s qa › language, else its review language (analyzers.review › language), else English, and keeps the newest five summaries in kv (qa:summary:<key>) with who asked, the model, the cost, the repositories and the changes it was written from. A caller sees the newest summary whose repositories they may all read; it carries stale once changes came, went or moved on since. One summary per key is written at a time (409 otherwise).

With store.config, forges (with their fleet include/exclude globs), teams, repository traits, schedules and triggers are edited in the panel (@holtkeeper/managed-config explains how they become the effective config). deps.config is a live view of the effective config: routes, the scheduler (which re-reads schedules every tick), the webhook routes and agents always see the current one. The source is rebuilt after every change and once a minute (rotated tokens, limit settings). Panel forges take their token from a stored credential; their clients are cached per document version and token.

Team maintainers. A principal holding * on { teams: [key] } (maintainsTeam: its grants or the team grants of its memberships) maintains that team. Without global settings:read, GET /api/config/teams lists only the teams it maintains and GET /api/config/teams/:id answers for those; other collections answer 403. Without global settings:write, PUT /api/config/teams/:id may change only title and members of an existing team it maintains: creating a team or writing one it does not maintain (403 creating a team or changing one you do not maintain needs global settings:write), changing owns, exclude or consumes (compared as sets; 403 changing owns, exclude or consumes needs global settings:write; maintainers may change title and members) and DELETE need global settings:write.

Endpoint Does
GET /api/config/<collection> ConfigEntryList: the entries with their document version. Collections: forges, teams, repo-traits, schedules, triggers. Every collection needs global settings:read to read and settings:write to change, except teams (see Team maintainers below)
GET /api/config/<collection>/:id ConfigEntryDetail: the entry and earlier versions of its panel document
PUT /api/config/<collection>/:id creates or replaces the panel document; the whole config is validated first (400 with the problem). Trigger ids are fixed: tag, merge-request, label:<label>, command:<name>
DELETE /api/config/<collection>/:id removes the panel document; 409 when the rest would become invalid
POST /api/forges/:id/webhook generates or rotates the webhook secret, optionally registers the hook (see above)
GET /api/forges/:id/repositories?search=&limit=50 repositories the forge’s token is a member of (listMemberRepositories), newest activity first, as { path, name, webUrl }; global settings:write; 409 when the forge cannot list them, 502 when the forge fails
POST /api/forges/:id/repositories/access { paths } (1 to 50, RepoAccessBatchInput, more answer 400; blanks and repeats dropped, five checked at a time): whether the forge’s token can read each repository before it is added. RepoAccessBatch has one RepoAccessResult per distinct path in the order sent: ok, archived, or from the forge’s error status (forgeErrorStatus) not-found (404: no such path, or the token’s account is not a member), unauthorized (401), forbidden (403), else error with the message; account is the token’s account (getCurrentUser) once, when the forge tells it; global settings:write
POST /api/forges/:id/ssh-key issues or rotates the forge’s SSH key (see below)
DELETE /api/forges/:id/ssh-key removes the key from the forge account and deletes its credential
GET /api/forges/:id/account the account behind the forge’s token (getCurrentUser) as ForgeAccountView { username, name, avatarUrl?, webUrl?, manageUrl?, canSetAvatar }; global settings:read; 409 when the forge cannot tell it, 502 when the forge fails
PUT /api/forges/:id/account/avatar?filename= replaces that account’s avatar (setCurrentUserAvatar) with the raw request body; global settings:write. 400 without filename or for files checkAccountAvatar of @holtkeeper/forge rejects (over 200 KB, also by Content-Length before reading; an extension other than .png .jpg .jpeg .gif .webp .bmp .ico .tiff; contents that do not match it), 409 when the forge cannot change avatars (GitHub), 400 when the forge rejects the file, else 502. The forge gets the file as avatar<ext>. Answers the account read again; audited as forge.avatar_set with contentType and bytes. Passes through read-only and comments-off wrappers
GET /api/schedules/:id/preview?count=10 SchedulePreview: the next run times (smart schedules: windows, zone, jitter)
GET /api/automation/freshness FreshnessOverview: the last freshness sweep counted per team (stale, waiting, fresh, skipped per analyzer) over the targets whose analyses the caller may read, with the last and next sweep; any signed-in caller
GET /api/schedules/runs?limit=10 ScheduleRunList: the recent runs of every schedule (scheduleRuns) and next, its next five run times (nextRuns in the schedule’s zone, else the server’s; empty for a disabled schedule), global analyses:read
POST /api/schedules/:id/run answers 202 ScheduleRunStarted { id, startedAt }, then in the background lists the schedule’s repositories and queues every job of the schedule (also a disabled one), skipping ones already pending and, as a scheduled run does, analyzers repo.analyzers turns off and test analyzers of repositories without tests (repo.tests); global analyses:run; the outcome is audited as schedule.run_result with ScheduleRunResult { queued, skipped, error? }
POST /api/triggers/new-repo/run runs jobs.onNewRepo on every repository Holtkeeper already knows, as if each were new: answers 202 ScheduleRunStarted { id: 'new-repo', startedAt }, then in the background lists the fleet of every forge and queues the jobs with the caller as actor (skipping ones already waiting or running), ending in a trigger.run_result audit event with ScheduleRunResult details (error names forges that could not be listed); global analyses:run; 409 without jobs.onNewRepo
GET /api/repos/avatar?repo= the repository’s avatar: uploaded, else the forge’s, else generated initials on a gradient from the path; ETag and no-cache; repos:read. The forge’s answer (an image or none) is kept in memory and in the artifact store under the ref repo-avatars/<forge>/<path>, and refreshed in the background after 6 hours; the forge is asked once per repository at a time, and a request it has not answered within 2 s gets the generated avatar
GET /api/repos/avatar/info?repo= RepoAvatarInfo: custom, forge or generated, with who uploaded it when
PUT, DELETE /api/repos/avatar?repo= uploads a PNG, JPEG, WebP or GIF (raw body, up to 512 kB, checked by signature) kept in store.kv as repo-avatar:<forge>:<path>, or removes it; settings:write on the repository; logged as `repo.avatar.set
POST /api/analyses/backfill AnalysisBackfillInput { analyzer, repo?, team?, limit = 20 } (routes/backfill.ts, used by the Public API and Bundles pages): validates that analyzer is a repository analyzer of the server, checks analyses:run (on the repository, globally without one) and answers 202 AnalysisBackfillStarted { startedAt }; then, in the background, for each repository (one, those a team owns (400 unknown team <key>), or every fleet repository) queues analyzer for its newest limit releases, oldest first. Package tags such as @scope/name@1.2.3 count once per tagged commit, the job ref being the sha; limit tags are listed first and more only when commits carry several package tags. Releases the analyzer already analyzed and pending duplicates are skipped; an api-surface snapshot that found no packages does not count, so a backfill retakes it. The outcome (AnalysisBackfillResult counts and errors) is audited as analysis.backfill_result
GET /api/releases/overview?team=&filter=action|all&refresh=1 ReleaseOverview { cards, readAt, refreshing, dryRun, people } from a snapshot in store.kv (release:board:index, release:board:row:<forge>:<path>), so it answers without reading the forges: one ReleaseCard per repository (the row plus needsAction, head: the commit a decision names, dismissed while a dismissal holds, and can: accept and run computed per caller after the snapshot from exactly releases:run on the repository, both false on a read-only repository, accept also false unless unreleased changes wait for an acceptance the flow asks for; the row carries the pending step’s blockers, acceptanceRequired, reasons, tasks, leftOut and one environments entry per configured environment with the version running there, and stored rows without environments are dropped and reread) with releases on that the caller may releases:read, those a team owns when asked (400 unknown team <key>); filter=action keeps cards with a pending step, a failed or ready deploy, or a read error, never with releases off. The scheduler leader rereads the fleet repositories four at a time every 30 minutes (repositories with releases off cost a settings read, no forge call); forge events, release events and opening a repository’s page refresh its card. refresh=1, or a snapshot older than an hour, starts a full read in the background (refreshing until it finishes, one at a time across processes through release:board:refreshing); only a server that never read the overview reads it before answering. people: names and avatars of who accepted
GET /api/releases/timeline?repo=&offset=&limit= ReleaseTimelineView (releases:read): versions newest first (versionTimeline; release candidates only with version.prerelease), limit per page (default 10, at most 30; 400 otherwise) with commit count, ticket keys, bump and the recorded deploys per environment (deploy-* history events), total and nextOffset. Tags come from release:tags:*; ranges from the permanent range cache. The first page of a repository with releases on carries next, its overview row (read now when missing); can is the caller’s ReleaseCan for it
GET /api/releases/version?repo=&tag= ReleaseVersionDetailView (releases:read): one version’s entries, changelog markdown, tasks (tracker keys with titles and links, and the tracker’s issue when one answers), compare link, recorded deploys (with the reason of the newest start) and, with environments configured, the live DeployState whose attempts started through Holtkeeper carry actor and reason (withDeployActors); provenance (versionProvenance over the history: who accepted it, how and with which note, who created it, whether gates were overridden, where the notes came from and whether the plan was edited, the CHANGELOG.md commit) and people among those actors; 404 when the tag is not a version
GET /api/releases/refs?repo= ReleaseCompareRefs { repo, versions, branches } (releases:read): every version tag newest first (tags read in growing pages, at most 3200, cached 30 minutes; release candidates marked prerelease), each with the deploy environments that run it (deployedRefs: with releases.deploy.environments, in their order, what the forge reports deployed there through the newest version’s pipeline, else the newest recorded successful deploy; without them, every environment the forge lists that is not stopped, at most 60, with the ref of its newest successful deployment, kept 5 minutes; branches get theirs too), the flow’s target branch (the default branch unless the setting names one) and, in the merge request flow, the source branch
GET /api/releases/compare?repo=&from=&to= ReleaseCompareView (releases:read): the range resolved and read as release_changes (ReleaseService.changes; without to the target branch, without from the version before to; to naming the target branch, configured or the default branch, counts as unreleased like an absent one; tracker issues only when the range ends at a version or the target or configured source branch) plus dependencies, the npm and Go dependency changes between the two ends (diffDependencies of @holtkeeper/dep-diff over GitForge.compareCommits and readFile at both ends; partial when the forge listed 1000 files or more), kept in store.kv for 30 days as release:dependencies:<forge>:<path>:<from>:<to> when both ends are commit shas (version tags) and every file read succeeded (a failed read shows in the root’s errors and is retried on the next request). dependencies is null with dependenciesUnavailable when the range starts at the first commit, the forge cannot compare commits or the comparison failed. summaryAvailable when the caller has releases:run and an agent is configured
GET /api/releases/compare/summary?repo=&from=&to=&code= ReleaseCompareSummaryState { status, code?, markdown?, cached?, startedAt?, error? } (releases:read; never starts anything; code is true or false, 400 otherwise): where the background description of the range stands (ReleaseService.compareSummaryState), per pair of commits the ends resolve to (rangeShas with recent: a branch head read within the last 20 seconds, so polls do not list commits every time), code flag and AI language, from the task kept in kv (summary-tasks.ts) as release:compare-summary-task:<forge>:<path>:<fromSha>:<toSha>:code|log:<language>; between fixed commits a description kept by compareSummary answers done with cached, also ahead of a failed task. When that reads none, the task last started for the same refs answers (release:compare-summary-ref:<forge>:<path>:<from>:<to>:code|log:<language> points at its key for an hour), so a description keeps showing after a branch end moved. A running marker counts 15 minutes after its last heartbeat (the run renews it every 5 minutes; a run whose process died reads as none) and the outcome is written only while the marker is still the run’s own (compareAndSet when the store has it); within one process a start always joins a run in flight, even without compareAndSet. A result is kept 30 days (one hour when the dependency changes were read partly), a failed run 10 minutes; when only storing the result fails, the marker is dropped instead. Without code the answer is the running task of either flag, else the finished one with code, else the one without
POST /api/releases/compare/summary ReleaseCompareSummaryInput { repo, from?, to?, code? } (releases:run; nothing is written to the forge, so read-only repositories are fine) → ReleaseCompareSummaryState (ReleaseService.startCompareSummary): done with cached when a description of the same commits, flag and language exists, the running state when one runs (joined, nothing new starts; across pods the start is a kv compareAndSet), else the description starts in the background (deps.onBackground) and the answer is running; a failed task is started again. The run: the repository’s agent describes the range (writeRangeSummary: task kind release-notes, tier fast, or main with code, whose diff is rangeCodeDiff of compareCommits) from the entries and the rendered dependency changes; code in the answer says whether code went in: without compareCommits, when it fails or when no file survives rangeCodeDiff, the commits are described alone; between two commit shas whose dependency changes were read completely kept for 30 days per asked code flag and AI language as release:compare-summary:<forge>:<path>:<from>:<to>:code|log:<language> (not when the code comparison failed); prose is in the repository’s AI language (aiLanguageOf); 409 without an agent
GET /api/releases/compare/api?repo=&from=&to= ReleaseCompareApi { packages, missing, recorded, backfill?, snapshots? } (releases:read; a caller outside the repository’s catalog reach gets 403; routes/release-compare.ts, mounted by createApiSurface so it shares its catalog and usage index): the range resolved as GET /api/releases/compare (ReleaseService.compareApi), then publicApiBetween (release-api.ts) reads the repository’s own api-surface records directly rather than through the catalog, whose version list keeps one record per npm package version and so loses tags at which a package did not change: a version end takes the record of that tag, else of its commit (package-tag releases are recorded under the commit), else a default-branch run at that commit; the target branch takes the newest default-branch record; records whose extractor read nothing are skipped. Packages are matched by name and only changed ones are listed (new and removed packages included), breaking ones first, each with its PackageDiff, renderDiff Markdown and, when it removed, changed or deprecated exports, the uses in other repositories they touch (impactOfChanges over the caller’s snippet reach, the repository’s own uses left out; repos affected, breaking and check use counts, renderImpact; left out when no repository is affected). “Breaking” is breaksCallers of @holtkeeper/api-surface everywhere (required is major). An end without a usable record lists the other end’s packages under missing (both from the newest record), and nothing was compared; recorded is false without any record with data. backfill.allowed (set while something is missing) is analyses:run on the repository and an api-surface repository analyzer on the server, as POST /api/analyses/backfill checks; backfill.refs (backfillRefs) are the tags or commits of the ends without a record, for POST /api/jobs with api-surface at that ref (a target branch end is left out: its scheduled run records it). snapshots (snapshotJobs, only for callers with analyses:read on the repository, as the jobs routes require) lists, per backfill ref and for a target branch end without a record (its default-branch jobs, under the branch name), the newest non-canceled api-surface job of the repository while queued or running, or failed or blocked within the last day (with its error); a ref whose newest job succeeded is left out, so the web polls while any runs. When nothing is recorded and there is no backfill ref, it also lists the newest queued or running job of up to 10 other refs, which is how a POST /api/analyses/backfill (queued in the background after its 202) shows. Nothing is cached: records can be backfilled at any time
GET /api/releases/compare/package?repo=&package=&ecosystem=&from=&to= ReleaseComparePackage { markdown, found } (releases:read; ecosystem npm or Go, 400 otherwise): exactly what package_changes answers with repo set to the repository (packageChanges in tools/packages.ts runs the tool over the caller’s packages context, which createApiSurface builds as for /mcp without the stack tools): the API diff, for third-party packages the changelog and migration notes, and the uses the upgrade affects narrowed to the repository. A ToolError (package or version not indexed, reversed range) answers found: false with its message
GET /api/releases/compare/check?repo=&from=&to= ReleaseCompareCheck { status, jobId?, analysisId?, data?, error? } (releases:read): where the AI breaking-change check of the range stands (upgradeCheckStatus in upgrade-check.ts). The range resolves as on /releases/compare and then to two commits (ReleaseService.compareRange, which reads only the version tags and a branch’s head commit, never the range’s commits, entries or issues, so the page can poll it; a branch end is its head commit now, so a branch that moved is a new range). Only jobs and records in the repository’s AI language (aiLanguageOf; a record without language counts as English) count, so a check written before the language changed reads as none. A queued or running upgrade-check job whose options carry both commits wins (queued/running); then a failed or budget-stopped job that ended after the newest finished record (failed with its error, plus that record’s analysisId and data when there is one); then the newest record whose ref is upgradeCheckRef(fromSha, toSha) (done, data is its UpgradeCheckData); else none. Canceled jobs are ignored.
POST /api/releases/compare/check ReleaseCompareCheckInput { repo, from?, to?, force? } (releases:run; nothing is written to the forge) → ReleaseCompareCheckStart { jobId?, existing? } (startUpgradeCheck): resolves the range like the GET and, without force, answers a finished check of the same two commits as existing (with the job that wrote it while the job is kept) instead of queueing; a queued or running job of the same commits is returned as jobId; otherwise it queues one upgrade-check job: ref the to commit, options { from, to, fromLabel, toLabel, language } (commits, the labels the page shows and the repository’s AI language; an existing check or running job counts only in that language), trigger manual, maxAttempts 1, actor the caller. Jobs of the same to commit with another start are separate runs. 409 when the range has no start, an end cannot be found, the repository has no AI agent or the server lacks the analyzer.
GET /api/releases/repo?repo= ReleaseRepoView (releases:read): board row, resolved settings, the proposal and version plans with the stored edits, newest versions, deploy state of the latest version (attempts with actor and reason), history, forge links (releaseLinks), tracker issues of the plans’ keys when a tracker answers, people among the history’s actors and the acceptance, what the caller may do (accept and run as on the cards, configure from settings:write), read-only, dry run, whether an agent is configured
GET /api/releases/detect?repo= ReleaseDetectView { repo, detection, configured } (releases:read on the repository; 404 for an unknown forge): the flow detectRepositoryFlow suggests from the repository’s branches, tags, merged merge requests and files, read from the forge on each request and never kept in the snapshot or the repository view; configured when a releases setting names the repository or one of its owner teams
GET /api/releases/deploy?repo=&tag= DeployState of one version (releases:read), for rollbacks to older versions
PUT /api/releases/edits ReleaseEditsInput { repo, step, edits } (releases:run): keeps a person’s edits of a plan (null drops them) in store.kv as release:edits:<step>:<forge>:<path> until the step runs
POST /api/releases/summary ReleaseSummaryInput { repo, step } (releases:run): the repository’s agent writes the notes on demand (writeSummary: task kind release-notes, tier fast, the repository’s resolved rules for agent release as context), stored as an edit; 409 without an agent. Notes are never written per tag on their own
POST /api/releases/propose, POST /api/releases/version ReleaseStepInput { repo, force?, writeNotes? } (releases:run, not on read-only repositories): runs the step (proposeRelease, createVersion of @holtkeeper/release), answers ReleaseStepResult; failing gates answer 409 ReleaseGateError { error, gates }, force overrides the soft ones. writeNotes (propose) has the agent write the notes first, as POST /api/releases/summary does, unless a person wrote them. A step drops the plan’s edits; a version also drops the acceptance. config.dryRun reports instead of acting
POST, DELETE /api/releases/accept ReleaseAcceptInput { repo, note? } (releases:run): accepts the target branch head for release (kept as release:acceptance:<forge>:<path> with the caller’s id, name and channel: ui from a browser, else api) or withdraws it. A person can always accept, whatever acceptance says. The hook for any outside process (QA, CI, ticket workflows)
POST /api/releases/dismiss ReleaseDismissInput { repo, sha } (releases:run): hides the release waiting in the repository from Inbox and Home (needsAction false, dismissed set on its card) until a new commit arrives; sha is the card’s head, 409 when the head moved since or nothing waits. Kept in store.kv for everyone; nothing changes on the forge. Logged as release.dismiss with the sha
POST /api/releases/deploy ReleaseDeployInput { repo, tag, environment, redeploy?, force?, reason? } (releases:run): starts the environment’s deploy job (startDeploy), records deploy-started with the job id and the reason (the given one, else redeploy or order overridden), and follows it every 15 s (releasePollMs) for 12 hours, recording deploy-succeeded or deploy-failed with the job link. Followers live in the web process; a restart loses them, while the state is always read from the forge
GET /api/bundles/targets?repo= BundleTargetsView { series, records } (analyses:read on the repository): the newest 300 bundle records as one history per target (bundleSeries of @holtkeeper/bundles)
GET /api/bundles/report?repo=&target=&version=&analysis= BundleTargetReportView { report, analysisId, previousAnalysisId? }: the report of one point of a target (a package version or a build record analysis, the newest without either) compared with the closest earlier point that measured fine; 404 when there is none

Every change is logged: config.<type>.created|updated|removed, config.forge.webhook_created|webhook_rotated, subject <type>:<id>.

A team document may carry a title (trimmed, 1–60 characters; PUT /api/config/teams/:id, global settings:write or a maintainer of the team, audited as team.update). It is display only: grants, settings scopes, home teams, guides, schedules and triggers keep naming the key, and stored data never holds the title. Text for people and agents names a titled team through teamLabeler(config) as Title (key), so the key needed for a tool call or a setting is always there: the ops tools (jobs of a team, budget scopes, fleet_health rows), security_findings and license_overview rows, the assets policy source, knowledge scopes and the team named on shared entries, the team of packages, stack and evaluate_dependency results, write tasks’ related repositories and exported chat threads. Teams are flat: rows name every owner team of a repository, and inbox scopes (Team …) use the same labels. Each of those contexts takes an optional teamLabel (default the key). The repository overview’s knowledge labels use the plain title (teamTitle of @holtkeeper/core). Tool inputs (fleet_health’s team) take the key.

A forge can issue an SSH key on the account behind its token (POST /api/forges/:id/ssh-key { usage?, expiresInDays?, identity? }, global settings:write). The server generates an Ed25519 key, registers it as a user key (usage default auth_and_signing, expiry default 365 days), pins the forge host’s SSH keys with ssh-keyscan (trust on first use; a failure is a note and git stays on HTTPS), reads the commit identity from getCurrentUser unless identity is given, and stores the key as an ssh credential with the token credential’s scope. The forge document keeps only the credential id; the forge entry of GET /api/config/forges shows sshKey (public key, fingerprint, usage, expiry, identity, whether host keys are pinned), never the private key. Calling it again rotates the key in place (rotateSshKey: the new key is registered and stored before the old one is removed). Deleting the key or the forge removes the registration and the credential.

Jobs use the key through gitKeyFor (see @holtkeeper/jobs): clone, fetch and push over SSH, signed commits for propagate. Running git over SSH and signing needs ssh, ssh-keyscan and ssh-keygen on the host (openssh-client in the worker image).

GET /api/egress/rules serves EgressRulesResponse to an egress proxy (such as docker/egress-proxy) that sends Authorization: Bearer <server.egress.secret>; without server.egress it answers 404, with a wrong secret 401, and no session or MCP token grants it. Every panel GitLab forge gives one rule unless its document has packages: false (the “Packages for jobs” switch, on by default): GET/HEAD to its package registries (gitlabPackageRegistry) get Authorization: Bearer <token> with its credential’s current token, read with reveal on every request, so rotations reach the proxy on its next read. Forges whose credential cannot be read are left out and logged. Forges whose document also has cachePackages: true (“Cache packages”, off by default, only with packages on) add a cache entry: a private cache rule ({ kind: "packages", host, paths, private: true }) for their package files (gitlabPackageFiles), so the proxy keeps what jobs download with the token; the response has no cache key when no forge caches.

Each such forge also gives two read-only git rules (gitlabGitRead): GET/HEAD of go get discovery (?go-get=1) and info/refs?service=git-upload-pack, and POST of git-upload-pack, with Authorization: Basic base64(oauth2:<token>), so jobs fetch private Go modules (and git dependencies) of that forge. git-receive-pack and /api/ never match, so nothing is pushed or changed through the proxy. Trade-off: any job can then read every repository the forge token can read, over git, not only the package registries; give the forge a token scoped to what the fleet needs, or switch Packages for jobs off. The worker gives job commands GOPRIVATE for the same forges (egressJobEnv in go-private.ts: host/<top> for each top-level namespace the forge’s fleet includes (fleetPatterns over the config and panel forge and team documents), the whole host when a pattern starts with a wildcard or the forge has no fleet pattern), so go asks the forge directly instead of the public module proxy; the token itself never enters a job’s environment or files.

Every egress-secret credential (“Proxy secret” in the panel) adds one replacement rule per host: the credential URL’s host and its options.hosts. Its options (checked by validateEgressSecretOptions on create and update) are placeholder (16–128 of A-Za-z0-9._~-; the panel generates a UUID), optional hosts (example.com or *.example.com), paths (regular expressions), methods (default any, sent as *) and in (headers, url, body; default headers). The rule replaces the placeholder with the revealed secret; it is insecure (plain HTTP too) only when the credential URL is http:. Jobs are given the placeholder, e.g. TURBO_TOKEN=<placeholder> in the toolchain setting’s env, and never see the secret; the placeholder is useless against any other host. Prefer headers: a server that stores what it receives in a URL or body could hand the real value back to a job. The response is no-store.

GET /api/egress/cache returns EgressCacheView for the proxy in server.egress.proxy: { configured: false } without one, { configured: true, error } when it cannot be reached, refuses the secret or has caching off, otherwise what one replica reports (store, TTL per kind, size limits, counters since its start, cached URL patterns, totals and the 5000 most recently used entries). The server asks the proxy itself: GET http://egress-cache.invalid/v1/cache sent through it with Authorization: Bearer <server.egress.secret>, a reserved host the proxy answers instead of forwarding (docker/egress-proxy). POST /api/egress/cache/delete takes DeleteEgressCacheInput (paths, a kind, or {} for everything), returns { removed, bytes } (502 when the proxy fails, 404 without a proxy) and logs egress-cache.cleared.

The scoped setting repo.freeze ({ frozen (default true), reason?, until? }; everything, teams, repository patterns or paths) makes Holtkeeper a pure analytics tool for the repositories it covers. readOnlyRepos (read-only.ts) resolves it with resolveRepoFreeze of @holtkeeper/settings: the most specific entry not past its until wins, so a repository entry with frozen: false keeps that repository writable under a team freeze, an entry stops counting at until and an expired narrow entry lets a broader one apply again. Every check below goes through it, so a lifted repository is written to, reviewed and commented on as usual. The repository hub’s access (GET /api/repos/overview) carries the deciding entry’s reason and until while it freezes the repository, or with lifted: true while a lift overrides a broader freeze in force; a lift with no freeze above it adds nothing. Writing a lift needs only settings:write on its own scope, so whoever manages a team or repository can lift a broader freeze, even one set for everything, for it.

  • Every forge client of the effective config, file and panel forges alike, goes through readOnlyDefinition of @holtkeeper/forge: comments, reviews, thread replies, labels, merges, branches, commits, tags, pipeline jobs, deploy keys and project webhooks of those repositories are refused with ReadOnlyRepositoryError before they are sent. The setting is read at each write, so a change applies at once.
  • Merge request, note and pipeline events of those repositories are ignored (ignored: 'the repository is read-only'): no policies, reviews, commands or acknowledgements. Tag events still queue their analyzers.
  • Job checkouts of those repositories get no publisher, so nothing is pushed over git.
  • Writing analyzers (exclusive: they push or open merge requests, such as browserslist) are not queued automatically: automaticJobBlocker answers { blocker: 'frozen' } for repository jobs, so events and new repositories leave them out (automaticJobReady), freshness decides them skip with the reason the repository is read-only for Holtkeeper (repo.freeze) and the analyzer would change it, and the scheduler and a schedule’s Run now leave them out through automaticSkip. An analyzer whose options merged with analyzers.<kind> keep it from writing (dryRun: true or mode: 'report') is still queued, and so is one that needs forgeAccess (renovate), since its forgeAccess.readOnly makes it look up updates only. Manual runs and group-scope (per team) jobs are unaffected.

Analyses, schedules and links between repositories (dependency inventory, stack conventions, internal packages) keep working. Jobs that would change such a repository and are started by hand, such as propagate or audit fixes, fail with the read-only error.

repo-health.ts classifies a repository from stored data only: the newest main-line record head per kind (metrics, never data), recent jobs and the stored release cards. readHealthSources reads them once per request: one settings.list(), latestHeadsWithMetrics, the newest 500 jobs of the repositories whose analyses the caller may read, when given the release snapshot, and the last freshness sweep’s decisions (lastSweepVerdicts of freshness.ts, one freshness:summary read). latestHeadsWithMetrics (analyses.ts) takes the newest head per repository and kind, replaced by the newest head without a ref when it names one (mainLineRecords), so a run on a feature branch never becomes the repository’s health. Heads stored without metrics get them computed from their data with default options: one latest read per kind that misses them (a get for a replaced head), kept in process per record id, failures included, so later requests read no data for the same records; history keeps what was stored. repoHealth then calls settingCascades once per repository for the options it is judged by: the coverage target is the target option of the most specific analyzers.coverage entry (coverageTargetOf, default 60), bundle budgets the budgets option of analyzers.bundle (target name or glob → maximum gzip bytes, judged with budgetFor and budgetVerdict from @holtkeeper/bundles; without an entry the verdicts stored with the record).

Each cell is { value, sub, tone } with tone ok, warn, bad, info or none (nothing to judge). Every threshold lives in repo-health.ts, except the bundle budget rule (@holtkeeper/bundles). Sizes use the shared formatBytes of @holtkeeper/report.

Cell Needs From Rule
security audits:read audit metrics critical or high: bad; expired allowlist entries, medium, low or unrated: warn; none: ok
dependencies analyses:read renovate metrics a security update: bad; a major update or 10 or more outdated: warn; else ok. Without majors the sub says minor only, patch only or minor or patch
coverage analyses:read coverage metrics below the target: bad; down by 1 point or more since the record before: warn; else ok
bundles analyses:read bundle metrics a target over its budget: bad; a failed target, one from 90% of its budget or 10% growth: warn; else ok
jobs analyses:read jobs of the last 24 hours the latest run of an analyzer failed: bad; stopped by the AI budget: warn; running or queued: info; else ok
ci analyses:read ci-jobs metrics failing: bad; flaky or slower: warn; healthy: ok; idle: none
licenses analyses:read licenses metrics denied packages or violations: bad; unknown or unlisted licenses, a missing license file: warn; else ok
release releases:read the stored release card a failed deploy: bad; waiting for acceptance (v2.8.0 · acceptance) or a version, unreleased commits (Waiting, 14 commits unreleased) or the state could not be read: warn; ready (v5.2.0 → v5.3.0, or a deploy): info; released (v0.9.3 · 1w): ok

Without a record, a cell reads — / no record, with two exceptions taken from the jobs and the last freshness sweep. The bundles cell reads n/a / not applicable when the sweep skipped the bundle analyzer because its appliesTo said no (the sweep summary marks such skips applies: false). The dependencies cell names Renovate’s first run (sub first run, tone none): Running, Queued or Failed after the newest renovate job of the repository, else Pending while the sweep decided run or wait for it; nothing queues Renovate for a new repository, the sweep does. The Overview’s Libraries card then reads Update check pending (or queued, running, failed) and the Bundles card Not applicable.

A cell the caller may not read is left out, and health is computed over the cells that remain: failing with a bad one, warnings with a warn one, not-analysed when every cell is none, else healthy. freshness ({ current, total }: newest records, one per kind, younger than 14 days) and lastAnalysedAt need analyses:read.

GET /api/repos (routes/repos.ts) answers RepoList: every fleet repository as the poller’s stored per-forge listings name them (listedRepos: every forge’s listing read at once, plus exact fleet paths, also without a key-value store; a repository with no owner team is listed too), never only audited repositories, that the caller may read (see Permissions per endpoint), sorted by forge:path. Each RepoSummary carries health, cells, freshness, lastAnalysedAt, updates (repoUpdatesSummaries, all repositories’ keys read at once: webhook after a delivery in the last day, polling with its interval when the polling entry covering the repository is on, else off, plus the last poll and its error), latestAudit (the newest run of the same audit read health uses) and configurable. All reads are batched per request; no forge is called.

startServer(config, { roles, worker, drainTimeoutMs }) runs what roles asks for (roles.ts, default ['all']): web serves the API, UI and webhooks; worker runs the job worker; scheduler runs schedules, credential rotation, artifact and audit retention, only while this process holds the leader lease (leader.ts: kv.acquireLease on leader:scheduler, 30 s TTL, renewed every 10 s; a failed renewal stops the duties). Processes without web serve only the operational endpoints. worker: { concurrency?, claimDelayMs?, maxJobs?, pools? } overrides jobs.concurrency, delays claims, picks the worker pools it serves (see @holtkeeper/jobs, default ['default']; write tasks need a write worker) and makes the worker stop after maxJobs jobs; RunningServer.exhausted then resolves.

Every process answers GET /healthz (alive), GET /readyz (store query, Postgres migrations via ready(), artifact store ping(), not draining; 503 with a JSON body per check otherwise; info reports facts that never fail readiness) and GET /metrics (Prometheus text: queue gauges, finished jobs and a duration histogram by analyzer, webhook deliveries by forge and status, AI runs/tokens/cost, limiter saturation per key, artifact store bytes; metrics.ts). They bypass authentication. stop() drains: readiness fails, the worker stops claiming and running jobs get drainTimeoutMs (30 s) before they are requeued, then the lease is released and the store closed.

With limits: { distributed: true } the limiter keeps its counters in the store’s kv (limiter-state.ts, storeLimiterState from @holtkeeper/limits). See docs/deployment.md for Docker and Kubernetes.

One @holtkeeper/limits limiter is shared by the server (deps.limiter): GitLab requests of forges count against their credential id (kind defaults, overridden by the everything-scope entry of the setting limits.credentials); the job worker’s admission hook leaves jobs waiting while their forge key or, for analyzers that use an agent, their AI provider key (the credential id the global llm.provider names) is saturated. The agent factory gets the same limiter. Settings › Integrations reads its live usage from GET /api/limits/usage (integrations.md).

routes/messages.ts serves the translations of the fixed texts Holtkeeper posts (@holtkeeper/messages); the catalogs are reviewMessageCatalog for now. Everything lives in the store’s key-value part (kvMessageStore); without one GET /api/messages answers available: false and the other routes 503. server.ts passes the same store to the review analyzer (ReviewAnalyzerDeps.messages), so reviews translate missing texts with their own agent; the translate task kind mounts no tools (TASK_TOOLSETS) and counts under the Reviews feature of AI usage.

Route Does
GET /api/messages settings (autoTranslate, extra terms), the built-in terms, and per catalog its languages with counts per state and the last failed translation
PUT /api/messages/settings saves the settings (terms trimmed and deduplicated); audit messages.settings
GET /api/messages/:catalog/:locale every message with its English text, note, state and translation
PUT /api/messages/:catalog/:locale/:key stores a person’s translation (origin: 'manual', current for today’s English text); 400 when it changes placeholders or code spans or adds links, mentions or HTML comments (terms are not checked here); audit messages.translate
DELETE /api/messages/:catalog/:locale/:key drops one translation, so the next review translates it again; audit messages.reset
POST /api/messages/:catalog/:locale/retranslate drops every model translation of the language and keeps people’s; audit messages.retranslate

:locale must be a normalized language code other than en (400), an unknown catalog is 404.

The leader duty vulnIndexDuty (vuln-index.ts) audits npm and Go dependencies of the whole fleet without checkouts, with @holtkeeper/vuln-index. runVulnIndex runs every minute:

  • What it matches. The newest depgraph record of every repository: all of them on a full run (the first run, then hourly, FULL_INTERVAL_MS), otherwise only repositories whose newest graph changed since the last run. Their package versions go to OSV in one batch (osvClient of @holtkeeper/vuln-osv); advisory records are cached in Store.kv (vuln-index:osv:<id>) and fetched again only when their modified time changes. Packages any repository of the fleet defines are never matched.
  • What it writes. Per repository an audit record (scanner: 'osv-index', actor: 'system:vuln-index', the graph’s sha, metrics as for audit jobs) with the repository’s audit.allowlist and traits applied, when the state differs from the newest audit record (whoever wrote it) or that record is a day old. Home, the Security page, security alerts and health read these like any audit. Older audit records of the repository beyond the newest 3 (keepRecords of the audit analyzer) are deleted right after.
  • Fix runs. Where audit.fix is on, an audit job (trigger vuln-index, reason naming the advisories) is queued when the match has fixable findings (fixableKeys) the last match of the repository did not; the usual automaticJobReady checks, deduplication and daily limits apply. Nothing new to fix queues nothing.
  • Skipped. Repositories whose graph failed to load (a failed source in errors), that have no lockfile the index reads, whose audit repo.analyzers turns off or whose audit settings do not validate get no record; their older audit records stay.
  • Failures. When OSV fails the run throws, writes nothing and the duty waits ten minutes before the next try.

Its state (vuln-index:state in Store.kv: the time of the last full run and per repository the graph record it matched, the packages it defines and its fixable keys) is written only by the leader. Without Store.kv the index does nothing. The audit analyzer has no freshness of its own: ecosystems other than npm and Go are audited only by runs people start or schedule.

The leader duty licenseIndexDuty (license-index.ts) judges the licenses of npm and Go dependencies of the whole fleet without checkouts. runLicenseIndex runs every minute:

  • What it judges. The newest depgraph record of every repository (inventoryOf of @holtkeeper/vuln-index): all of them on a full run (the first run, then hourly, so policy and exception changes arrive within the hour), otherwise only repositories whose newest graph changed. The licenses of every distinct package version are looked up once for the whole fleet (lookupLicenses of @holtkeeper/licenses, deps.dev) and kept in Store.kv (license-index:licenses) for 30 days, a day when deps.dev knows none. Packages a repository of the fleet defines (loadPackageCatalog) are internal and never looked up; the repository’s own graph marks dev-only packages.
  • What it writes. Per repository a licenses record (tool: deps.dev, actor: 'system:license-index', the graph’s sha, metrics as for licenses jobs) with the repository’s analyzers.licenses settings applied, when the judgement differs from the newest licenses record (sameLicensesState, whoever wrote it) or that record is a day old. The project’s license files come from the forge’s listFiles at the root of the default branch, read again when the graph changes. Older licenses records beyond the newest 2 (keepRecords of the licenses analyzer) are deleted right after.
  • Skipped. Repositories whose graph failed to load, that have no lockfile the index reads, whose licenses repo.analyzers turns off or whose licenses settings do not validate get no record; their older records stay.
  • Failures. When deps.dev fails the run throws, writes nothing and the duty waits ten minutes before the next try.

Its state (license-index:state in Store.kv: the time of the last full run and per repository the graph record it judged and its license files) is written only by the leader. Without Store.kv the index does nothing. The licenses analyzer has no freshness of its own: other ecosystems are judged only by runs people start or schedule.

An audit report made elsewhere (CI, a CLI) is uploaded as an audit record through POST /api/analyses (kind: 'audit', the report as data; analyses:run on the repository) and becomes the repository’s current state like any audit job’s record. Machine credentials (API tokens) for CI are not implemented yet; until then CI uploads work with noAuth or headerAuth behind a proxy that authenticates CI.

Generated files live in an ArtifactStore (@holtkeeper/artifacts), ServerDeps.artifacts, built by artifactStoreFor(config.server). Without one the artifact and media routes answer 503.

Endpoint Does
GET /api/artifacts/:id Download. Stores with presign (S3) redirect (302) to a URL valid for 5 minutes; others stream with the stored content type, Content-Disposition: attachment with the artifact’s name, nosniff and a sandbox CSP.
POST /api/artifacts/zip ArtifactZipInput { files: { id, path }[], name? } → application/zip; paths must be relative without ..; at most 500 files and 512 MB.

Analysis summaries (GET /api/analyses, GET /api/analyses/:id) carry sha, the commit the analysis ran on, when the record has one; POST /api/analyses accepts an optional sha (hex) to record it. GET /api/analyses/:id adds job (AnalysisJobSummary: id, status, trigger, analyzer, created and finished times, the latest error), the job that produced the record (store.jobs.list({ analysisId, limit: 1 })), when the caller may analyses:read that job’s target; uploads and pruned jobs have none. POST /api/analyses accepts artifacts: { id, base64, contentType?, name? }[] next to data; every id must equal the SHA-256 of its decoded content (400 otherwise). They are stored with tags { repo, kind, analysis }. Accepting changes (POST /api/analyses/:id/changes) resolves artifact references of write-binary edits from the store; in patch mode binary files are listed in a trailing comment of the patch instead of diffed.

Responsive image variants and SVG optimization for files in repositories, behind a small MediaEngine interface (src/media/engine.ts). src/media/adapter.ts maps it to @holtkeeper/media (sharp, svgo), imported on first use; it probes the image (rejecting more than maxPixels from the header), plans and encodes variants (formats, widths, quality; densities give a texture-style @Nx ladder; preset fast/default/max sets encoder effort), optimizes SVGs with svgo’s safe preset and renders snippets for every framework. Tests pass a fake engine as ServerDeps.media.

Merge request reviews use createMediaReviewer({ publicUrl, cache, policyFor }) (src/media/reviewer.ts) as the review analyzer’s mediaReviewer; policyFor reads the repository’s assets.policy (see Assets). Files the policy ignores are skipped. Per changed raster image: a savings table (original against WebP/re-encoded, plus AVIF when formats.raster asks for it; typical transfer at 375/768/1440 CSS px at DPR 2) with a note when the merge request brings none of the siblings the policy asks for (hero.webp, hero-640w.webp) or the image is wider than 1280 px without sized variants (-640w, -720, @2x siblings), a line naming where the file breaks the policy (policyNotes: disallowed format, size above warn/error, larger than maxDimension), and a <picture> suggestion on added <img> usage lines when a format’s saving clears minSaving (both its percent and its bytes, as in the analyzer). Added SVGs get a whole-file svgo suggestion when its saving clears minSaving and is at least 64 bytes (otherwise a summary line) and inline <svg>/<path> fragments whose lines the diff adds entirely get suggestions (svgo for static HTML/Vue/Svelte SVGs, path data only for JSX and SVGs with bindings), unless formats.svg is keep. A suggestion covers only the lines that change (changedLines drops unchanged leading and trailing lines), so a path-data rewrite sits on the d line and does not clash with other suggestions on the same markup. Each image links to the assets area of the repository hub’s Quality tab with the media dialog open on the merge request’s head (panelLink: webPaths.repo(repo, { tab: 'quality', section: 'assets', file, ref }) from @holtkeeper/web-paths on publicUrl, /repos/<forge>/<path>?tab=quality&section=assets&file=…&ref=…), labelled as a merge request offer under mode: 'suggest-mr'.

Variant cache. The reviewer, the media panel and background jobs (context.cache) share artifactCache(artifacts): every encoded variant is stored as an artifact (tag kind: cache) under the ref cache/media/v1/<source sha256>/<spec and encoder hash>, so a re-push, a later review or the next scheduled assets analysis of an unchanged image reuses it instead of encoding again. With server.artifacts.kind: 's3' the cache lives in the bucket and is shared by every server and worker pod; storage sweeps remove it like other artifacts and a swept entry is simply encoded again.

Artifacts returned by analyzer runs in background jobs (e.g. the encoded variants of assets) are stored in the artifact store tagged { repo, kind, analysis } (persistArtifactsTo); external uploads send them in artifacts of POST /api/analyses.

POST /api/media/variants — MediaVariantsInput { repo: 'forge:path', file, ref?, formats?, widths?, densities?, quality?, preset? }. Reads the original with forge.readFileBytes (SVG through readFile), runs the engine and stores each variant (or the optimized SVG) as an artifact tagged { repo, kind: 'media', source }. Returns MediaVariantsResult { original, variants: { id, format, width, height, quality, bytes, savingsPercent, path }[], svg?, snippets, savings, exists }; path is the engine’s suggestion or <dir>/<name>-<width>w.<format>, savings the smallest variant per format against the original, and exists says for every variant path whether a file is already there at ref (the default branch without one). exists is read from the forge on every request, cached results included: one listFiles per folder (up to 10,000 entries), a file read per path when the forge cannot list or the folder is larger.

  • Limits (MediaLimits): originals up to 25 MB and 50 megapixels (the engine rejects bigger images before decoding them fully; 413), two images processed at once, eight more waiting, then 429. Engine failures are 422.
  • Results are cached in memory by (SHA-256 of the original, options), 100 entries, and recomputed when one of their artifacts is gone.

POST /api/media/apply — MediaApplyInput { repo, file, ref?, variants: id[], paths?: { [id]: path }, replaceOriginal?: id, snippet?: { file, range, oldText, newText }, mode, title? }.

  • merge-request: one CodeChange with a write-binary edit per variant (new files; a conflict when the path exists), one replacing file when replaceOriginal is given (guarded by the current file’s SHA-256), and the snippet as a replace edit; opened with openMergeRequest against ref or the default branch. Returns MediaApplyResult { applied, conflicts, mergeRequest? } and logs media.merge_request_opened.
  • zip: an application/zip download with the files at their paths and a README.md holding the snippet.

assets.ts resolves the assets.policy setting (@holtkeeper/assets, registered as assetsPolicySetting, section Repositories, edited on the repository’s Assets tab) per repository: assetsPolicyFor returns the most specific entry, else defaultAssetsPolicy. Assets jobs get it as their policy option (scopedAnalyzerOptions); the analyzers.assets setting cannot set policy (SETTING_OPTIONS drops it from that setting’s schema and form, and scopedAnalyzerOptions ignores it in stored entries). Its old ignore and optimizeIgnore options moved to the policy’s ignore; entries still carrying them are flagged (see Stale option keys). The review’s media reviewer and the assets tools read the same policy.

GET /api/assets/repo?repo=forge:path (analyses:read on the repository) — RepoAssetsView: the effective policy with policyFrom (id and scope of the winning entry; absent for the default), trend (total bytes and violations of the 12 newest records, oldest first) and, once the analyzer has run, the newest record’s analysisId, createdAt, ref, sha, checkedPolicy (false for records made before the policy) and summary (assetsSummary). It reads stored records only; nothing runs on a page view. The fleet table over every repository, GET /api/assets, is described under Quality fleet tables.

coverage.ts turns stored coverage records into the data of Quality › Coverage; nothing runs on a page view. GET /api/coverage lists a CoverageRepoCard for every repository with a record the caller may read (analyses:read), from stored metrics only (coverageCards): the newest main-line head of each repository (latestHeadsWithMetrics) and the heads of its 12 newest main-line records; record data is read only for a newest record whose metrics predate totals (withCurrentMetrics). A card holds its owner teams, the newest record’s analysisId, createdAt, ref, sha, tools and totals (coverageTotals: lines, branches, functions, files, files and lines without tests), change (points of line coverage since the record before), trend (line and branch shares of those records, oldest first) and head, the default-branch head freshness last saw (readHead), set only when it differs from the record’s sha. Answers are kept in a fleet cache keyed on the newest analysis ids, the visible repositories and the freshness heads (see Supply fleet tables).

GET /api/coverage/repo?repo=forge:path (analyses:read on the repository) — RepoCoverageView: the same card (absent until the analyzer ran) plus changed (changedFilesCoverage: line coverage of the files that are new or whose counts moved since the record before), groups (coverageGroups: per workspace package or top-level folder), worst (worstFiles: the 10 files with the most uncovered lines) and changes (coverageChanges: up to 20 files whose line coverage moved by 5 points or more since the record before), plus job, the summary of the job that produced the card’s record (jobSummary, the same fields GET /api/analyses/:id gives), when the caller may read it.

repo-page.ts builds the repository page’s data from stored records; nothing asks the forge or a model on a page view. It needs analyses:read on the repository.

GET /api/repos/overview?repo=forge:path — RepoOverview, what the repository hub’s header and Overview show: the owner teams, health and cells (the same as GET /api/repos, cells the caller may not read left out), cards (the Supply chain then Quality cards, each with tone, status in words, headline value and unit, up to two lines, optional segments and the record it describes; a card behind a permission the caller lacks is absent; the Security card reads <n> urgent with the urgent packages of the newest audit’s active findings as its first line when any are judged urgent, see findingUrgencies), head (the default-branch head freshness last saw, from readHead), defaultBranch, analyses (the newest record of every kind as AnalysisSummary, reviews left out and the audit record without audits:read, for the freshness table), audit (only with audits:read), dependencies (direct dependencies of the newest depgraph record), stack, toolchain (runtimes and package managers of the newest stack record), reviews30d (Holtkeeper’s reviews of the last 30 days summed), work (jobs and failures since Monday 00:00 UTC, write tasks awaiting approval only with repos:read, AI spend only with ai:read or ai:admin), knowledge (panel rules, active and pending learnings whose scope covers the repository; only with knowledge:read), release (stage, versions and the newest deploy; only with releases:read while releases are on) and access (read-only with reason and end, whether write tasks may open merge requests). It never carries the head commit’s title.

GET /api/storage returns StorageOverview { providers: { id, label, bytes, count?, details, available, note?, clearable, error?, reportedBy? }[], totalBytes } from ServerDeps.storage (StorageProviders). startServer registers the artifact store (artifactStorage) and the database (databaseStorage(server.databasePath, store.database): the Postgres database by domain, or the SQLite file plus -wal/-shm), plus ServerOptions.storage. POST /api/storage/:id/clear { scope? } calls the provider’s clear (409 when it has none, 400 for a bad scope) and logs storage.cleared.

Worker disks. Git mirrors (mirrorStorage(jobs.cacheDir)) and the mise tool cache (miseCacheStorage) live where jobs run, so only processes with the worker duty register them, and they publish what they measure (startStorageReports, storage-reports.ts): every 5 minutes into the store’s kv (storage:reports, one entry per worker named after its host, the pod name in Kubernetes; atomic with compareAndSet), removed when the worker stops and dropped after 15 minutes without an update (a killed pod). The overview shows reported areas instead of a local measurement of the same id: bytes and counts add up, details lists the workers and reportedBy how many reported. A worker writes a random id into .holtkeeper-volume in each area’s directory, so workers sharing one volume (a ReadWriteMany mirror cache) are one shared: a, b line, counted once. Clearing a reported area appends a request to storage:clears and returns { requested } (workers asked); every worker started before the request carries it out within 15 seconds (on a shared volume only the first worker by name) and reports again.

GET /api/database returns DatabaseView from store.database (the store’s DatabaseInspector): { available: false, reason } for the memory store or when inspection fails (missing rights, unreachable database), otherwise { overview, tables, indexes, domains, history, advice, migrations, resettable }. tables carry their domain (tableDomain); indexes are marked unused (never scanned, not unique or primary, not a GIN or GiST search index, which only searches scan) and duplicateOf (same table and definition apart from the name; the smaller one counts as the original). domains sum tables per domain with weekAgoBytes from the newest snapshot at least seven days old. advice (databaseAdvice, warnings first) flags duplicate indexes, unused indexes of 1 MB or more, tables with 20% or more dead rows (at least 1000) not vacuumed for a day (autovacuum starts at 20% by default, so busy tables pass that share between runs), Postgres tables of 10 000 rows or more not analyzed in 30 days, large tables read mostly by sequential scans, 80% of max_connections in use, sessions idle in a transaction, a cache hit ratio under 95%, replicas not streaming or 16 MB / 30 s behind, SQLite files a quarter free, and missing statement statistics.

GET /api/database/queries?sort=total|mean|calls&limit= (at most 200) returns DatabaseQueries; POST /api/database/queries/reset clears them (409 without statement statistics, 400 when the database refuses) and logs database.queries-reset; GET /api/database/sessions returns { sessions }. Both 404 for the memory store.

History. The leader records a snapshot (startDatabaseSnapshots) at start and every 6 hours into the kv key database:history: one point per UTC day (day, bytes, bytes per domain), the latest measurement of the day winning, 90 days kept.

databaseStorage(path, inspector) in Settings › System → Storage reports a Postgres database by its size, split by domain.

Every mutating request (POST, PUT, PATCH, DELETE) under /api (but Slack event deliveries, POST /api/slack/events, which arrive for every message in the app’s channels) and /auth/<provider>/admin is appended to store.audit once its response is ready, whatever the outcome: actor (or anonymous), via (webhook for /api/webhooks/*; ui when the browser sent Sec-Fetch-Site, else api), the route template and params, status, duration, client IP (X-Forwarded-For, X-Real-IP, else the socket) and user agent. 401 and 403 are denied, other 4xx/5xx error. The action and target are derived from the route (PATCH /api/credentials/:id → credential.update on credential:<id>, POST /api/credentials/:id/rotate → credential.rotate). target.repo is set only by the route itself or from a permission check of the request that allowed a repository (authorize with a repository target remembers it; with several, the one ?repo= names); a denied event never names a repository, so nobody can plant events in the audit log of a repository they cannot act on. Reads are not audited, except audit.export.

Routes enrich their event with c.set('audit', { action?, target?, changes?, details? }). Credentials, settings, rules and learnings record field-level changes (diffChanges(before, after): dotted paths, arrays compared whole); fields named like secrets (secret, password, token, apiKey, authorization, …) and the values of secret settings are «redacted», and a new credential secret is recorded only as changed. User changes made through the users provider (PATCH /auth/users/admin/users/:id) get changes from the stored user before and after.

Background code appends with appendAudit(store, event) from src/audit.ts:

appendAudit(store: Pick<Store, 'audit'>, event: Omit<AuditEventInput, 'at'> & { at?: Timestamp }): Promise<AuditEvent | undefined>
await appendAudit(deps.store, {
actor: { id: 'gitlab:work:42', name: 'jane', provider: 'gitlab:work' },
via: 'webhook', // or 'job' / 'system'
action: 'mr.policy.label',
target: { type: 'merge-request', id: '17', repo: 'work:games/app' },
outcome: 'ok',
details: { label: 'needs-review' },
})

It never throws (failures are logged), so auditing never breaks the job or request it describes. The store’s audit log is mandatory; it is the only record of who did what (there is no separate activity log).

Besides the request middleware, these write events on their own: seeding defaults (setting.seed, config.seed, via: 'system'), scheduled credential rotations (credential.rotate), AI budgets the first time they are exceeded in a week (ai.budget_exceeded), learnings agents and the rule miner add (learning.create, learning.reinforce), release events (release.<kind>, via: 'job' or webhook), merge request policy outcomes and commands from merge request notes (mr_policy.*, job.command, chat.command, via: 'webhook'), repositories found by polling (repo.discover), the results of background runs started by hand (schedule.run_result, trigger.run_result, analysis.backfill_result), sign-ins and own passkey changes through the users provider, and users CLI commands. Job outcomes are not audited; they stay on the job records.

Inbox decisions log learning.approve and learning.reject, release.dismiss (target the repository, details sha) and allowlist.renew (target the setting entry, changes of expires and reason, details key, advisory, package). POST /api/settings/draft writes one setting.draft event for all its changes (details keys, saved, removed; change fields are prefixed <key>#<id>.). Snoozes are personal marks, not decisions, and are not audited.

Endpoint Result
GET /api/history HistoryList { events, nextCursor?, people }, newest first; cursor, limit (≤ 500) and the filters below
GET /api/history/scope HistoryScope { repos: { repo, teams }[], instance }: repositories with events the caller may see
GET /api/audit/export?format=csv|ndjson streamed download, oldest first (default ndjson); itself audited as audit.export
GET /api/audit/verify?fromSeq=&toSeq= AuditVerification of the hash chain (see the store docs)
GET /api/history/summary HistorySummary: counts by day, action, actor and repository over the same filters and visibility (AuditStore.summary)
GET /api/audit/verify/last AuditVerifyLast: the latest daily chain check (audit-verify.ts); global audit:read only

Filters: actor, action (prefix), targetType, targetId, repo (forge:path), repos (comma list of forge:path), outcome, via, from, to. The audit log is permission filtered: with global audit:read every event is listed; otherwise the caller needs repos:read somewhere and sees only events whose target.repo it can repos:read (repos narrows within those), never instance-level events such as settings, users or credentials. The summary follows the same rule: without a global audit:read it counts only readable repositories. The leader checks the chain at most once a day and records audit.verify as System; see audit-log.md. people holds the name and avatar of every user among the page’s actors. Retention: startServer(config, { auditRetentionDays }) sweeps daily, default 365 days, 0 keeps everything.

GET /api/avatars/<seed>.svg?size= (16–512, default 128) renders the DiceBear Voxel Bot style locally with @dicebear/core from the definition in @dicebear/styles — no request leaves the server. The style is by DiceBear and licensed CC0 1.0. Responses are Cache-Control: public, max-age=31536000, immutable with a content ETag (If-None-Match → 304) and a CSP that forbids scripts; recent renders are cached in memory.

The seed is the principal id (users: the user id). GET /api/me and UserView carry avatarUrl (/api/avatars/<id>.svg). users accounts may reroll with PUT /api/me/avatar { seed } (null goes back to the id); other providers answer 409.

routes/preferences.ts keeps each principal’s own UI preferences in Store.kv under prefs:<principal id>. GET /api/me/preferences answers UserPreferences { homeTeams, homeTeamsFromMembership }: homeTeams are the team keys the My teams scope shows, by default (defaultHomeTeams, homeTeamsFromMembership: true) the teams the principal is a member of followed by the configured teams its grants name, until it picks its own. PUT /api/me/preferences { homeTeams } (teamKeySchema keys) stores them deduplicated (at most 100; null goes back to the default) and is audited as user.preferences; without Store.kv it answers 503 and GET the defaults. Preferences stored before teams (homeGroups) are ignored. homeTeamsOf(deps, principal) gives the stored or default home teams to the inbox and MCP people. Home teams are a UI default, never a permission.

The caller’s own links, served by @holtkeeper/identities:

Endpoint Result
GET /api/accounts ExternalAccountList (challenge hashes never leave the server)
POST /api/accounts 201 ExternalAccountView, unverified; body { provider, externalId, username? }
DELETE /api/accounts/:id 204
POST /api/accounts/:id/challenge 201 AccountChallenge { code, expiresAt, command }, shown once

Admins link verified accounts under /auth/users/admin/users/:id/accounts (see @holtkeeper/auth-users). Webhooks and bots use identitiesFor(deps) from src/routes/accounts.ts for completeChallenge, resolveExternalActor and authorizeExternal. 503 when the store keeps no external accounts.