@ghl-ai/aw 0.1.39-beta.12 → 0.1.39-beta.14

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/ecc.mjs CHANGED
@@ -10,7 +10,7 @@ import { applyStoredStartupPreferences } from "./startup.mjs";
10
10
 
11
11
  const AW_ECC_REPO_SSH = "git@github.com:shreyansh-ghl/aw-ecc.git";
12
12
  const AW_ECC_REPO_HTTPS = "https://github.com/shreyansh-ghl/aw-ecc.git";
13
- export const AW_ECC_TAG = "v1.4.36";
13
+ export const AW_ECC_TAG = "v1.4.37";
14
14
 
15
15
  const MARKETPLACE_NAME = "aw-marketplace";
16
16
  const PLUGIN_KEY = `aw@${MARKETPLACE_NAME}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.39-beta.12",
3
+ "version": "0.1.39-beta.14",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {
package/render-rules.mjs CHANGED
@@ -6,7 +6,12 @@ import { homedir } from 'node:os';
6
6
  import * as fmt from './fmt.mjs';
7
7
  import { RULES_RUNTIME_DIR } from './constants.mjs';
8
8
 
9
- const GENERATED_HEADER = '<!-- Generated by aw do not edit manually -->\n\n';
9
+ // The marker is placed AFTER the YAML frontmatter so Cursor/Markdown parsers
10
+ // see the frontmatter at byte 0. Putting an HTML comment before --- breaks
11
+ // Cursor's alwaysApply/globs detection.
12
+ const GENERATED_MARKER = '<!-- Generated by aw — do not edit manually -->';
13
+ // Legacy header (pre-pattern comment first) — kept for pruning old files.
14
+ const LEGACY_GENERATED_HEADER = '<!-- Generated by aw — do not edit manually -->\n\n';
10
15
  const STACK_OVERLAY_FLAG = 'AW_ENABLE_STACK_OVERLAY_RULES';
11
16
 
12
17
  /** Rule scope → Cursor .mdc glob patterns */
@@ -196,7 +201,8 @@ function pruneStaleGeneratedRules(outputDir, expectedFilenames) {
196
201
 
197
202
  const fullPath = join(outputDir, entry.name);
198
203
  const content = readOrNull(fullPath);
199
- if (!content?.startsWith(GENERATED_HEADER)) continue;
204
+ // Match both new pattern (marker after frontmatter) and legacy (marker at top).
205
+ if (!content || (!content.includes(GENERATED_MARKER) && !content.startsWith(LEGACY_GENERATED_HEADER))) continue;
200
206
 
201
207
  try {
202
208
  unlinkSync(fullPath);
@@ -303,7 +309,9 @@ function renderCursorRules(cwd, rulesDir, options = {}) {
303
309
  }
304
310
  }
305
311
 
306
- const content = GENERATED_HEADER + frontmatter.join('\n') + '\n\n' + agentsMd.trim() + '\n' + refSection;
312
+ // Frontmatter MUST be at byte 0 for Cursor's YAML parser.
313
+ // Generated marker goes on the line immediately after the closing ---.
314
+ const content = frontmatter.join('\n') + '\n' + GENERATED_MARKER + '\n\n' + agentsMd.trim() + '\n' + refSection;
307
315
  writeFileSync(join(cursorRulesDir, `${scopeToFilename(scope)}.mdc`), content);
308
316
  count++;
309
317
  }
@@ -314,14 +322,70 @@ function renderCursorRules(cwd, rulesDir, options = {}) {
314
322
  writeFileSync(join(cursorRulesDir, 'common-aw-routing.mdc'), routingRule);
315
323
  count++;
316
324
 
325
+ // Generate the prompt-response-format rule — machine-parseable trace
326
+ // of what skills/rules/MCPs were used during a response.
327
+ const traceRule = generateCursorPromptTraceRule();
328
+ writeFileSync(join(cursorRulesDir, 'common-prompt-trace.mdc'), traceRule);
329
+ count++;
330
+
317
331
  return count;
318
332
  }
319
333
 
334
+ function generateCursorPromptTraceRule() {
335
+ // Frontmatter MUST be at byte 0. Machine-parseable JSON block at end of response.
336
+ return `---
337
+ description: "Append a machine-parseable AW trace at the end of every response"
338
+ alwaysApply: true
339
+ ---
340
+ ${GENERATED_MARKER}
341
+
342
+ # AW Prompt Trace
343
+
344
+ At the end of every substantive response, append a JSON-fenced block named \`aw-trace\` with the skills, rules, and MCPs that were loaded or applied during the response.
345
+
346
+ ## Format
347
+
348
+ \`\`\`aw-trace
349
+ {
350
+ "route": "/aw-plan",
351
+ "skills_used": ["using-aw-skills", "aw-plan", "incremental-implementation"],
352
+ "rules_applied": ["common-aw-routing", "universal", "security", "backend"],
353
+ "mcps_used": ["context7", "exa-search"],
354
+ "artifacts_written": [".aw_docs/features/<slug>/spec.md"]
355
+ }
356
+ \`\`\`
357
+
358
+ ## Field semantics
359
+
360
+ | Field | Type | Required | Notes |
361
+ |---|---|---|---|
362
+ | \`route\` | string | yes | Selected AW route (e.g. \`/aw-plan\`, \`/aw-build\`) |
363
+ | \`skills_used\` | string[] | yes | Skill names actually Read during the response. \`[]\` if none |
364
+ | \`rules_applied\` | string[] | yes | Rule names from \`~/.cursor/rules/*.mdc\` or \`~/.aw_rules/\` that informed the response |
365
+ | \`mcps_used\` | string[] | yes | MCP server names invoked. \`[]\` if none |
366
+ | \`artifacts_written\` | string[] | optional | Files created or modified |
367
+
368
+ ## Rules
369
+
370
+ - Always include the trace block — even for trivial responses (use \`[]\` for empty arrays).
371
+ - Skill and rule names must match the on-disk basenames (no \`.mdc\` / \`.md\` extension).
372
+ - The trace goes AFTER the substantive response, never before.
373
+ - Do not include skills/rules that were merely "available" — only those that actually influenced this response.
374
+
375
+ ## Why
376
+
377
+ This makes routing observable. Tools, audits, and compliance checks can parse the trace JSON to verify that the right AW routing happened (route selected → stage skill loaded → relevant rules applied) without scraping prose.
378
+ `;
379
+ }
380
+
320
381
  function generateCursorAwRoutingRule() {
321
- return `${GENERATED_HEADER}---
382
+ // Frontmatter MUST be at byte 0 for Cursor's alwaysApply/globs detection.
383
+ return `---
322
384
  description: "AW global routing: select route, READ stage skill, then respond"
323
385
  alwaysApply: true
324
386
  ---
387
+ ${GENERATED_MARKER}
388
+
325
389
  # AW Global Routing
326
390
 
327
391
  ## Hard Gate (MUST — do not skip)
@@ -460,7 +524,8 @@ function renderClaudeRules(cwd, rulesDir, options = {}) {
460
524
  }
461
525
  }
462
526
 
463
- const content = GENERATED_HEADER + frontmatter + agentsMd.trim() + '\n' + refSection;
527
+ // Claude Code reads .md frontmatter similarly keep marker after frontmatter.
528
+ const content = frontmatter + GENERATED_MARKER + '\n\n' + agentsMd.trim() + '\n' + refSection;
464
529
  writeFileSync(join(claudeRulesDir, `${scopeToFilename(scope)}.md`), content);
465
530
  count++;
466
531
  }