majlis 0.2.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/cli.js +63 -12
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -564,9 +564,8 @@ Rules:
564
564
  - Every doubt MUST reference evidence. "This feels wrong" is not a doubt.
565
565
  - You may NOT suggest fixes. Identify problems only.
566
566
  - Focus on judgment and analogy-level decisions first.
567
- - You may NOT modify any files. Produce a doubt document only.
568
-
569
- Write to docs/doubts/NNN-against-experiment-NNN.md
567
+ - You may NOT modify any files. Produce your doubt document as output only.
568
+ - Do NOT attempt to write files. The framework saves your output automatically.
570
569
 
571
570
  ## Structured Output Format
572
571
  <!-- majlis-json
@@ -592,9 +591,8 @@ For each approach the builder takes, ask:
592
591
  - Under what conditions do two things the builder treats as distinct become identical?
593
592
 
594
593
  Produce constructed counterexamples with reasoning.
595
- Do NOT suggest fixes. Do NOT modify files.
596
-
597
- Write to docs/challenges/NNN-against-experiment-NNN.md
594
+ Do NOT suggest fixes. Do NOT modify files. Do NOT attempt to write files.
595
+ The framework saves your output automatically.
598
596
 
599
597
  ## Structured Output Format
600
598
  <!-- majlis-json
@@ -624,7 +622,7 @@ CONTENT CHECK:
624
622
  Grade each component: sound / good / weak / rejected
625
623
  Grade each doubt/challenge: confirmed / dismissed (with evidence) / inconclusive
626
624
 
627
- Write to docs/verification/NNN-for-experiment-NNN.md
625
+ Produce your verification report as output. The framework saves it automatically.
628
626
 
629
627
  ## Structured Output Format
630
628
  <!-- majlis-json
@@ -658,7 +656,8 @@ Independently propose:
658
656
  Compare your decomposition with the existing classification.
659
657
  Flag structural divergences \u2014 these are the most valuable signals.
660
658
 
661
- Write to docs/reframes/NNN.md`,
659
+ Produce your reframe document as output. Do NOT attempt to write files.
660
+ The framework saves your output automatically.`,
662
661
  compressor: `---
663
662
  name: compressor
664
663
  model: opus
@@ -705,9 +704,8 @@ For the given experiment:
705
704
  Rules:
706
705
  - Present findings neutrally. Report each approach on its own terms.
707
706
  - Note where external approaches contradict the current one \u2014 these are the most valuable signals.
708
- - You may NOT modify code or make decisions. Produce a rihla document only.
709
-
710
- Write to docs/rihla/NNN-scout-for-experiment-NNN.md
707
+ - You may NOT modify code or make decisions. Produce your rihla document as output only.
708
+ - Do NOT attempt to write files. The framework saves your output automatically.
711
709
 
712
710
  ## Structured Output Format
713
711
  <!-- majlis-json
@@ -2058,6 +2056,9 @@ function determineNextStep(exp, valid, hasDoubts2, hasChallenges2) {
2058
2056
  throw new Error(`Experiment ${exp.slug} is terminal (${exp.status})`);
2059
2057
  }
2060
2058
  const status2 = exp.status;
2059
+ if (status2 === "classified" /* CLASSIFIED */) {
2060
+ return valid.includes("building" /* BUILDING */) ? "building" /* BUILDING */ : valid[0];
2061
+ }
2061
2062
  if (status2 === "built" /* BUILT */ && !hasDoubts2) {
2062
2063
  return valid.includes("doubted" /* DOUBTED */) ? "doubted" /* DOUBTED */ : valid[0];
2063
2064
  }
@@ -2329,13 +2330,36 @@ async function runQuery(opts) {
2329
2330
  });
2330
2331
  const textParts = [];
2331
2332
  let costUsd = 0;
2333
+ let turnCount = 0;
2332
2334
  for await (const message of conversation) {
2333
2335
  if (message.type === "assistant") {
2336
+ turnCount++;
2337
+ let hasText = false;
2334
2338
  for (const block of message.message.content) {
2335
2339
  if (block.type === "text") {
2336
2340
  textParts.push(block.text);
2341
+ hasText = true;
2342
+ } else if (block.type === "tool_use") {
2343
+ const toolName = block.name ?? "tool";
2344
+ const input = block.input ?? {};
2345
+ const detail = formatToolDetail(toolName, input);
2346
+ process.stderr.write(`${DIM2}[majlis] ${CYAN2}${toolName}${RESET2}${DIM2}${detail}${RESET2}
2347
+ `);
2348
+ }
2349
+ }
2350
+ if (hasText) {
2351
+ const preview = textParts[textParts.length - 1].slice(0, 120).replace(/\n/g, " ").trim();
2352
+ if (preview) {
2353
+ process.stderr.write(`${DIM2}[majlis] writing: ${preview}${preview.length >= 120 ? "..." : ""}${RESET2}
2354
+ `);
2337
2355
  }
2338
2356
  }
2357
+ } else if (message.type === "tool_progress") {
2358
+ const elapsed = Math.round(message.elapsed_time_seconds);
2359
+ if (elapsed > 0 && elapsed % 5 === 0) {
2360
+ process.stderr.write(`${DIM2}[majlis] ${message.tool_name} running (${elapsed}s)...${RESET2}
2361
+ `);
2362
+ }
2339
2363
  } else if (message.type === "result") {
2340
2364
  if (message.subtype === "success") {
2341
2365
  costUsd = message.total_cost_usd;
@@ -2347,6 +2371,26 @@ async function runQuery(opts) {
2347
2371
  }
2348
2372
  return { text: textParts.join("\n\n"), costUsd };
2349
2373
  }
2374
+ function formatToolDetail(toolName, input) {
2375
+ switch (toolName) {
2376
+ case "Read":
2377
+ return input.file_path ? ` ${input.file_path}` : "";
2378
+ case "Write":
2379
+ return input.file_path ? ` \u2192 ${input.file_path}` : "";
2380
+ case "Edit":
2381
+ return input.file_path ? ` ${input.file_path}` : "";
2382
+ case "Glob":
2383
+ return input.pattern ? ` ${input.pattern}` : "";
2384
+ case "Grep":
2385
+ return input.pattern ? ` /${input.pattern}/` : "";
2386
+ case "Bash":
2387
+ return input.command ? ` $ ${input.command.slice(0, 80)}` : "";
2388
+ case "WebSearch":
2389
+ return input.query ? ` "${input.query}"` : "";
2390
+ default:
2391
+ return "";
2392
+ }
2393
+ }
2350
2394
  function writeArtifact(role, context, markdown, projectRoot) {
2351
2395
  const dirMap = {
2352
2396
  builder: "docs/experiments",
@@ -2376,7 +2420,7 @@ function writeArtifact(role, context, markdown, projectRoot) {
2376
2420
  fs7.writeFileSync(target, markdown);
2377
2421
  return target;
2378
2422
  }
2379
- var fs7, path7, import_claude_agent_sdk2;
2423
+ var fs7, path7, import_claude_agent_sdk2, DIM2, RESET2, CYAN2;
2380
2424
  var init_spawn = __esm({
2381
2425
  "src/agents/spawn.ts"() {
2382
2426
  "use strict";
@@ -2385,6 +2429,9 @@ var init_spawn = __esm({
2385
2429
  import_claude_agent_sdk2 = require("@anthropic-ai/claude-agent-sdk");
2386
2430
  init_parse();
2387
2431
  init_connection();
2432
+ DIM2 = "\x1B[2m";
2433
+ RESET2 = "\x1B[0m";
2434
+ CYAN2 = "\x1B[36m";
2388
2435
  }
2389
2436
  });
2390
2437
 
@@ -3049,6 +3096,10 @@ async function executeStep(step, exp, root) {
3049
3096
  case "compressed" /* COMPRESSED */:
3050
3097
  await cycle("compress", []);
3051
3098
  break;
3099
+ case "reframed" /* REFRAMED */:
3100
+ updateExperimentStatus(getDb(root), exp.id, "reframed");
3101
+ info(`Reframe acknowledged for ${exp.slug}. Proceeding to build.`);
3102
+ break;
3052
3103
  default:
3053
3104
  warn(`Don't know how to execute step: ${step}`);
3054
3105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "majlis",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Multi-agent workflow CLI for structured doubt, independent verification, and compressed knowledge",
5
5
  "bin": {
6
6
  "majlis": "./dist/cli.js"