@integrity-labs/agt-cli 0.6.6 → 0.6.7

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);
@@ -2568,6 +2636,15 @@ var api = {
2568
2636
  });
2569
2637
  return handleResponse(res);
2570
2638
  },
2639
+ async patch(path, body) {
2640
+ const headers = await buildHeaders();
2641
+ const res = await fetch(`${requireHost()}${path}`, {
2642
+ method: "PATCH",
2643
+ headers,
2644
+ body: body !== void 0 ? JSON.stringify(body) : void 0
2645
+ });
2646
+ return handleResponse(res);
2647
+ },
2571
2648
  async put(path, body) {
2572
2649
  const headers = await buildHeaders();
2573
2650
  const res = await fetch(`${requireHost()}${path}`, {
@@ -2589,7 +2666,7 @@ async function getHostId() {
2589
2666
  }
2590
2667
 
2591
2668
  // ../../packages/core/dist/channels/resolver.js
2592
- function resolveChannels(agentPolicy, teamPolicy) {
2669
+ function resolveChannels(agentPolicy, orgPolicy) {
2593
2670
  let agentEffective;
2594
2671
  if (agentPolicy.policy === "allowlist") {
2595
2672
  agentEffective = new Set(agentPolicy.allowed);
@@ -2597,17 +2674,17 @@ function resolveChannels(agentPolicy, teamPolicy) {
2597
2674
  const denied = new Set(agentPolicy.denied);
2598
2675
  agentEffective = new Set(getAllChannelIds().filter((c) => !denied.has(c)));
2599
2676
  }
2600
- if (!teamPolicy) {
2677
+ if (!orgPolicy) {
2601
2678
  return [...agentEffective];
2602
2679
  }
2603
2680
  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)));
2681
+ if (orgPolicy.allowed_channels.length > 0) {
2682
+ const orgAllowed = new Set(orgPolicy.allowed_channels);
2683
+ result = new Set([...agentEffective].filter((c) => orgAllowed.has(c)));
2607
2684
  } else {
2608
2685
  result = agentEffective;
2609
2686
  }
2610
- for (const denied of teamPolicy.denied_channels) {
2687
+ for (const denied of orgPolicy.denied_channels) {
2611
2688
  result.delete(denied);
2612
2689
  }
2613
2690
  return [...result];
@@ -3834,7 +3911,7 @@ function runSemanticRules(file, charter) {
3834
3911
  }
3835
3912
 
3836
3913
  // ../../packages/core/dist/lint/rules/channel.js
3837
- function runChannelRules(charter, teamPolicy) {
3914
+ function runChannelRules(charter, orgPolicy) {
3838
3915
  const diagnostics = [];
3839
3916
  const channels = charter.channels;
3840
3917
  if (!channels)
@@ -3899,34 +3976,34 @@ function runChannelRules(charter, teamPolicy) {
3899
3976
  message: "Production agent uses denylist channel policy (prefer explicit allowlist for prod)"
3900
3977
  });
3901
3978
  }
3902
- if (teamPolicy) {
3979
+ if (orgPolicy) {
3903
3980
  const agentAllowed = channels.policy === "allowlist" ? channels.allowed ?? [] : [];
3904
3981
  for (const channelId of agentAllowed) {
3905
- if (teamPolicy.denied_channels.includes(channelId)) {
3982
+ if (orgPolicy.denied_channels.includes(channelId)) {
3906
3983
  diagnostics.push({
3907
3984
  file: "CHARTER.md",
3908
3985
  code: "CHARTER.CHANNELS.TEAM_CONFLICT",
3909
3986
  path: `channels.allowed`,
3910
3987
  severity: "error",
3911
- message: `Agent allows "${channelId}" but it is denied at team level`
3988
+ message: `Agent allows "${channelId}" but it is denied at org level`
3912
3989
  });
3913
3990
  }
3914
3991
  }
3915
- if (teamPolicy.allowed_channels.length > 0) {
3916
- const teamAllowed = new Set(teamPolicy.allowed_channels);
3992
+ if (orgPolicy.allowed_channels.length > 0) {
3993
+ const orgAllowed = new Set(orgPolicy.allowed_channels);
3917
3994
  for (const channelId of agentAllowed) {
3918
- if (!teamAllowed.has(channelId)) {
3995
+ if (!orgAllowed.has(channelId)) {
3919
3996
  diagnostics.push({
3920
3997
  file: "CHARTER.md",
3921
3998
  code: "CHARTER.CHANNELS.TEAM_CONFLICT",
3922
3999
  path: `channels.allowed`,
3923
4000
  severity: "error",
3924
- message: `Agent allows "${channelId}" but it is not in the team allowlist`
4001
+ message: `Agent allows "${channelId}" but it is not in the org allowlist`
3925
4002
  });
3926
4003
  }
3927
4004
  }
3928
4005
  }
3929
- if (teamPolicy.require_elevated_for_pii && charter.risk_tier === "High") {
4006
+ if (orgPolicy.require_elevated_for_pii && charter.risk_tier === "High") {
3930
4007
  const effectiveChannels = channels.policy === "allowlist" ? channels.allowed ?? [] : [];
3931
4008
  for (const channelId of effectiveChannels) {
3932
4009
  const ch = getChannel(channelId);
@@ -3936,7 +4013,7 @@ function runChannelRules(charter, teamPolicy) {
3936
4013
  code: "CHARTER.CHANNELS.PII_ON_LIMITED",
3937
4014
  path: `channels.allowed`,
3938
4015
  severity: "error",
3939
- message: `Team requires elevated channels for PII agents, but "${channelId}" is "${ch.securityTier}"-tier`
4016
+ message: `Org requires elevated channels for PII agents, but "${channelId}" is "${ch.securityTier}"-tier`
3940
4017
  });
3941
4018
  }
3942
4019
  }
@@ -4024,7 +4101,7 @@ function lintCharter(content, ctx = {}) {
4024
4101
  }
4025
4102
  if (schemaResult.valid && schemaResult.data) {
4026
4103
  diagnostics.push(...runSemanticRules("CHARTER.md", schemaResult.data));
4027
- diagnostics.push(...runChannelRules(schemaResult.data, ctx.teamChannelPolicy));
4104
+ diagnostics.push(...runChannelRules(schemaResult.data, ctx.orgChannelPolicy));
4028
4105
  }
4029
4106
  return buildResult(diagnostics);
4030
4107
  }
@@ -4459,6 +4536,7 @@ export {
4459
4536
  AGT_HOST,
4460
4537
  requireHost,
4461
4538
  exchangeApiKey,
4539
+ ApiError,
4462
4540
  api,
4463
4541
  getHostId,
4464
4542
  resolveChannels,
@@ -4482,4 +4560,4 @@ export {
4482
4560
  detectDrift,
4483
4561
  provision
4484
4562
  };
4485
- //# sourceMappingURL=chunk-EUF2V4N5.js.map
4563
+ //# sourceMappingURL=chunk-UIWXBJSX.js.map