@integrity-labs/agt-cli 0.6.6 → 0.6.8

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.
@@ -1805,12 +1805,74 @@ import { join as join3, relative } from "path";
1805
1805
  import { homedir as homedir2 } from "os";
1806
1806
 
1807
1807
  // ../../packages/core/dist/provisioning/frameworks/claudecode/identity.js
1808
+ function buildMemorySection(hasQmd) {
1809
+ const recall = hasQmd ? `### Recall
1810
+
1811
+ Before answering questions about past work, decisions, or preferences, **search
1812
+ memory first** using the QMD MCP tools:
1813
+
1814
+ - **qmd:search** \u2014 semantic + keyword search across all memory files. Use this
1815
+ as your primary recall mechanism. Prefer this over reading files directly.
1816
+ - **qmd:get** \u2014 read a specific memory file by path when you already know which
1817
+ file you need.
1818
+
1819
+ If QMD returns no results, fall back to reading \`MEMORY.md\` and today's daily log directly.
1820
+ ` : `### Recall
1821
+
1822
+ Before answering questions about past work, decisions, or preferences, read
1823
+ \`MEMORY.md\` and today's daily log (\`memory/YYYY-MM-DD.md\`) to refresh your context.
1824
+ `;
1825
+ return `## Memory
1826
+
1827
+ You have a file-based memory system. Use it to persist important information
1828
+ across conversations so future sessions have full context.
1829
+
1830
+ ### Storage
1831
+
1832
+ Two types of memory files, both plain Markdown:
1833
+
1834
+ 1. **Daily logs** (\`memory/YYYY-MM-DD.md\`): Append-only operational notes for
1835
+ the current day. Record what you worked on, decisions made, blockers hit,
1836
+ and outcomes. Create a new file each day using today's date.
1837
+
1838
+ 2. **Long-term memory** (\`MEMORY.md\`): Curated persistent information \u2014
1839
+ decisions, preferences, architectural context, team conventions, and anything
1840
+ that should survive beyond a single day. Keep this file organized by topic,
1841
+ not chronologically.
1842
+
1843
+ ### What to remember
1844
+
1845
+ - **Always save** when the user says "remember this" or similar
1846
+ - **Proactively save** decisions, preferences, non-obvious conventions,
1847
+ corrections to your approach, and important outcomes
1848
+ - **Daily logs**: what you worked on, key decisions, blockers, results
1849
+ - **Long-term**: user preferences, project conventions, architectural decisions,
1850
+ team context, recurring patterns
1851
+
1852
+ ### What NOT to save
1853
+
1854
+ - Code patterns derivable from reading the codebase
1855
+ - Git history (use \`git log\` / \`git blame\`)
1856
+ - Ephemeral task details only relevant to the current conversation
1857
+ - Information already in CHARTER.md, TOOLS.md, or other governed docs
1858
+
1859
+ ### Writing memories
1860
+
1861
+ - For daily logs: append to \`memory/YYYY-MM-DD.md\` (create if it doesn't exist)
1862
+ - For long-term: update \`MEMORY.md\`, organizing by topic. Update or remove
1863
+ stale entries rather than just appending.
1864
+ - Before the conversation context compresses, review what you've learned and
1865
+ save anything important to the appropriate memory file.
1866
+
1867
+ ${recall}`;
1868
+ }
1808
1869
  function generateClaudeMd(input) {
1809
- const { frontmatter, role, description, resolvedChannels, team, consoleUrl } = input;
1870
+ const { frontmatter, role, description, resolvedChannels, team, consoleUrl, hasQmd } = input;
1810
1871
  const channelList = resolvedChannels?.length ? resolvedChannels.join(", ") : "none";
1811
1872
  const roleDisplay = role ?? "Agent";
1812
1873
  const desc = description?.trim();
1813
1874
  const kanbanUrl = consoleUrl ? `${consoleUrl}/agents/${frontmatter.agent_id}?tab=kanban` : null;
1875
+ const memorySection = buildMemorySection(hasQmd);
1814
1876
  return `# ${frontmatter.display_name}
1815
1877
 
1816
1878
  You are **${frontmatter.display_name}**, **${roleDisplay}**${team ? ` at **${team.name}**` : ""}.
@@ -1852,6 +1914,7 @@ When asked about existing work, tasks, or what you've been doing \u2014 call kan
1852
1914
  first to load your recent board state. This gives you context about completed and
1853
1915
  in-progress items so you can answer accurately.
1854
1916
 
1917
+ ${memorySection}
1855
1918
  ## Rules
1856
1919
 
1857
1920
  - Never expose secrets or API keys in output.
@@ -2049,7 +2112,8 @@ var claudeCodeAdapter = {
2049
2112
  description: input.agent.description,
2050
2113
  resolvedChannels: input.resolvedChannels,
2051
2114
  team: input.team,
2052
- consoleUrl: process.env["NEXT_PUBLIC_APP_URL"] || process.env["AGT_CONSOLE_URL"] || void 0
2115
+ consoleUrl: process.env["NEXT_PUBLIC_APP_URL"] || process.env["AGT_CONSOLE_URL"] || void 0,
2116
+ hasQmd: input.integrations?.some((i) => i.definition_id === "qmd") ?? false
2053
2117
  };
2054
2118
  return [
2055
2119
  { relativePath: "CLAUDE.md", content: generateClaudeMd(claudeMdInput) },
@@ -2332,6 +2396,10 @@ var claudeCodeAdapter = {
2332
2396
  writeFileSync3(envPath, envLines.join("\n") + "\n");
2333
2397
  chmodSync3(envPath, SECRET_FILE_MODE);
2334
2398
  }
2399
+ const hasQmd = integrations.some((i) => i.definition_id === "qmd");
2400
+ if (hasQmd) {
2401
+ this.writeMcpServer(codeName, "qmd", { command: "qmd", args: ["mcp"] });
2402
+ }
2335
2403
  },
2336
2404
  writeMcpServer(codeName, serverId, config) {
2337
2405
  const agentDir = getAgentDir(codeName);
@@ -2459,10 +2527,11 @@ function setActiveTeam(slug) {
2459
2527
  }
2460
2528
  var AGT_HOST = process.env["AGT_HOST"];
2461
2529
  function requireHost() {
2462
- if (!AGT_HOST) {
2530
+ const host = process.env["AGT_HOST"];
2531
+ if (!host) {
2463
2532
  throw new Error("AGT_HOST is not set. Export it to point at the Augmented API (e.g. export AGT_HOST=https://your-api.example.com)");
2464
2533
  }
2465
- return AGT_HOST;
2534
+ return host;
2466
2535
  }
2467
2536
 
2468
2537
  // src/lib/api-client.ts
@@ -2568,6 +2637,15 @@ var api = {
2568
2637
  });
2569
2638
  return handleResponse(res);
2570
2639
  },
2640
+ async patch(path, body) {
2641
+ const headers = await buildHeaders();
2642
+ const res = await fetch(`${requireHost()}${path}`, {
2643
+ method: "PATCH",
2644
+ headers,
2645
+ body: body !== void 0 ? JSON.stringify(body) : void 0
2646
+ });
2647
+ return handleResponse(res);
2648
+ },
2571
2649
  async put(path, body) {
2572
2650
  const headers = await buildHeaders();
2573
2651
  const res = await fetch(`${requireHost()}${path}`, {
@@ -2589,7 +2667,7 @@ async function getHostId() {
2589
2667
  }
2590
2668
 
2591
2669
  // ../../packages/core/dist/channels/resolver.js
2592
- function resolveChannels(agentPolicy, teamPolicy) {
2670
+ function resolveChannels(agentPolicy, orgPolicy) {
2593
2671
  let agentEffective;
2594
2672
  if (agentPolicy.policy === "allowlist") {
2595
2673
  agentEffective = new Set(agentPolicy.allowed);
@@ -2597,17 +2675,17 @@ function resolveChannels(agentPolicy, teamPolicy) {
2597
2675
  const denied = new Set(agentPolicy.denied);
2598
2676
  agentEffective = new Set(getAllChannelIds().filter((c) => !denied.has(c)));
2599
2677
  }
2600
- if (!teamPolicy) {
2678
+ if (!orgPolicy) {
2601
2679
  return [...agentEffective];
2602
2680
  }
2603
2681
  let result;
2604
- if (teamPolicy.allowed_channels.length > 0) {
2605
- const teamAllowed = new Set(teamPolicy.allowed_channels);
2606
- result = new Set([...agentEffective].filter((c) => teamAllowed.has(c)));
2682
+ if (orgPolicy.allowed_channels.length > 0) {
2683
+ const orgAllowed = new Set(orgPolicy.allowed_channels);
2684
+ result = new Set([...agentEffective].filter((c) => orgAllowed.has(c)));
2607
2685
  } else {
2608
2686
  result = agentEffective;
2609
2687
  }
2610
- for (const denied of teamPolicy.denied_channels) {
2688
+ for (const denied of orgPolicy.denied_channels) {
2611
2689
  result.delete(denied);
2612
2690
  }
2613
2691
  return [...result];
@@ -3834,7 +3912,7 @@ function runSemanticRules(file, charter) {
3834
3912
  }
3835
3913
 
3836
3914
  // ../../packages/core/dist/lint/rules/channel.js
3837
- function runChannelRules(charter, teamPolicy) {
3915
+ function runChannelRules(charter, orgPolicy) {
3838
3916
  const diagnostics = [];
3839
3917
  const channels = charter.channels;
3840
3918
  if (!channels)
@@ -3899,34 +3977,34 @@ function runChannelRules(charter, teamPolicy) {
3899
3977
  message: "Production agent uses denylist channel policy (prefer explicit allowlist for prod)"
3900
3978
  });
3901
3979
  }
3902
- if (teamPolicy) {
3980
+ if (orgPolicy) {
3903
3981
  const agentAllowed = channels.policy === "allowlist" ? channels.allowed ?? [] : [];
3904
3982
  for (const channelId of agentAllowed) {
3905
- if (teamPolicy.denied_channels.includes(channelId)) {
3983
+ if (orgPolicy.denied_channels.includes(channelId)) {
3906
3984
  diagnostics.push({
3907
3985
  file: "CHARTER.md",
3908
3986
  code: "CHARTER.CHANNELS.TEAM_CONFLICT",
3909
3987
  path: `channels.allowed`,
3910
3988
  severity: "error",
3911
- message: `Agent allows "${channelId}" but it is denied at team level`
3989
+ message: `Agent allows "${channelId}" but it is denied at org level`
3912
3990
  });
3913
3991
  }
3914
3992
  }
3915
- if (teamPolicy.allowed_channels.length > 0) {
3916
- const teamAllowed = new Set(teamPolicy.allowed_channels);
3993
+ if (orgPolicy.allowed_channels.length > 0) {
3994
+ const orgAllowed = new Set(orgPolicy.allowed_channels);
3917
3995
  for (const channelId of agentAllowed) {
3918
- if (!teamAllowed.has(channelId)) {
3996
+ if (!orgAllowed.has(channelId)) {
3919
3997
  diagnostics.push({
3920
3998
  file: "CHARTER.md",
3921
3999
  code: "CHARTER.CHANNELS.TEAM_CONFLICT",
3922
4000
  path: `channels.allowed`,
3923
4001
  severity: "error",
3924
- message: `Agent allows "${channelId}" but it is not in the team allowlist`
4002
+ message: `Agent allows "${channelId}" but it is not in the org allowlist`
3925
4003
  });
3926
4004
  }
3927
4005
  }
3928
4006
  }
3929
- if (teamPolicy.require_elevated_for_pii && charter.risk_tier === "High") {
4007
+ if (orgPolicy.require_elevated_for_pii && charter.risk_tier === "High") {
3930
4008
  const effectiveChannels = channels.policy === "allowlist" ? channels.allowed ?? [] : [];
3931
4009
  for (const channelId of effectiveChannels) {
3932
4010
  const ch = getChannel(channelId);
@@ -3936,7 +4014,7 @@ function runChannelRules(charter, teamPolicy) {
3936
4014
  code: "CHARTER.CHANNELS.PII_ON_LIMITED",
3937
4015
  path: `channels.allowed`,
3938
4016
  severity: "error",
3939
- message: `Team requires elevated channels for PII agents, but "${channelId}" is "${ch.securityTier}"-tier`
4017
+ message: `Org requires elevated channels for PII agents, but "${channelId}" is "${ch.securityTier}"-tier`
3940
4018
  });
3941
4019
  }
3942
4020
  }
@@ -4024,7 +4102,7 @@ function lintCharter(content, ctx = {}) {
4024
4102
  }
4025
4103
  if (schemaResult.valid && schemaResult.data) {
4026
4104
  diagnostics.push(...runSemanticRules("CHARTER.md", schemaResult.data));
4027
- diagnostics.push(...runChannelRules(schemaResult.data, ctx.teamChannelPolicy));
4105
+ diagnostics.push(...runChannelRules(schemaResult.data, ctx.orgChannelPolicy));
4028
4106
  }
4029
4107
  return buildResult(diagnostics);
4030
4108
  }
@@ -4459,6 +4537,7 @@ export {
4459
4537
  AGT_HOST,
4460
4538
  requireHost,
4461
4539
  exchangeApiKey,
4540
+ ApiError,
4462
4541
  api,
4463
4542
  getHostId,
4464
4543
  resolveChannels,
@@ -4482,4 +4561,4 @@ export {
4482
4561
  detectDrift,
4483
4562
  provision
4484
4563
  };
4485
- //# sourceMappingURL=chunk-EUF2V4N5.js.map
4564
+ //# sourceMappingURL=chunk-W3QGXFSK.js.map