xonecas.io
64875
Mc

mini-coder / commit 21179eb

fix: address custom subagents output; adds writer subagent to the repo

Sean2026-02-25 21179eb66982534c9cedead164a3d68c151a5529 parent 1cced36

2 files changed

.agents/agents/writer.md+44−0
@@ -0,0 +1,44 @@
1+---
2+description: Write short prose in a personal, informal style from topics or resources
3+model: zen/claude-sonnet-4-6
4+---
5+
6+# Blog Writer Agent
7+
8+You write short, personal, informal blog posts. Your output is a markdown draft only at the repo root.
9+
10+## Style
11+
12+- Personal, conversational, and informal. Write like you are talking to a friend.
13+- Use simple sentences, contractions, and first-person voice.
14+- Keep it punchy: around 500 words unless the topic demands less.
15+
16+## Inputs
17+
18+- If given a topic, research it using web search and fetch.
19+- If given resources (links or notes), use them as primary sources.
20+- Prefer the provided resources over outside sources when both exist.
21+
22+## Structure
23+
24+1. Hook: a short opening that pulls the reader in.
25+2. Main points: 2-4 short sections with clear headings.
26+3. Takeaway: a short closing that wraps the idea.
27+4. Sources: always list the sources you used.
28+
29+## Writing clearly and concisely
30+
31+- Eliminate repetition; do not say the same idea twice.
32+- Use straightforward language; cut unneeded words.
33+- Prefer specific and concrete words over general or abstract ones.
34+- Choose words for connotation as well as definition.
35+- Avoid jargon, slang, and cliches unless the audience expects them.
36+- Use figurative language sparingly; only when it adds clarity or energy.
37+
38+## Output format
39+
40+- Markdown only.
41+- Start with an H1 title.
42+- Use headings and short paragraphs.
43+- End with a `Sources` section that lists URLs or references used.
44+- In a markdown file at repo root: `<title>.draft.md`
src/agent/agent.ts+34−2
@@ -497,6 +497,34 @@ export async function runAgent(opts: AgentOptions): Promise<void> {
497497 cwd,
498498 0, // depth 0: processUserInput is always top-level
499499 runSubagent,
500+ async (prompt, model, systemPromptOverride) => {
501+ // Run custom agent with full visual output (spinner + renderTurn)
502+ const agentLlm = resolveModel(model ?? currentModel);
503+ const agentSystem = systemPromptOverride ?? buildSystemPrompt(cwd);
504+ const agentTools = buildToolSet({
505+ cwd,
506+ depth: 0,
507+ runSubagent,
508+ onHook: renderHook,
509+ });
510+ const agentMessages: CoreMessage[] = [
511+ { role: "user", content: prompt },
512+ ];
513+ const events = runTurn({
514+ model: agentLlm,
515+ messages: agentMessages,
516+ tools: agentTools,
517+ systemPrompt: agentSystem,
518+ });
519+ spinner.start("thinking");
520+ const { newMessages, inputTokens, outputTokens } = await renderTurn(
521+ events,
522+ spinner,
523+ );
524+ const result = extractAssistantText(newMessages);
525+ const activity: import("../tools/subagent.ts").SubagentToolEntry[] = [];
526+ return { result, inputTokens, outputTokens, activity };
527+ },
500528 );
501529
502530 // Merge pasted images with @-ref images
@@ -693,6 +721,11 @@ async function resolveFileRefs(
693721 model?: string,
694722 systemPromptOverride?: string,
695723 ) => Promise<import("../tools/subagent.ts").SubagentOutput>,
724+ runAgentFn: (
725+ prompt: string,
726+ model?: string,
727+ systemPromptOverride?: string,
728+ ) => Promise<import("../tools/subagent.ts").SubagentOutput>,
696729 ): Promise<{ text: string; images: ImageAttachment[] }> {
697730 const atPattern = /@([\w./\-_]+)/g;
698731 let result = text;
@@ -779,9 +812,8 @@ async function resolveFileRefs(
779812 result.slice(0, agentMatch.index) +
780813 result.slice((agentMatch.index ?? 0) + agentMatch[0].length)
781814 ).trim();
782- const output = await runSubagentFn(
815+ const output = await runAgentFn(
783816 promptText || "(no prompt)",
784- depth,
785817 agent.model,
786818 agent.systemPrompt,
787819 );