Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: agent finishes tasks itself

ogsamratc0757fc71422
diff --git a/apps/server/src/engine-restraint-notes.e2e.test.ts b/apps/server/src/engine-restraint-notes.e2e.test.ts
index 87d05d8e..80849855 100644
--- a/apps/server/src/engine-restraint-notes.e2e.test.ts
+++ b/apps/server/src/engine-restraint-notes.e2e.test.ts
@@ -153,7 +153,8 @@ describeMaybe("delegation rules on the bundled engine (mock provider)", () => {
const main = await waitFor(() => seen.find((body) => !isChild(body)), "the main session's request");
const mainSystem = systemOf(main);
- expect(mainSystem).toContain("Split real work: for a task of more than a few tool calls, start one sub-agent per independent part in one message");
+ expect(mainSystem).not.toContain("Split real work");
+ expect(mainSystem).toContain("Do the work yourself by default");
expect(mainSystem).toContain("make exactly that many task-tool calls, no more and no fewer, and start them all in one message");
expect(mainSystem).toContain("Tell a sub-agent to start its own sub-agents only when the user explicitly asked for nested sub-agents.");
expect(mainSystem).not.toContain(SUB_NOTE_MARK);
diff --git a/apps/server/src/omnirush-agent-prompt.ts b/apps/server/src/omnirush-agent-prompt.ts
index 2475a6fb..5e48023a 100644
--- a/apps/server/src/omnirush-agent-prompt.ts
+++ b/apps/server/src/omnirush-agent-prompt.ts
@@ -34,19 +34,36 @@ Two kinds:
Hard rule: never copy private memory into repo files. Store only redacted summaries, schemas, and stable pointers.
+## Autonomy and persistence
+
+- Treat a request to change, fix, build or check something as an instruction to do it now. Carry the task through in this turn: investigate, make the change, verify it, then report. Do not stop at a plan, an analysis or a partial fix, and do not ask "should I continue?".
+- Do reversible local work (reading, editing files in the workspace, running builds and tests) without asking for confirmation. Ask only when a missing choice would change the result or before an action that is destructive or leaves this machine.
+- When something is ambiguous, pick the most reasonable reading that fits the code and the request, state the assumption in your final answer, and keep going.
+- If an approach fails, find out why before trying again: read the error, re-read the code, and change the approach.
+
## Working style
- If required setup or credentials are missing, ask one targeted question and continue once provided.
-- If you change code, run the smallest meaningful test.
-- Do not guess file paths, commands, package names or APIs. Check first: list or read files, run \`--help\`, read the installed sources, or search the web for unfamiliar libraries when web search is available.
- If a tool call fails, do not repeat it unchanged.
+- Investigate first. Read the code involved before changing it, find its callers and tests (search the whole project, not just the file you started in), and reproduce a reported failure when it can be reproduced cheaply.
+- Do not guess file paths, commands, package names or APIs. Check first: list or read files, run \`--help\`, read the installed sources, or search the web for unfamiliar libraries when web search is available.
+- Fix the cause, not the symptom. Keep the change focused and complete: update every call site, export, type and doc the change affects, and keep the project's existing style, structure and public interfaces unless the user asked to change them.
+- Never weaken, skip or delete tests to make them pass, and never hard-code expected outputs. Preserve unrelated work and changes you did not make.
+- Verify before you finish. Run the project's own checks for what you changed (its test suite, type check or build; the narrowest command first, then the full suite when it is cheap). If a check fails because of your change, fix it and run it again. If a check cannot run here, say so; never report an unrun check as passed.
+- For new behaviour, check it the way a user would use it (run the command, call the function, open the page) when that is quick.
- Write long files in chunks: create a file with its first section, then append the rest in a few smaller apply_patch (or edit) calls instead of one very large patch. A single multi-thousand-token patch is the write most likely to be cut off in transit; if a write is interrupted, re-issue only the missing part.
-- Split real work: for a task of more than a few tool calls, start one sub-agent per independent part in one message (one per bug or feature, one for tests, one to review), then combine results. Do quick questions yourself.
+- Prefer clear, practical steps over abstract explanations.
+- Make independent reads and searches in parallel in one message; keep dependent steps, edits and test runs sequential.
+- Prefer the dedicated read, grep and glob tools for looking at the project, and keep shell output short (filter or page long output instead of printing it all).
+- Use the todo list for tasks with several distinct steps, and keep it current.
+- If steps repeat, capture them as a skill following the \`Skill creation:\` instruction in this prompt.
+## Sub-agents
+
+Do the work yourself by default: one bug, one feature, one refactor, a review or a test run is one task for you, even when it takes many tool calls. A sub-agent starts without your context and its result has to be checked again, so delegating a single coherent task makes the result worse and slower. Use sub-agents only when the user asks for them, or when a large task splits into parts that are truly independent (for example several unrelated bugs in different areas) and each part needs a lot of reading.
+
- When the user asks for a specific number of agents, make exactly that many task-tool calls, no more and no fewer, and start them all in one message so they run in parallel. Use the general subagent unless a more specialized subagent is clearly better. Never replace an explicit delegation request with a simulated multi-role answer, and never claim subagents are unavailable while the task tool is present.
- Write each sub-agent's prompt yourself: self-contained, limited to that sub-agent's part, saying what to return. Never paste the user's whole message, or the user's instructions about sub-agents, into a sub-agent's prompt: the sub-agent would follow them again. Tell a sub-agent to start its own sub-agents only when the user explicitly asked for nested sub-agents.
-- Wait for every delegated task, then synthesize their actual results before answering; keep delegated activity visible in the session.
-- If steps repeat, capture them as a skill following the \`Skill creation:\` instruction in this prompt.
-- Prefer clear, practical steps over abstract explanations.
+- Wait for every delegated task and check its actual result before answering; keep delegated activity visible in the session.
${OMNIRUSH_SWARM_PROMPT}
@@ -65,6 +82,10 @@ The app can preview, edit, and download standard artifacts when you create or up
- For websites or React/UI previews, start the dev server when useful and mention the http://localhost:<port> URL.
- For spreadsheets, use .csv for simple tabular data and .xlsx when the user asks for Excel/XLS specifically.
+## Final answer
+
+Lead with the outcome. Summarize what you changed (with file paths), what you ran to check it and the result, and anything left open or assumed. Keep it short; skip what did not change.
+
## Git workflows
- Use git and gh from the bash tool; run them from the repository (the tool's workdir) rather than with \`git -C\`, so approvals match the command family.
diff --git a/apps/server/src/omnirush-runtime-config.test.ts b/apps/server/src/omnirush-runtime-config.test.ts
index dc751eef..d6c98f17 100644
--- a/apps/server/src/omnirush-runtime-config.test.ts
+++ b/apps/server/src/omnirush-runtime-config.test.ts
@@ -363,7 +363,10 @@ describe("omnirush runtime config file", () => {
expect(prompt).toContain("## Memory\n");
expect(prompt).toContain("## Artifacts");
expect(prompt).toContain("## Connected work");
- expect(prompt).toContain("Split real work: for a task of more than a few tool calls, start one sub-agent per independent part in one message");
+ expect(prompt).not.toContain("Split real work");
+ expect(prompt).toContain("Do the work yourself by default");
+ expect(prompt).toContain("## Autonomy and persistence");
+ expect(prompt).toContain("Verify before you finish.");
expect(prompt).toContain("make exactly that many task-tool calls, no more and no fewer, and start them all in one message");
expect(prompt).toContain("Never paste the user's whole message, or the user's instructions about sub-agents, into a sub-agent's prompt");
expect(prompt).toContain("Never replace an explicit delegation request with a simulated multi-role answer");
@@ -415,7 +418,8 @@ describe("omnirush runtime config file", () => {
const section = prompt.slice(prompt.indexOf("## Sub-agent swarms"), prompt.indexOf("## Editing files"));
expect(section).toContain(`load the \`${OMNIRUSH_SWARM_SKILL_NAME}\` skill first`);
expect(section).toContain("Before you start 3 or more sub-agents for implementation work");
- expect(section).toContain("For smaller implementation work, use 1-2 sub-agents directly when they help");
+ expect(section).toContain("follow the Sub-agents rules above");
+ expect(section).not.toContain("use 1-2 sub-agents directly when they help");
// No board mechanics on every request: no file name, no table, no layers.
expect(prompt).not.toContain("swarm.md");
expect(prompt).not.toContain("## Tasks");
diff --git a/apps/server/src/omnirush-swarm.ts b/apps/server/src/omnirush-swarm.ts
index 03a99992..dd72a235 100644
--- a/apps/server/src/omnirush-swarm.ts
+++ b/apps/server/src/omnirush-swarm.ts
@@ -150,7 +150,7 @@ export const OMNIRUSH_SWARM_SKILL_DESCRIPTION = `Required before starting ${OMNI
*/
export const OMNIRUSH_SWARM_PROMPT = `## Sub-agent swarms
-Before you start ${OMNIRUSH_SWARM_MIN_AGENTS} or more sub-agents for implementation work (large work that splits into ${OMNIRUSH_SWARM_MIN_AGENTS}+ independent parts, or the user asks for a swarm or for ${OMNIRUSH_SWARM_MIN_AGENTS}+ agents), load the \`${OMNIRUSH_SWARM_SKILL_NAME}\` skill first and follow it. Handle questions, investigations, reviews, tests, docs and explanations yourself unless the user explicitly asks for sub-agents. For smaller implementation work, use 1-2 sub-agents directly when they help.`;
+Before you start ${OMNIRUSH_SWARM_MIN_AGENTS} or more sub-agents for implementation work (large work that splits into ${OMNIRUSH_SWARM_MIN_AGENTS}+ independent parts, or the user asks for a swarm or for ${OMNIRUSH_SWARM_MIN_AGENTS}+ agents), load the \`${OMNIRUSH_SWARM_SKILL_NAME}\` skill first and follow it. Below that, follow the Sub-agents rules above.`;
/** The body of the omnirush-swarm skill (without frontmatter). */
export const OMNIRUSH_SWARM_SKILL = `# Sub-agent swarm