ai-advisory-board 0.5.0 → 0.6.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # CHANGELOG — AI Advisory Board CLI
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fd78aac: Type-first Add Member wizard with AI fill during creation.
8
+
9
+ - **Pick an archetype first:** "Add board member" now opens a two-step wizard — choose 🌟 Inspired by a well-known person, 🎓 Top 1% expert, or 🧑‍💼 Practitioner — and step 2 shows only the inputs that type needs (Name+Title for a person; Field/Domain for an expert; Role + Industry/Domain for a practitioner). Editing an existing member still uses the flat all-fields form.
10
+ - **AI fill works _before_ save:** a Manual ⇄ AI toggle (AI by default) lets a first-time user generate everything during creation. The old "✨ Enhance with AI" button refused to run until the member was already saved; the wizard adds a stateless `POST /api/members/enhance-preview` that runs a web-research call to fill `expertise[]` and then the persona enhancer, dropping the results into editable fields to review before saving — nothing is persisted until you hit Save.
11
+ - **Descriptive-label naming for archetypes:** an expert saves as `"{Field} Expert"` / `Top 1% Expert`, a practitioner as `{Role}` / `"{Domain} practitioner"` — no fabricated identities.
12
+ - **BFI-2 + Cognitive Architecture for all three personas:** the famous-person prompt now matches the original AAB template (Psychometric Profile BFI-2 "I-statements" + step-by-step Cognitive Architecture), and the expert and practitioner prompts were reframed from person-locked to field/role-based archetypes and gained the same BFI-2 + cognitive-process output. All three keep the hardened JSON output contract.
13
+
14
+ - fd78aac: Live progress pane for skill creation from the Action Board.
15
+
16
+ After accepting a planner proposal, the skill-creator run was invisible — the kanban sat silent for the (often multi-minute) Opus run with no indication anything was happening. There is now a dedicated progress pane that opens the moment you accept and stays up until install/fail: it shows the skill name, a live elapsed timer, the streaming `skill-creator` tool activity, and "validating & installing…" before completion. Success auto-closes after a beat; failure surfaces a sticky banner with the real error (now tolerant of the orchestrator's `error`/`reason` payload shapes, not just `errorMessage`). A "Run in background" button hides the pane without cancelling the run.
17
+
3
18
  ## 0.5.0
4
19
 
5
20
  ### Minor Changes
package/dist/bin/aab.js CHANGED
@@ -9434,6 +9434,7 @@ function stepsMatch(a, b) {
9434
9434
  // src/core/members/ai-enhancer.ts
9435
9435
  init_claude_code_runner();
9436
9436
  init_safe_json();
9437
+ import { z as z3 } from "zod";
9437
9438
 
9438
9439
  // src/core/parsing/persona-schemas.ts
9439
9440
  import { z as z2 } from "zod";
@@ -9508,6 +9509,38 @@ async function enhancePersona(args, settings, opts = {}) {
9508
9509
  }
9509
9510
  return extractEnhancement(raw, args.name);
9510
9511
  }
9512
+ async function researchExpertise(args, settings, opts = {}) {
9513
+ const subject = args.subject.trim();
9514
+ if (!subject) return [];
9515
+ const ctx = args.context?.trim() ? ` (${args.context.trim()})` : "";
9516
+ const framing = args.type === "famous" ? `the well-known person "${subject}"${ctx}` : args.type === "expert" ? `a top 1% expert in the field of "${subject}"` : `an experienced practitioner working as "${subject}"${ctx}`;
9517
+ const prompt2 = `Identify the 3-6 most important, specific areas of expertise for ${framing}.
9518
+ Use web search to ground this in reality where helpful.
9519
+ Return ONLY a raw JSON array of short strings (2-4 words each), no commentary, no markdown, no fences. Start with \`[\` and end with \`]\`.
9520
+ Example: ["AI strategy", "scaling startups", "product vision"]`;
9521
+ const model = opts.model ?? settings.researchModel ?? "sonnet";
9522
+ try {
9523
+ const result = await runClaude({
9524
+ prompt: prompt2,
9525
+ model,
9526
+ allowedTools: ["WebSearch", "WebFetch"],
9527
+ maxTurns: 3,
9528
+ timeoutMs: opts.timeoutMs ?? 3 * 6e4,
9529
+ signal: opts.signal,
9530
+ onEvent: opts.onEvent,
9531
+ maxBudgetUsd: settings.perCallBudgetUsd
9532
+ });
9533
+ const parsed = safeParseJSONWithSchema(extractText(result), z3.array(z3.string()));
9534
+ if (parsed.success) {
9535
+ return parsed.data.map((s) => s.trim()).filter((s) => s.length > 0).slice(0, 6);
9536
+ }
9537
+ return [];
9538
+ } catch (error) {
9539
+ if (error instanceof Error && error.name === "AbortError") throw error;
9540
+ logger.warn("[ai-enhancer] expertise research failed (non-fatal):", error);
9541
+ return [];
9542
+ }
9543
+ }
9511
9544
  function buildPrompt(type, name, title, expertiseText, currentPersona) {
9512
9545
  switch (type) {
9513
9546
  case "famous":
@@ -9541,6 +9574,8 @@ Generate a comprehensive advisory board persona that includes:
9541
9574
  3. **Leadership Philosophy**: Their known approach to leadership and decision-making
9542
9575
  4. **Strategic Approach**: Their methodology for tackling complex business challenges
9543
9576
  5. **Board Dynamics**: How they typically interact in high-level strategic discussions
9577
+ 6. **Psychometric Profile (BFI-2 Expanded)**: Generate 5-7 first-person 'I-statements' that define their personality traits according to the Big Five framework (e.g., 'I am a person who is...'). This must replace generic adjectives to ensure precise behavioral simulation.
9578
+ 7. **Cognitive Architecture**: Define a strictly step-by-step internal reasoning process this person uses. For example: 'First, look for the downside (Inversion). Second, check the math. Third, simplify the message.' This creates the 'Reflective Meta-Prompting' layer
9544
9579
 
9545
9580
  ## TASK 2: VOICE & BEHAVIOR GUIDE
9546
9581
  Create a concise voice guide that captures:
@@ -9552,95 +9587,110 @@ Create a concise voice guide that captures:
9552
9587
  Return ONLY a raw JSON object with this exact structure. No markdown, no fences, no commentary. Start with \`{\` and end with \`}\`.
9553
9588
  {
9554
9589
  "persona": "A comprehensive 4-6 paragraph advisory board persona for ${name}, written in a professional manner that demonstrates intimate knowledge of their professional approach and advisory capabilities.",
9555
- "voiceGuide": "A concise but comprehensive voice and behavior guide that captures ${name}'s distinctive communication patterns, decision-making approach, and interaction style for AI persona simulation.",
9556
- "psychometricProfile": ["BFI-2 style first-person statement 1", "statement 2", "statement 3", "statement 4", "statement 5"],
9557
- "cognitiveProcess": "Step 1: ... -> Step 2: ... -> Step 3: ... -> Step 4: ..."
9590
+ "psychometricProfile": [
9591
+ "I am a person who is [Specific BFI-2 Trait for Openness]...",
9592
+ "I am a person who is [Specific BFI-2 Trait for Conscientiousness]..."
9593
+ ],
9594
+ "cognitiveProcess": "Step 1: [Analysis Style] -> Step 2: [Self-Critique/Reflection] -> Step 3: [Decision]",
9595
+ "voiceGuide": "A concise but comprehensive voice and behavior guide that captures ${name}'s distinctive communication patterns, decision-making approach, and interaction style for AI persona simulation."
9558
9596
  }
9559
9597
 
9560
9598
  Remember: This is specifically for ${name} and must reflect their known characteristics accurately.`;
9561
9599
  }
9562
9600
  function buildTopExpertPrompt(name, title, expertiseText) {
9563
- return `# IDENTITY LOCK: ${name}
9564
- You are creating both a detailed advisory board persona AND a voice guide specifically for ${name}, who is ${title}.
9601
+ return `# PERSONA LOCK: A top 1% expert in ${expertiseText}
9602
+ You are creating both a detailed advisory board persona AND a voice guide for a TOP 1% EXPERT in ${expertiseText} \u2014 an archetypal authority representing the absolute pinnacle of capability in this field. This is a composite of the very best practitioners and thinkers in ${expertiseText}, not a specific named celebrity.
9565
9603
 
9566
9604
  ## CRITICAL REQUIREMENTS:
9567
- - This is ONLY for ${name} - do not create content for anyone else
9568
- - This is for a TOP 1% EXPERT who represents the absolute pinnacle of expertise
9569
- - Focus on their exceptional expertise and world-class capabilities
9605
+ - Embody the deepest, most current expertise in ${expertiseText}
9606
+ - Ground every trait in how genuine top-tier experts in this field actually reason and behave
9607
+ - Focus on world-class capability and methodology, not fame or credentials
9570
9608
 
9571
9609
  ## MEMBER CONTEXT:
9572
- - Name: ${name}
9573
- - Title: ${title}
9574
- - Expertise: ${expertiseText}
9575
- - Type: TOP 1% EXPERT in their field
9610
+ - Persona: ${name}
9611
+ - Role: ${title}
9612
+ - Field / Domain: ${expertiseText}
9613
+ - Type: TOP 1% EXPERT (archetypal authority in their field)
9576
9614
 
9577
9615
  ## TASK 1: ADVISORY BOARD PERSONA
9578
9616
  Generate a comprehensive advisory board persona that includes:
9579
9617
 
9580
- 1. **Technical Mastery**: Their deep, nuanced understanding and specialized knowledge
9581
- 2. **Innovation Leadership**: How they've shaped or advanced their field
9582
- 3. **Problem-Solving Approach**: Their unique methodology for tackling complex challenges
9583
- 4. **Industry Standing**: Their reputation and influence among peers
9584
- 5. **Advisory Excellence**: What makes their guidance invaluable to boards
9585
- 6. **Strategic Insights**: How they identify opportunities others miss
9618
+ 1. **Technical Mastery**: The deep, nuanced understanding and specialized knowledge that defines the top 1% in ${expertiseText}
9619
+ 2. **Innovation Leadership**: How the best in this field advance the state of the art
9620
+ 3. **Problem-Solving Approach**: The methodology a world-class ${expertiseText} expert uses on the hardest problems
9621
+ 4. **Industry Standing**: The reputation and influence such an expert commands among peers
9622
+ 5. **Advisory Excellence**: What makes their guidance invaluable in board-level discussions
9623
+ 6. **Psychometric Profile (BFI-2 Expanded)**: Generate 5-7 first-person 'I-statements' that define this expert's personality traits according to the Big Five framework (e.g., 'I am a person who is...'). This must replace generic adjectives to ensure precise behavioral simulation.
9624
+ 7. **Cognitive Architecture**: Define a strictly step-by-step internal reasoning process this expert uses. For example: 'First, decompose the problem to first principles. Second, stress-test against edge cases. Third, quantify the trade-offs.' This creates the 'Reflective Meta-Prompting' layer
9586
9625
 
9587
9626
  ## TASK 2: VOICE & BEHAVIOR GUIDE
9588
9627
  Create a concise voice guide that captures:
9589
9628
  - Their expert-level communication patterns and analytical approach
9590
- - How they leverage their deep expertise in discussions
9629
+ - How they leverage deep expertise in discussions
9591
9630
  - Their characteristic way of breaking down complex problems
9592
9631
 
9593
9632
  ## OUTPUT FORMAT (CRITICAL):
9594
9633
  Return ONLY a raw JSON object with this exact structure. No markdown, no fences, no commentary. Start with \`{\` and end with \`}\`.
9595
9634
  {
9596
- "persona": "A comprehensive 4-6 paragraph advisory board persona for ${name}, demonstrating why they're considered among the very best in ${expertiseText} and how their world-class expertise translates to exceptional board-level value.",
9597
- "voiceGuide": "A concise but comprehensive voice and behavior guide that captures ${name}'s expert-level communication patterns, analytical approach, and how they leverage their specialized knowledge in strategic discussions."
9635
+ "persona": "A comprehensive 4-6 paragraph advisory board persona for a top 1% expert in ${expertiseText}, demonstrating world-class command of the field and how that expertise translates to exceptional board-level value.",
9636
+ "psychometricProfile": [
9637
+ "I am a person who is [Specific BFI-2 Trait for Openness]...",
9638
+ "I am a person who is [Specific BFI-2 Trait for Conscientiousness]..."
9639
+ ],
9640
+ "cognitiveProcess": "Step 1: [Analysis Style] -> Step 2: [Self-Critique/Reflection] -> Step 3: [Decision]",
9641
+ "voiceGuide": "A concise but comprehensive voice and behavior guide that captures this expert's communication patterns, analytical approach, and how they leverage specialized knowledge in strategic discussions."
9598
9642
  }
9599
9643
 
9600
- Remember: This is specifically for ${name} as a top 1% expert in their field.`;
9644
+ Remember: This is an archetypal top 1% expert in ${expertiseText} \u2014 make them feel like the single most capable practitioner you could put in the room.`;
9601
9645
  }
9602
9646
  function buildNonFamousPrompt(name, title, expertiseText, currentPersona) {
9603
9647
  const personaContext = currentPersona ? `
9604
9648
 
9605
9649
  CURRENT PERSONA: ${currentPersona}` : "";
9606
- return `# IDENTITY LOCK: ${name}
9607
- You are creating both a detailed advisory board persona AND a voice guide specifically for ${name}, who is ${title}.
9650
+ return `# PERSONA LOCK: ${name}
9651
+ You are creating both a detailed advisory board persona AND a voice guide for an experienced, hands-on practitioner: a ${name} (${title}). This is a seasoned real-world professional \u2014 not a famous figure \u2014 valued for practical, battle-tested judgment in ${expertiseText}.
9608
9652
 
9609
9653
  ## CRITICAL REQUIREMENTS:
9610
- - This is ONLY for ${name} - do not create content for anyone else
9611
- - This is for a NON-FAMOUS professional with solid expertise but not widely recognized
9612
- - Focus on their practical experience and reliable expertise
9654
+ - Embody a credible, senior practitioner with deep practical experience in ${expertiseText}
9655
+ - Ground every trait in the day-to-day realities of the work, not theory or celebrity
9656
+ - Focus on practical, dependable expertise and collaborative judgment
9613
9657
 
9614
9658
  ## MEMBER CONTEXT:
9615
- - Name: ${name}
9616
- - Title: ${title}
9617
- - Expertise: ${expertiseText}
9618
- - Type: NON-FAMOUS professional${personaContext}
9659
+ - Persona: ${name}
9660
+ - Role: ${title}
9661
+ - Expertise / Domain: ${expertiseText}
9662
+ - Type: PRACTITIONER (experienced hands-on professional)${personaContext}
9619
9663
 
9620
9664
  ## TASK 1: ADVISORY BOARD PERSONA
9621
9665
  Generate a comprehensive advisory board persona that includes:
9622
9666
 
9623
- 1. **Professional Background**: Their career journey and key achievements
9667
+ 1. **Professional Background**: A credible career arc and the kind of hard-won experience this role accrues
9624
9668
  2. **Advisory Approach**: How they provide practical, grounded insights
9625
9669
  3. **Leadership Style**: Their collaborative and consensus-building approach
9626
- 4. **Problem-Solving**: Their methodical approach to challenges
9627
- 5. **Strategic Contributions**: What practical value they bring to discussions
9628
- 6. **Working Style**: How they interact with other board members
9670
+ 4. **Problem-Solving**: Their methodical, pragmatic approach to challenges
9671
+ 5. **Strategic Contributions**: The practical value they bring to discussions
9672
+ 6. **Psychometric Profile (BFI-2 Expanded)**: Generate 5-7 first-person 'I-statements' that define this practitioner's personality traits according to the Big Five framework (e.g., 'I am a person who is...'). This must replace generic adjectives to ensure precise behavioral simulation.
9673
+ 7. **Cognitive Architecture**: Define a strictly step-by-step internal reasoning process this practitioner uses. For example: 'First, check what actually ships. Second, weigh the operational cost. Third, pick the pragmatic option.' This creates the 'Reflective Meta-Prompting' layer
9629
9674
 
9630
9675
  ## TASK 2: VOICE & BEHAVIOR GUIDE
9631
9676
  Create a concise voice guide that captures:
9632
9677
  - Their practical communication style and collaborative approach
9633
- - How they leverage their expertise to provide grounded insights
9678
+ - How they leverage their experience to provide grounded insights
9634
9679
  - Their methodical problem-solving patterns
9635
9680
 
9636
9681
  ## OUTPUT FORMAT (CRITICAL):
9637
9682
  Return ONLY a raw JSON object with this exact structure. No markdown, no fences, no commentary. Start with \`{\` and end with \`}\`.
9638
9683
  {
9639
9684
  "persona": "A comprehensive 4-6 paragraph advisory board persona for ${name}, written in a professional manner that conveys competence, reliability, and practical expertise in ${expertiseText}.",
9685
+ "psychometricProfile": [
9686
+ "I am a person who is [Specific BFI-2 Trait for Openness]...",
9687
+ "I am a person who is [Specific BFI-2 Trait for Conscientiousness]..."
9688
+ ],
9689
+ "cognitiveProcess": "Step 1: [Analysis Style] -> Step 2: [Self-Critique/Reflection] -> Step 3: [Decision]",
9640
9690
  "voiceGuide": "A concise but comprehensive voice and behavior guide that captures ${name}'s practical communication style, collaborative approach, and methodical problem-solving patterns."
9641
9691
  }
9642
9692
 
9643
- Remember: This is specifically for ${name} as a solid, dependable professional.`;
9693
+ Remember: This is a solid, dependable senior practitioner \u2014 credible and grounded, not famous.`;
9644
9694
  }
9645
9695
  function extractEnhancement(response, name) {
9646
9696
  const parseResult = safeParseJSONWithSchema(response, enhancementPayloadSchema);
@@ -12809,6 +12859,90 @@ async function startUiServer(opts) {
12809
12859
  sendError(res, 500, error);
12810
12860
  }
12811
12861
  });
12862
+ app.post("/api/members/enhance-preview", async (req, res) => {
12863
+ let type;
12864
+ try {
12865
+ type = normalizeEnhanceTypeOrThrow((req.body ?? {}).type);
12866
+ } catch (err) {
12867
+ res.status(400).json({ error: err instanceof Error ? err.message : String(err) });
12868
+ return;
12869
+ }
12870
+ const body = req.body ?? {};
12871
+ let name;
12872
+ let title;
12873
+ let subject;
12874
+ let context;
12875
+ if (type === "famous") {
12876
+ name = (body.name ?? "").trim();
12877
+ title = (body.title ?? "").trim() || "Advisor";
12878
+ if (!name) {
12879
+ res.status(400).json({ error: "name is required for a well-known person" });
12880
+ return;
12881
+ }
12882
+ subject = name;
12883
+ context = title;
12884
+ } else if (type === "expert") {
12885
+ const field = (body.field ?? "").trim();
12886
+ if (!field) {
12887
+ res.status(400).json({ error: "field is required for a top 1% expert" });
12888
+ return;
12889
+ }
12890
+ name = `${field} Expert`;
12891
+ title = "Top 1% Expert";
12892
+ subject = field;
12893
+ context = void 0;
12894
+ } else {
12895
+ const role = (body.role ?? "").trim();
12896
+ const domain = (body.domain ?? "").trim();
12897
+ if (!role) {
12898
+ res.status(400).json({ error: "role is required for a practitioner" });
12899
+ return;
12900
+ }
12901
+ name = role;
12902
+ title = domain ? `${domain} practitioner` : "Practitioner";
12903
+ subject = role;
12904
+ context = domain || void 0;
12905
+ }
12906
+ const previewId = generateUUID();
12907
+ res.status(202).json({ accepted: true, previewId, name, title, type });
12908
+ broadcast({ type: "member_preview_started", previewId, name, enhanceType: type });
12909
+ (async () => {
12910
+ try {
12911
+ const settings = await opts.storage.loadSettings();
12912
+ broadcast({ type: "member_preview_progress", previewId, stage: "research" });
12913
+ const expertise = await researchExpertise({ subject, context, type }, settings);
12914
+ broadcast({ type: "member_preview_progress", previewId, stage: "persona" });
12915
+ const result = await enhancePersona(
12916
+ { name, title, expertise, type },
12917
+ settings,
12918
+ {
12919
+ onEvent: (event) => {
12920
+ if (event.type === "assistant" || event.type === "tool_use") {
12921
+ broadcast({ type: "member_preview_progress", previewId, stage: "persona", event: { type: event.type, subtype: event.subtype } });
12922
+ }
12923
+ }
12924
+ }
12925
+ );
12926
+ broadcast({
12927
+ type: "member_preview_done",
12928
+ previewId,
12929
+ result: {
12930
+ name,
12931
+ title,
12932
+ expertise,
12933
+ persona: result.persona,
12934
+ voiceGuide: result.voiceGuide
12935
+ }
12936
+ });
12937
+ } catch (error) {
12938
+ broadcast({
12939
+ type: "member_preview_failed",
12940
+ previewId,
12941
+ message: error instanceof Error ? error.message : String(error)
12942
+ });
12943
+ }
12944
+ })();
12945
+ });
12812
12946
  app.post("/api/members/:id/regenerate-voice", async (req, res) => {
12813
12947
  try {
12814
12948
  const all = await opts.storage.loadBoardMembers();