Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(profile): add interactive setup command for agent profiles

Jiayuana990a1c3cabf
diff --git a/skills/profile-setup/SKILL.md b/skills/profile-setup/SKILL.md
new file mode 100644
index 0000000000..a5f57e62be
--- /dev/null
+++ b/skills/profile-setup/SKILL.md
@@ -0,0 +1,106 @@
+---
+name: Profile Setup
+description: Interactive setup wizard to personalize your agent profile
+version: 1.0.0
+metadata:
+ emoji: "๐Ÿง™"
+ tags:
+ - profile
+ - setup
+ - onboarding
+---
+
+## Instructions
+
+You are conducting an interactive setup to personalize the agent profile. Your goal is to learn about the user through natural conversation and update their profile files accordingly.
+
+### Setup Context
+
+The user has just created a new agent profile and wants to personalize it. You have access to the profile directory and can update the following files:
+
+- `user.md` - Information about the user (name, preferences, context)
+- `workspace.md` - Workspace rules and conventions
+- `config.json` - Configuration (provider, model, etc.)
+
+### Conversation Flow
+
+Have a natural conversation to learn about the user. Don't follow a rigid script - adapt based on their responses. Here are topics to explore:
+
+1. **Basic Introduction**
+ - What should I call you?
+ - What's your timezone or location? (for context)
+
+2. **Work Context**
+ - What kind of work do you mainly do? (development, writing, research, etc.)
+ - What tech stack or tools do you use most?
+ - Any specific projects you're working on?
+
+3. **Communication Preferences**
+ - How do you prefer responses? (concise vs detailed, formal vs casual)
+ - Any language preferences? (English, Chinese, mixed)
+ - Anything that annoys you in AI responses?
+
+4. **Workflow Preferences**
+ - Any coding conventions or style preferences?
+ - Preferred package managers, tools, or frameworks?
+ - Any specific rules or constraints I should follow?
+
+### Guidelines
+
+- **Be conversational**: This is a dialogue, not an interrogation. Ask follow-up questions naturally.
+- **Don't ask everything**: Pick the most relevant questions based on context. Skip what doesn't apply.
+- **Summarize and confirm**: After gathering information, summarize what you learned and ask if it's accurate.
+- **Update files progressively**: As you learn things, update the relevant profile files.
+- **End gracefully**: When you have enough information, wrap up the conversation and let the user know their profile is ready.
+
+### File Updates
+
+When updating files, use the `write` or `edit` tool:
+
+**user.md example:**
+```markdown
+# User
+
+- **Name:** Jiayuan
+- **Call me:** Jiayuan
+- **Timezone:** Asia/Shanghai
+- **Notes:** Prefers concise responses
+
+## Context
+
+- Full-stack developer working on AI agent projects
+- Main stack: TypeScript, Node.js, React
+- Uses pnpm, prefers functional programming style
+```
+
+**workspace.md updates:**
+Add specific rules the user mentions, like:
+- Always use pnpm instead of npm
+- Follow conventional commits
+- Prefer TypeScript over JavaScript
+
+**config.json:**
+If the user mentions provider/model preferences, update config.json:
+```json
+{
+ "provider": "anthropic",
+ "model": "claude-sonnet-4-20250514"
+}
+```
+
+### Starting the Conversation
+
+Begin with a friendly greeting and explain what you're doing. For example:
+
+"Hi! I'm here to help set up your agent profile so I can assist you better. Let me ask you a few questions to understand your preferences and workflow. Feel free to skip anything you don't want to answer.
+
+First, what should I call you?"
+
+### Ending the Conversation
+
+When you've gathered enough information, summarize and close:
+
+"Great! I've updated your profile with what I learned:
+- [Summary of key points]
+
+Your profile is ready. You can always update these files later or run setup again. Feel free to start chatting with me anytime!"
diff --git a/src/agent/cli/commands/profile.ts b/src/agent/cli/commands/profile.ts
index 0800fcb6f0..1e3537fc14 100644
--- a/src/agent/cli/commands/profile.ts
+++ b/src/agent/cli/commands/profile.ts
@@ -9,8 +9,10 @@
* multica profile delete <id> Delete a profile
*/
-import { existsSync, readdirSync, rmSync } from "node:fs";
-import { join } from "node:path";
+import { existsSync, readdirSync, rmSync, readFileSync } from "node:fs";
+import { join, dirname } from "node:path";
+import { fileURLToPath } from "node:url";
+import * as readline from "node:readline";
import {
createAgentProfile,
loadAgentProfile,
@@ -18,11 +20,15 @@ import {
profileExists,
} from "../../profile/index.js";
import { DATA_DIR } from "../../../shared/index.js";
-import { cyan, yellow, green, dim, red } from "../colors.js";
+import { cyan, yellow, green, dim, red, brightCyan, gray, colors } from "../colors.js";
+import { Agent } from "../../runner.js";
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const SETUP_SKILL_PATH = join(__dirname, "../../../../skills/profile-setup/SKILL.md");
const PROFILES_DIR = join(DATA_DIR, "agent-profiles");
-type Command = "new" | "list" | "show" | "edit" | "delete" | "help";
+type Command = "new" | "list" | "show" | "edit" | "delete" | "setup" | "help";
function printHelp() {
console.log(`
@@ -31,6 +37,7 @@ ${cyan("Usage:")} multica profile <command> [options]
${cyan("Commands:")}
${yellow("list")} List all profiles
${yellow("new")} <id> Create a new profile
+ ${yellow("setup")} <id> Interactive setup for a profile
${yellow("show")} <id> Show profile contents
${yellow("edit")} <id> Open profile directory in file manager
${yellow("delete")} <id> Delete a profile
@@ -38,16 +45,18 @@ ${cyan("Commands:")}
${cyan("Profile Structure:")}
Each profile is a directory containing:
- - soul.md Personality and constraints
- - identity.md Name and role
- - tools.md Tool usage instructions
+ - soul.md Agent identity, personality and behavior
+ - user.md Information about the user
+ - workspace.md Workspace rules and conventions
- memory.md Persistent knowledge
- - bootstrap.md Initial context
${cyan("Examples:")}
${dim("# Create a new profile")}
multica profile new my-agent
+ ${dim("# Interactive setup")}
+ multica profile setup my-agent
+
${dim("# List all profiles")}
multica profile list
@@ -82,13 +91,15 @@ function cmdNew(profileId: string | undefined) {
console.log(`${dim("Location:")} ${dir}`);
console.log("");
console.log("Files created:");
- console.log(" - soul.md (personality and constraints)");
- console.log(" - identity.md (name and role)");
- console.log(" - tools.md (tool usage instructions)");
+ console.log(" - soul.md (identity, personality and behavior)");
+ console.log(" - user.md (information about the user)");
+ console.log(" - workspace.md (workspace rules and conventions)");
console.log(" - memory.md (persistent knowledge)");
- console.log(" - bootstrap.md (initial context)");
console.log("");
- console.log("Edit these files to customize your agent, then run:");
+ console.log("Run interactive setup to personalize your agent:");
+ console.log(` multica profile setup ${profileId}`);
+ console.log("");
+ console.log("Or start chatting directly:");
console.log(` multica chat --profile ${profileId}`);
}
@@ -136,33 +147,27 @@ function cmdShow(profileId: string | undefined) {
console.log(`${dim("Location:")} ${getProfileDir(profileId)}`);
console.log("");
- if (profile.identity) {
- console.log(`${green("=== identity.md ===")}`);
- console.log(profile.identity.trim());
- console.log("");
- }
-
if (profile.soul) {
console.log(`${green("=== soul.md ===")}`);
console.log(profile.soul.trim());
console.log("");
}
- if (profile.tools) {
- console.log(`${green("=== tools.md ===")}`);
- console.log(profile.tools.trim());
+ if (profile.user) {
+ console.log(`${green("=== user.md ===")}`);
+ console.log(profile.user.trim());
console.log("");
}
- if (profile.memory) {
- console.log(`${green("=== memory.md ===")}`);
- console.log(profile.memory.trim());
+ if (profile.workspace) {
+ console.log(`${green("=== workspace.md ===")}`);
+ console.log(profile.workspace.trim());
console.log("");
}
- if (profile.bootstrap) {
- console.log(`${green("=== bootstrap.md ===")}`);
- console.log(profile.bootstrap.trim());
+ if (profile.memory) {
+ console.log(`${green("=== memory.md ===")}`);
+ console.log(profile.memory.trim());
console.log("");
}
}
@@ -213,6 +218,150 @@ function cmdDelete(profileId: string | undefined) {
}
}
+/**
+ * Load setup skill instructions from SKILL.md
+ */
+function loadSetupSkillInstructions(): string | undefined {
+ try {
+ if (!existsSync(SETUP_SKILL_PATH)) {
+ return undefined;
+ }
+ const content = readFileSync(SETUP_SKILL_PATH, "utf-8");
+ // Extract instructions after frontmatter (after the second ---)
+ const parts = content.split("---");
+ if (parts.length >= 3) {
+ return parts.slice(2).join("---").trim();
+ }
+ return content;
+ } catch {
+ return undefined;
+ }
+}
+
+/**
+ * Interactive setup for a profile
+ */
+async function cmdSetup(profileId: string | undefined) {
+ if (!profileId) {
+ console.error("Error: Profile ID is required");
+ console.error("Usage: multica profile setup <id>");
+ process.exit(1);
+ }
+
+ if (!profileExists(profileId)) {
+ console.error(`Error: Profile "${profileId}" not found`);
+ console.error(`Create it first with: multica profile new ${profileId}`);
+ process.exit(1);
+ }
+
+ // Check TTY
+ if (!process.stdin.isTTY) {
+ console.error(colors.error("Error: Interactive setup requires a TTY."));
+ process.exit(1);
+ }
+
+ // Load setup skill instructions
+ const setupInstructions = loadSetupSkillInstructions();
+ if (!setupInstructions) {
+ console.error(colors.error("Error: Could not load setup skill instructions."));
+ process.exit(1);
+ }
+
+ const profileDir = getProfileDir(profileId);
+
+ // Build system prompt with setup instructions
+ const systemPrompt = `${setupInstructions}
+
+## Profile Context
+
+You are setting up the profile "${profileId}".
+The profile directory is: ${profileDir}
+
+Available profile files to update:
+- ${profileDir}/user.md - Information about the user
+- ${profileDir}/workspace.md - Workspace rules and conventions
+- ${profileDir}/config.json - Configuration (provider, model, etc.)
+
+Start the setup conversation now.`;
+
+ // Create agent with setup instructions
+ const agent = new Agent({
+ profileId,
+ systemPrompt,
+ });
+
+ // Print welcome
+ console.log("");
+ console.log(cyan("โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ"));
+ console.log(`${cyan("โ”‚")} ${brightCyan("Profile Setup Wizard")} ${cyan("โ”‚")}`);
+ console.log(cyan("โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ"));
+ console.log("");
+ console.log(`${dim("Profile:")} ${yellow(profileId)}`);
+ console.log(`${dim("Location:")} ${gray(profileDir)}`);
+ console.log(`${dim("Type")} ${cyan("/exit")} ${dim("to finish setup.")}`);
+ console.log("");
+
+ // Start the conversation with an initial prompt
+ try {
+ await agent.run("Start the setup process.");
+ console.log("");
+ } catch (err) {
+ console.error(`\n${colors.error(`Error: ${err instanceof Error ? err.message : String(err)}`)}`);
+ }
+
+ // Interactive loop
+ const rl = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout,
+ });
+
+ const askQuestion = (prompt: string): Promise<string> => {
+ return new Promise((resolve) => {
+ rl.question(prompt, (answer) => {
+ resolve(answer);
+ });
+ });
+ };
+
+ let running = true;
+
+ // Handle Ctrl+C
+ process.on("SIGINT", () => {
+ console.log(`\n${dim("Setup cancelled.")}`);
+ rl.close();
+ process.exit(0);
+ });
+
+ while (running) {
+ const input = await askQuestion(`${brightCyan("You:")} `);
+ const trimmed = input.trim();
+
+ if (!trimmed) continue;
+
+ // Check for exit command
+ if (trimmed.toLowerCase() === "/exit" || trimmed.toLowerCase() === "/quit" || trimmed.toLowerCase() === "/q") {
+ console.log("");
+ console.log(`${green("Setup complete!")} Your profile has been updated.`);
+ console.log(`${dim("Start chatting with:")} multica chat --profile ${profileId}`);
+ console.log("");
+ running = false;
+ break;
+ }
+
+ // Send to agent
+ try {
+ console.log("");
+ await agent.run(trimmed);
+ console.log("");
+ } catch (err) {
+ console.error(`\n${colors.error(`Error: ${err instanceof Error ? err.message : String(err)}`)}`);
+ console.log("");
+ }
+ }
+
+ rl.close();
+}
+
export async function profileCommand(args: string[]): Promise<void> {
const command = (args[0] || "help") as Command;
const arg1 = args[1];
@@ -238,6 +387,9 @@ export async function profileCommand(args: string[]): Promise<void> {
case "delete":
cmdDelete(arg1);
break;
+ case "setup":
+ await cmdSetup(arg1);
+ break;
case "help":
default:
printHelp();