Recipes

Agent-credit UI refactor, demo-data fixes, and document type scale for Mikka

Discovered from README cross-links · yesterday

Software & DevOpsWork & Operations

PR fixing demo-data bugs, crediting threads to Agents, and unifying doc type

What they did

The author worked through three bundled changes in the Mikka repo, driven by screenshots of the #715 demo seed and a design review at 1440px light. Part A fixed six real product issues surfaced while screenshotting the demo seed: a bot list preview that leaked OpenUI source (new `chatPreview` in `lib/agent-history.ts`), an English "Unassigned" fallback on tasks without an id, group chats showing a generic "Bot" name and avatar instead of each bot's own, group chats reachable only from ⌘K, the 产物 label renamed to Artifact per the glossary, and a confusing "0 threads" next to non-zero run time (relabelled 新线程, with a DB test pinning the carry-over case). Part B followed a product rule from Alex that Bots dispatch but Agents do the coding work. Every UI, copy, rule and prompt place where a thread's or run's executor showed as a Bot was changed: 全部线程 rows, run citations, the thread composer label, artifact authors, activity rows, desktop notifications, the active-sessions feed and the phone thread list. Field names (`agentName`, `by`) were deliberately kept to hold the dispatching Bot so clients don't break mid-rollout, with the executor in a new `harness` field. `rules.md` gained R-78 and updates to R-50, R-54 and R-62; the glossary gained an Agent entry; a new decision file was written; coordinator instructions and `list_agents` descriptions were reworded. Several things were deliberately left alone with written reasons (the 电脑 card, the E2B key copy, `IssueThreads.agent: "Bot"`). Part C applied a four-step document type scale (title 24/32, section 18/28, body 15/24, meta 12/16) via a new `text-md` token pinned in `ui-policy.json`, to the task title, task description, Artifact reader and comments. A design review of rendered pages caught one blocker: a `md:text-sm` on the Textarea shrank the task title to 14px on wide screens, fixed to `md:text-2xl`. Verification was broad: typecheck, lint, i18n checks, UI-policy tests, mobile tests, active-agents, artifacts, agent-kit, coordinator prompt tests, several DB tests including a new `run-agent-names.db.test.ts`, and a long list of Playwright specs against a local build on an isolated Postgres seeded with `scripts/demo-data/seed.mjs`.

How it went

The PR landed as a coherent three-part change with docs, rules, glossary and decision files updated in the same pass. Local checks passed across typecheck, lint, i18n, UI policy, mobile, agent-kit, coordinator prompts and DB tests, plus a wide set of Playwright specs. A rendered-page design review caught and fixed a real responsive type bug. Two Playwright specs were CI-only or self-skipping locally, and one copy check was already red on main and left untouched.

Worth knowing

The execution path (queue-run, claim, bot-runtime, rule-dispatch) was explicitly out of scope and untouched, so the Bot-to-Agent change is presentation and copy only for now. Field names still hold the dispatching Bot, which is intentional but easy to misread. Continuing a finished thread from the Artifact reader was not built because the repo has no path to continue an ended run. Phone screenshots were not taken (no iOS or Expo preview in the environment). Two known follow-ups predate the PR: grey bot names in group chats and an activity-row avatar that derives colour from the name.

Wiring

Work started from the demo seed (`scripts/demo-data/seed.mjs`) against an isolated Postgres (`mikka_e2e`) and a local `next build`. The Agent-credit change threads through `lib/agent-history.ts` (new `chatPreview`), `listThreads` (now carries `harness`), `runSubmitter`/`runAgentName`, `readArtifact`/`listArtifacts`, `activity-actor-server.ts`, `listTaskRuns.agentName` and `/api/agent/sessions/active`. Rules and prompts live in `rules.md`, `glossary.md`, `decisions/`, `lib/coordinator/instructions.ts`, `workflows/coordinator/tools.ts` and `app/api/mcp/route.ts`. The type scale adds `text-md` in `app/globals.css`, pinned in `ui-policy.json` and enforced by `scripts/ui-policy.mjs` with a policy test. Verification ran `pnpm typecheck`, `pnpm lint`, `pnpm i18n:check`, `test:i18n`, `test:ui-policy`, `test:mobile`, `test:active-agents`, `test:artifacts`, `test:agent-kit`, `check:agent-ui`, `test:db-runner`, coordinator prompt tests, DB tests (`tests/usage.db.test.ts`, new `tests/run-agent-names.db.test.ts`, `tests/secret-masking.db.test.ts`), and Playwright specs including a new `bot-list-groups.spec.ts` and an updated `thread-projection.spec.ts`.

Try it yourself

Read `rules.md`, `glossary.md` and the latest files in `decisions/` in this repo. Then audit every place in the UI, copy, prompts and API responses where a thread's or run's executor is shown as a Bot rather than its Agent (Claude Code or Codex). For each hit, list the file, the line, and whether it should change or stay (a Bot legitimately dispatches; an Agent runs). Keep existing field names like `agentName` and `by` pointing at the dispatching Bot and add a separate `harness` field for the executor so clients don't break. Also check the document type scale: title 24/32, section 18/28, body 15/24, meta 12/16, and flag any component that overrides it at a breakpoint. Report findings before editing.

Source

Tools in this stack