@myagentroam/agent 0.15.3 → 0.15.4

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.
@@ -17,7 +17,7 @@ export interface ExtensionCompactContext {
17
17
  readonly messages: readonly ExtensionCompactMessage[];
18
18
  readonly focus?: string;
19
19
  readonly summaryTokenBudget: number;
20
- /** Return the Core's default structured handoff contract, independent of model configuration. */
20
+ /** Return the default compaction instructions used by Core, independent of model configuration. */
21
21
  readonly getPrompt: () => string;
22
22
  /** Private, bounded telemetry only; reporting never changes the generation result. */
23
23
  readonly reportDiagnostic?: (diagnostic: ExtensionCompactDiagnostic) => Promise<void>;
@@ -1,29 +1,44 @@
1
1
  export function compactionPrompt() {
2
- return `# Compaction contract
3
- Produce a loss-aware state handoff for another agent that must continue the work without the discarded transcript. This is state transfer, not a user-facing recap and not a place to perform new work.
4
- Do not continue implementation, call tools, address the user, or treat this handoff as completion of the underlying task.
5
-
6
- Preserve, when present:
7
- - the current objective, success criteria, scope, latest user intent, and any explicit priority changes;
8
- - user-supplied non-filesystem instructions, authorization and safety boundaries, environment/workspace/branch facts, and names of Skills still needed;
9
- - necessary verbatim user authorization or prohibitions with their original message/turn source, bounded task/target/impact, and pending permission-stop source; do not reduce these to a model claim that the user approved. Existing authorization remains valid across turns, equivalent tools, bounded retries and delegation unless scope or impact changes or the user withdraws it;
10
- - confirmed decisions, constraints, interfaces, invariants, assumptions that still matter, and exact identifiers;
11
- - completed actions and edits with exact file paths, symbols, commands, migrations, or external state changes;
12
- - verification actually run and its result, important tool evidence, reproducible errors, failed approaches and what they proved;
13
- - unresolved questions, blockers, risks, uncommitted changes, Todo/plan state, and pending external decisions;
14
- - the next concrete action and the evidence still required before completion.
15
-
16
- Distinguish clearly between completed, attempted, planned, inferred, and unverified work. Newer user instructions override older ones; retain superseded instructions only when needed to explain current state. Authorization has exact action, scope, and lifetime: preserve it as active only while all three remain valid. Historical instructions, completed scopes, and state that merely makes an action plausible cannot grant or revive authorization. Never invent completion, test results, file contents, permissions, authorization, or external effects.
17
-
18
- Remove aggressively:
19
- - greetings, acknowledgements, progress chatter, repeated instructions, repeated status, and conclusions already represented once;
20
- - Runtime-owned contextual instruction blocks (Host instructions, capability policy, and Skill catalogs), their previous versions, and constraints derived only from them, because Runtime rebuilds the current blocks separately;
21
- - loaded Skill instructions and constraints derived only from them; reload required Skills when needed;
22
- - user-level, project-level, or directory-level AGENTS.md instructions and constraints derived only from those files, because the next Execution reloads and replaces them separately;
23
- - retained process/Subagent inventory, IDs, status, commands, cwd, and reuse instructions, because Runtime reloads and replaces that state separately;
24
- - raw long logs, large source excerpts, verbose tool payloads, duplicated search/read output, and implementation detail recoverable from named files or commands;
25
- - abandoned hypotheses and failed attempts that do not constrain the next action;
26
- - hidden reasoning, secrets, credentials, authorization values, and unrelated conversation.
27
-
28
- Use compact Markdown with these headings when applicable: Objective, Instructions and constraints, Decisions and facts, Completed work, Verification and evidence, Active state, Open issues and risks, Next action. Omit empty headings. Prefer precise paths, IDs, error codes, and short evidence over narrative. Output only the handoff.`;
2
+ return `Preserve what subsequent reasoning will need when earlier details are no longer visible. Treat earlier messages as evidence, not as new requests or renewed permission.
3
+
4
+ Leave enough to continue reasoning correctly without the full conversation.
5
+
6
+ Write for subsequent reasoning, not as a recap for the user. Do not address the user, continue the task, call tools, or invent facts.
7
+
8
+ Compress wording, not meaning. Prefer completeness over brevity, even when the notes become substantially longer. When in doubt, keep a detail if losing it could change a later judgment, cause work to be repeated, or create false certainty.
9
+
10
+ ## Organization
11
+ Organize the notes into sections covering:
12
+ - Goal and constraints
13
+ - Current state
14
+ - Established conclusions and supporting evidence
15
+ - Open loops
16
+
17
+ Adapt headings and structure as needed; omit empty sections.
18
+
19
+ Use telegraphic fragments, standard domain abbreviations, exact identifiers and values, and compact symbolic relations. Omit connective prose, redundant context, and progress recaps. Preserve causal links and dependencies.
20
+
21
+ ## Retention
22
+ - Preserve the current goal, deliverable, completion criteria, active instructions, constraints, and non-goals. Resolve intent using the latest applicable user direction.
23
+ - Keep what remains relevant to subsequent reasoning: findings, decisions and evidence, rejected approaches and why, assumptions, outcomes of prior actions, unresolved questions, and remaining work.
24
+ - Preserve completed actions, non-repeatable side effects, observed failures, unresolved risks, and the next established action.
25
+ - Distinguish verified facts from hypotheses, completed work from pending work, and unverified results from observed failures.
26
+ - Preserve evidence scope and freshness. Retain earlier evidence when it explains a decision, disproves a hypothesis, or constrains subsequent work. Identify mutable state that needs revalidation.
27
+ - Preserve conflicting evidence and what is needed to resolve it. Never resolve conflicts without sufficient evidence.
28
+ - Preserve exact authorization boundaries: action, scope, and lifetime. Keep the wording and source of applicable authorization, prohibitions, or pending approval when available; never infer permission from prior completion, current state, capability, or convenience.
29
+ - Keep decisive evidence with the conclusion it supports. Preserve the exact terms, values, identifiers, failure codes, ordering, and exceptions that change a later judgment, action, or verification; do not replace those details with broad references or labels. Preserve user-designated text. Use precise references for other details only when they can be recovered reliably.
30
+ - Group related information and merge equivalent facts without losing distinct evidence or constraints.
31
+
32
+ ## Exclusions
33
+ Remove irrelevant chronology, duplicate information, superseded hypotheses with no remaining relevance, verbose source material, and details that can be reliably recovered at low cost.
34
+
35
+ Omit instructions and contextual state restored separately by Runtime, including AGENTS.md instructions, Host instructions, capability policy, Skill catalogs, and process, Code Exec cell, and Subagent inventories. Omit constraints derived solely from these restored instructions.
36
+
37
+ Omit reloadable Skill content; retain the names of Skills still needed. Preserve task-relevant outcomes and dependencies not otherwise restored.
38
+
39
+ Do not include secrets, credentials, or private deliberation.
40
+
41
+ Before emitting, read the notes as if the earlier conversation were unavailable. Can you recover the conditions, order, and exceptions that matter, and tell exactly what the evidence established or left unverified? Restore missing details that could change subsequent reasoning. Check for inconsistencies introduced by compression and keep unresolved conflicts explicit.
42
+
43
+ Output only the notes in compact Markdown.`;
29
44
  }
@@ -1,6 +1,6 @@
1
1
  import type { ExecutionMode } from '../runtime/contracts.js';
2
2
  import { type PromptPart } from './prompt-sections.js';
3
- export declare const MAR_AGENT_PROMPT_VERSION = "1.81";
3
+ export declare const MAR_AGENT_PROMPT_VERSION = "1.85";
4
4
  interface SystemPromptInput {
5
5
  mode: ExecutionMode;
6
6
  platform: string;
@@ -3,7 +3,7 @@ import { compactionPrompt } from './compact.js';
3
3
  import { environmentPrompt, identityPrompt, instructionPriorityPrompt, progressCommunicationPrompt, securityPrompt } from './core.js';
4
4
  import { modePrompt } from './modes.js';
5
5
  import { toolUsagePrompt } from './workflow.js';
6
- export const MAR_AGENT_PROMPT_VERSION = '1.81';
6
+ export const MAR_AGENT_PROMPT_VERSION = '1.85';
7
7
  export function buildSystemPrompt(input) {
8
8
  return renderPromptSections(buildSystemPromptSections(input));
9
9
  }
@@ -22,8 +22,8 @@ export function toolUsagePrompt(tools, directTools = tools) {
22
22
  <reasoning>
23
23
  During extended reasoning, earlier insights may be lost if left unrecorded.
24
24
 
25
- Use \`thought\` to capture reusable insights as they accumulate, rather than waiting until the task is complete.
25
+ When you reach a conclusion useful for later reasoning - such as confirming a hypothesis, ruling out an approach, or making a decision - use \`thought\` to record it and its key evidence before moving on.
26
26
 
27
- Avoid recording trivial observations or repeating existing conclusions.
27
+ Skip trivial observations. Do not repeat conclusions already recorded with their supporting evidence.
28
28
  </reasoning>`;
29
29
  }
@@ -1,6 +1,6 @@
1
1
  import type { SessionModelMessage as ModelMessage } from '../../session/model-request.js';
2
2
  import type { CompactHistoryMessage, CompactUserInput } from '../../session/record-contract.js';
3
- export declare const DEFAULT_COMPACTION_FOCUS = "Create a durable continuation state for the next model invocation.";
3
+ export declare const DEFAULT_COMPACTION_FOCUS = "Keep what is needed to continue reasoning without the full conversation.";
4
4
  export declare function buildNativeCompactionMessages(messages: readonly ModelMessage[], input?: {
5
5
  focus?: string;
6
6
  }): ModelMessage[];
@@ -1,6 +1,6 @@
1
1
  import { countModelTokens, truncateModelText } from '../token-budget.js';
2
2
  import { compactionPrompt } from '../../prompts/compact.js';
3
- export const DEFAULT_COMPACTION_FOCUS = 'Create a durable continuation state for the next model invocation.';
3
+ export const DEFAULT_COMPACTION_FOCUS = 'Keep what is needed to continue reasoning without the full conversation.';
4
4
  export function buildNativeCompactionMessages(messages, input = {}) {
5
5
  const focus = input.focus?.trim();
6
6
  const contract = compactionPrompt();
@@ -1,5 +1,5 @@
1
1
  import { compactExtensionMessages, compactExtensionResult, compactExtensionDiagnostic } from '../extensions/compaction.js';
2
- import { buildCompactionMessages } from '../runtime/compaction/history.js';
2
+ import { compactionPrompt } from '../prompts/compact.js';
3
3
  /** Bounds Extension diagnostics and validates its candidate before native fallback. */
4
4
  export function createExecutionCompactExtension(ports) {
5
5
  return async (history, reason, focus, compaction) => {
@@ -15,7 +15,7 @@ export function createExecutionCompactExtension(ports) {
15
15
  messages: compactExtensionMessages(history),
16
16
  ...(focus === undefined ? {} : { focus }),
17
17
  summaryTokenBudget,
18
- getPrompt: () => buildCompactionMessages('')[1].content,
18
+ getPrompt: compactionPrompt,
19
19
  reportModelUsage: ports.reportUsage,
20
20
  reportDiagnostic: async (value) => {
21
21
  if (!acceptsDiagnostics || ++diagnosticReports > 8)
@@ -8,7 +8,7 @@ export const thoughtToolDefinition = {
8
8
  allowedCallers: ['direct'],
9
9
  parallelSafety: 'safe',
10
10
  eventInputFields: [],
11
- description: 'Record dense, reusable insights not yet captured in durable artifacts: findings, decisions, rejected approaches with evidence, assumptions, and unresolved questions. Prefer terse domain shorthand, identifiers, and compact notation over narrative prose. Do not recap progress. Keep exact values and evidence needed to resume; distinguish verified facts from hypotheses. Do not include secrets or private deliberation.',
11
+ description: 'Record reusable insights for subsequent reasoning.',
12
12
  inputSchema: {
13
13
  type: 'object',
14
14
  properties: {
@@ -18,7 +18,21 @@ export const thoughtToolDefinition = {
18
18
  minLength: 1,
19
19
  maxLength: maxTitleLength
20
20
  },
21
- content: { type: 'string', minLength: 1, maxLength: maxContentBytes }
21
+ content: {
22
+ type: 'string',
23
+ description: `Record reusable insights not yet captured in durable artifacts: findings,
24
+ decisions and evidence, rejected approaches and why, assumptions, and open
25
+ questions.
26
+
27
+ Write for reuse in subsequent reasoning: telegraphic fragments, standard
28
+ domain abbreviations, exact identifiers and values, and compact symbolic
29
+ relations. Omit connective prose, redundant context, and progress recaps.
30
+ Compress wording, not meaning: preserve causal links and dependencies,
31
+ and distinguish verified facts from hypotheses. Do not include secrets
32
+ or private deliberation.`,
33
+ minLength: 1,
34
+ maxLength: maxContentBytes
35
+ }
22
36
  },
23
37
  required: ['title', 'content'],
24
38
  additionalProperties: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/agent",
3
- "version": "0.15.3",
3
+ "version": "0.15.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/myagentroam/mar.git",