agenthub/src/core/templates.ts
chahinebrini caa009b66a feat(board): lean board + /activity page (TSK-0032 rework, realtime folded in)
codex reworked the board per the user's "keep it simple": /board now shows only
the compact KPI cards + the kanban (half-donut removed), with realtime SSE folded
in (TSK-0030). Recent Activity + Done Archive moved to a new /activity page; nav is
Board · Team · Activity · Decisions. team.ts / ui-shared.ts touched for nav + a
tier data-role hook. Tests green (133). The /team + /activity 500s seen on review
were a local better-sqlite3 ABI mismatch (native module rebuilt for Node 24), not a
code bug — all pages 200 after rebuild.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 05:43:25 +02:00

79 lines
3.8 KiB
TypeScript

export function agentsMd(projectName: string): string {
return `# AgentHub — ${projectName}
This project coordinates multiple AI agents via AgentHub. The hub server runs on
the team's hub machine; you connect **automatically** (the project config's
\`serverUrl\`, or LAN auto-discovery) — no manual setup, no \`--server\` flag.
## Start here
**If you are an implementer, RUN this on your first turn (don't just read it):**
\`agenthub start --agent <you> --role implementer\` — it announces you, claims the
task addressed to you, and prints it + its handoff so you can begin immediately.
## Golden rules (every agent)
1. Announce yourself on start (\`agenthub start …\`, or \`agenthub hello --agent <you> --role <your-role>\`).
2. Read \`.agenthub/status/latest.md\` and the handoff(s) for your task first.
3. **Only the architect marks a task \`done\`.** Implementers submit finished work
with \`agenthub task review <id>\` — never \`agenthub task done\`.
4. Report results as memory: \`agenthub memory add --title "<TSK> result" --content "…"\`.
5. Never delete or overwrite files in \`.agenthub/\` unless explicitly asked.
Drive the AgentHub CLI yourself — the human does not type these commands for you.
`;
}
export function claudeMd(): string {
return `# Claude Code — AgentHub role: architect
Read \`AGENTS.md\` first. You are the **architect**: you delegate work and you hold
final say. Implementers cannot close their own tasks.
On start: \`agenthub hello --agent <you> --role architect\`, then \`agenthub watch\`.
- **Delegate:** \`agenthub task create --role implementer …\` + \`agenthub handoff create
--toRole implementer …\` with scope + acceptance criteria.
- **Review gate — only you close tasks.** When the stream shows
\`AgentHub: Task review … by <agent>\`, inspect the work + its memory, then:
- Satisfied → \`agenthub task done <id>\`.
- Not satisfied → \`agenthub task reopen <id>\` + a feedback handoff (what to fix).
- Record architecture choices: \`agenthub decision create\`.
`;
}
function implementerMd(cliName: string, agentName: string, roles: string): string {
return `# ${cliName} — AgentHub roles: ${roles}
**On your first turn, get to work — do not just summarize.**
**Preferred — the AgentHub MCP tools** (if the \`agenthub\` MCP server is registered):
call **agenthub_work** with \`{ agent: "${agentName}", role: "implementer" }\`. It waits
until a task addressed to you is ready (newly delegated OR reopened after review),
claims it, and returns the task + its handoff. Then:
1. Implement the task.
2. **Submit for review (NOT done):** call **agenthub_task_review** \`{ id }\`, and record
what you did with **agenthub_memory_add** \`{ title: "<id> result", content: "…" }\`.
3. Call **agenthub_work** again. Loop: work → implement → review → work.
**CLI equivalent** (if MCP isn't set up): start with \`agenthub start --agent ${agentName} --role implementer\`,
then continue with \`agenthub work --agent ${agentName} --role implementer\`,
then \`agenthub task review <id>\` + \`agenthub memory add …\`, then \`agenthub work\` again
(run it in the background so the wait doesn't tie up your turn).
**Messages:** \`agenthub_work\` surfaces messages addressed to you (or check \`agenthub_inbox\`).
When you act on a message-request, send a short ack with \`agenthub_message\` ("on it ...") and
a result message when done — so the sender sees progress + outcome, not silence.
⚠️ NEVER close a task yourself (no \`agenthub_task_done\` / \`agenthub task done\`) — only the
architect approves and closes. You drive the tools yourself; the human doesn't type them for you.
`;
}
export function codexMd(): string {
return implementerMd('Codex CLI', 'codex', 'implementer, tester');
}
export function kimiMd(): string {
return implementerMd('Kimi Code CLI', 'kimi', 'implementer');
}