diff --git a/apps/x/packages/core/src/application/assistant/instructions.ts b/apps/x/packages/core/src/application/assistant/instructions.ts index a29b225f..0e9a8c5d 100644 --- a/apps/x/packages/core/src/application/assistant/instructions.ts +++ b/apps/x/packages/core/src/application/assistant/instructions.ts @@ -37,6 +37,8 @@ Rowboat is an agentic assistant for everyday work - emails, meetings, projects, **Slack:** When users ask about Slack messages, want to send messages to teammates, check channel conversations, or find someone on Slack, load the \`slack\` skill. You can send messages, view channel history, search conversations, and find users. Always show message drafts to the user before sending. +**Code with Agents:** When users ask you to write code, build a project, create a script, fix a bug, or do any software development task, load the \`code-with-agents\` skill first. It provides guidance for delegating coding work to Claude Code or Codex via acpx. + ## Learning About the User (save-to-memory) Use the \`save-to-memory\` tool to note things worth remembering about the user. This builds a persistent profile that helps you serve them better over time. Call it proactively — don't ask permission. diff --git a/apps/x/packages/core/src/application/assistant/skills/code-with-agents/skill.ts b/apps/x/packages/core/src/application/assistant/skills/code-with-agents/skill.ts new file mode 100644 index 00000000..e4b24e54 --- /dev/null +++ b/apps/x/packages/core/src/application/assistant/skills/code-with-agents/skill.ts @@ -0,0 +1,79 @@ +export const skill = String.raw` +# Code with Agents Skill + +Use this skill when the user asks you to write code, build a project, create scripts, fix bugs, or do any software development task that should be delegated to a coding agent (Claude Code or Codex). + +## Prerequisites + +The user must have one of the following installed on their machine: +- **Claude Code** — https://claude.ai/code +- **Codex** — https://codex.openai.com + +These are external tools that you cannot install for the user. + +## Workflow + +### Step 1: Gather requirements + +Before running anything, confirm the following with the user: + +1. **Working directory** — Ask which folder the code should be written in, unless the user has already specified it. Example: "Which folder should I work in?" +2. **Agent choice** — Ask whether to use **Claude Code** or **Codex**. Mention that the chosen agent must already be installed on their machine. + +### Step 2: Confirm execution plan + +Once you know the folder and agent, tell the user: + +> I'll use [Claude Code / Codex] to [description of the task] in \`[folder]\`. All permission requests from the coding agent (file writes, command execution, etc.) will be automatically approved. Shall I proceed? + +Wait for the user to confirm before executing. + +### Step 3: Execute with acpx + +Use the \`executeCommand\` tool to run the coding agent via acpx. The command format is: + +**For Claude Code:** +` + "`" + ` +npx acpx@latest --approve-all --cwd claude exec "" +` + "`" + ` + +**For Codex:** +` + "`" + ` +npx acpx@latest --approve-all --cwd codex exec "" +` + "`" + ` + +### Critical: flag order + +The \`--approve-all\` and \`--cwd\` flags are **global flags** and MUST come **before** the agent name (\`claude\` or \`codex\`). This is the correct order: + +` + "`" + ` +npx acpx@latest [global flags] exec "" +` + "`" + ` + +**Correct:** +` + "`" + ` +npx acpx@latest --approve-all --cwd ~/projects/myapp claude exec "fix the bug" +` + "`" + ` + +**Wrong (will fail):** +` + "`" + ` +npx acpx@latest claude --approve-all exec "fix the bug" +` + "`" + ` + +### Writing good prompts + +When constructing the prompt for the coding agent: +- Be specific and detailed about what to build or fix +- Include file names, function signatures, and expected behavior +- Mention any constraints (language, framework, style) +- If the user gave you a short request, expand it into a clear, actionable prompt for the agent + +### Step 4: Report results + +After the command finishes: +- Summarize what the agent did +- If it failed, explain why and suggest fixes +- If the exit code is 5, it means permissions were denied — this should not happen with \`--approve-all\`, but if it does, let the user know +`; + +export default skill; diff --git a/apps/x/packages/core/src/application/assistant/skills/index.ts b/apps/x/packages/core/src/application/assistant/skills/index.ts index 44774d6e..0ade5a62 100644 --- a/apps/x/packages/core/src/application/assistant/skills/index.ts +++ b/apps/x/packages/core/src/application/assistant/skills/index.ts @@ -12,6 +12,7 @@ import backgroundAgentsSkill from "./background-agents/skill.js"; import createPresentationsSkill from "./create-presentations/skill.js"; import appNavigationSkill from "./app-navigation/skill.js"; +import codeWithAgentsSkill from "./code-with-agents/skill.js"; const CURRENT_DIR = path.dirname(fileURLToPath(import.meta.url)); const CATALOG_PREFIX = "src/application/assistant/skills"; @@ -96,6 +97,12 @@ const definitions: SkillDefinition[] = [ summary: "Navigate the app UI - open notes, switch views, filter/search the knowledge base, and manage saved views.", content: appNavigationSkill, }, + { + id: "code-with-agents", + title: "Code with Agents", + summary: "Write code, build projects, create scripts, or fix bugs by delegating to Claude Code or Codex via acpx.", + content: codeWithAgentsSkill, + }, ]; const skillEntries = definitions.map((definition) => ({