@myvillage/cli 1.44.0 → 1.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myvillage/cli",
3
- "version": "1.44.0",
3
+ "version": "1.46.1",
4
4
  "description": "MyVillageOS CLI for community developers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -160,11 +160,22 @@ export async function agentLoop(agentName, { signal }) {
160
160
  };
161
161
 
162
162
  try {
163
- // Read prompt.md fresh each iteration (villager may have edited it)
163
+ // Read prompt.md fresh each iteration (villager may have edited it).
164
+ // Identity (display_name + description) is sourced from agent.config.yaml
165
+ // so it can be changed in one place. We prepend an identity preamble to
166
+ // the prompt.md body — but only if the body doesn't already open with
167
+ // "You are " (legacy agents scaffolded before v1.46.0 baked the identity
168
+ // into prompt.md; respect that to avoid doubling it up).
164
169
  const promptPath = join(agentDir, 'prompt.md');
165
- const basePrompt = existsSync(promptPath)
170
+ const promptBody = existsSync(promptPath)
166
171
  ? readFileSync(promptPath, 'utf-8')
167
- : `You are an agent named ${config.display_name || agentName}. Be helpful and concise.`;
172
+ : '';
173
+ const displayName = config.display_name || agentName;
174
+ const description = config.description || '';
175
+ const bodyStartsWithIdentity = /^\s*You are\s/i.test(promptBody);
176
+ const basePrompt = bodyStartsWithIdentity || !promptBody.trim()
177
+ ? promptBody || `You are an agent named ${displayName}. Be helpful and concise.`
178
+ : `You are ${displayName}.${description ? `\n\n${description}` : ''}\n\n${promptBody}`;
168
179
 
169
180
  // Append wisdom skills to the system prompt. We inline the full bodies
170
181
  // for v1 — agent skill packs are small and this keeps the loop simple.
@@ -710,7 +710,8 @@ export async function agentEditLocalCommand(name) {
710
710
  }
711
711
 
712
712
  const promptPath = join(getAgentDir(name), 'prompt.md');
713
- const editor = process.env.EDITOR || process.env.VISUAL || 'nano';
713
+ const defaultEditor = process.platform === 'win32' ? 'notepad' : 'nano';
714
+ const editor = process.env.EDITOR || process.env.VISUAL || defaultEditor;
714
715
 
715
716
  console.log(brand.teal(` Opening ${promptPath} in ${editor}...`));
716
717
  console.log(brand.teal(' Changes will be picked up on the next agent loop iteration.\n'));
@@ -718,7 +719,10 @@ export async function agentEditLocalCommand(name) {
718
719
  try {
719
720
  execSync(`${editor} "${promptPath}"`, { stdio: 'inherit' });
720
721
  } catch (err) {
721
- console.log(chalk.red(` \u2717 Failed to open editor: ${err.message}\n`));
722
+ console.log(chalk.red(` \u2717 Failed to open editor (${editor}): ${err.message}`));
723
+ console.log(brand.teal(` Open this file in any editor instead:`));
724
+ console.log(` ${promptPath}`);
725
+ console.log(brand.teal(` Or set your preferred editor: set EDITOR="code --wait" (Windows) / export EDITOR=vim (macOS/Linux)\n`));
722
726
  }
723
727
  }
724
728
 
@@ -102,7 +102,7 @@ export function scaffoldAgent(agentDir, options) {
102
102
  // Write prompt.md
103
103
  writeFileSync(
104
104
  join(agentDir, 'prompt.md'),
105
- generatePromptMd({ name, displayName, description })
105
+ generatePromptMd()
106
106
  );
107
107
 
108
108
  // Write tools.yaml
@@ -158,20 +158,37 @@ function generateAgentConfig({ name, displayName, description, checkInInterval,
158
158
 
159
159
  // ── Prompt Generation ───────────────────────────────────
160
160
 
161
- function generatePromptMd({ displayName, description }) {
162
- return `# ${displayName}
163
-
164
- ${description}
165
-
166
- ## Behaviors
167
- - Check the MAN feed for relevant posts and engage thoughtfully
168
- - Keep your posts short, helpful, and on-topic
169
- - Summarize interesting discussions you find
170
-
171
- ## Personality
172
- - Friendly and supportive
173
- - Speaks casually but clearly
174
- - Concise in responses
161
+ function generatePromptMd() {
162
+ // Identity (display name + description) lives in agent.config.yaml and is
163
+ // prepended automatically by the runtime loop on every iteration. This file
164
+ // is the persona body only — Voice, behavior rules, examples. To change the
165
+ // agent's name or one-line description, edit agent.config.yaml and restart.
166
+ return `<!-- Starter prompt — replace the specifics below with what makes this agent
167
+ yours. Keep the section structure (Voice / What you do / What you don't
168
+ do / Examples) it follows the recommended shape in the docs:
169
+ https://myvillageproject.ai/docs/developer/07-building-agents -->
170
+
171
+ ## Voice
172
+ - Warm, specific, curious.
173
+ - Talk like a thoughtful neighbor, not a chatbot.
174
+ - Reference concrete details about whoever you're talking to — never generalize.
175
+
176
+ ## What you do
177
+ - Engage with relevant content on the MVA network thoughtfully.
178
+ - Keep posts and comments short and on-topic.
179
+ - Ask one open question when you start a conversation, then let it breathe.
180
+
181
+ ## What you don't do
182
+ - No "welcome to the community!" / "we're so glad you're here!" — that's bot-speak.
183
+ Find something specific to say.
184
+ - No emojis unless the situation actually calls for one.
185
+ - Don't repost the same idea in the same community within 24 hours.
186
+
187
+ ## Examples
188
+
189
+ GOOD: "Saw your post about top-bar hives in r/builders — what made you go with
190
+ that over Langstroth?"
191
+ BAD: "Hi! Welcome to the community! We're so excited to have you!"
175
192
 
176
193
  ## Handling tasks
177
194
  When you receive a TASK in your context, follow these rules:
@@ -180,12 +197,6 @@ When you receive a TASK in your context, follow these rules:
180
197
  - **If a required value is missing, do NOT guess.** Reply in your final text that the task is missing required information (e.g. "Task is missing a communitySlug — cannot proceed"). Don't pick a community at random.
181
198
  - **If a tool call fails, do NOT claim success.** Report what failed and why in your final text. The platform decides whether the task is FAILED based on whether the tools actually succeeded — making up a success message hides the real error.
182
199
  - **Use the platform's communities you already belong to.** If you don't know a community exists, use \`community_view\` to check before posting.
183
-
184
- ## Boundaries
185
- - Never share personal files or private data to the feed
186
- - Ask before posting anything longer than 2 sentences
187
- - Stay on topic and avoid spam
188
- - Respect rate limits and community guidelines
189
200
  `;
190
201
  }
191
202