@ghl-ai/aw 0.1.39-beta.13 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/render-rules.mjs +53 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.39-beta.13",
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
@@ -322,9 +322,62 @@ function renderCursorRules(cwd, rulesDir, options = {}) {
322
322
  writeFileSync(join(cursorRulesDir, 'common-aw-routing.mdc'), routingRule);
323
323
  count++;
324
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
+
325
331
  return count;
326
332
  }
327
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
+
328
381
  function generateCursorAwRoutingRule() {
329
382
  // Frontmatter MUST be at byte 0 for Cursor's alwaysApply/globs detection.
330
383
  return `---