From 7e9801bf9c39bff305c7119912d7dbdd2488bb34 Mon Sep 17 00:00:00 2001 From: sausheong Date: Fri, 8 May 2026 13:40:27 +0800 Subject: [PATCH] Remove upstream-project attribution from docs and code comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Strips references to the upstream npm-package agent harness from README design notes, developer.md, the compaction package, the runtime context/streaming comments, and the tools/mcp adapter doc-comments. The technical patterns being described stand on their own; the attribution chain isn't needed. Remaining mentions of the word in the providers/anthropic package are literal Anthropic model identifiers (the 'claude-…' API model strings) — those are functional product names, not attribution. --- README.md | 13 +++++++------ compaction/compaction.go | 3 --- compaction/prompt.go | 6 ------ developer.md | 4 ++-- runtime/context.go | 6 +++--- runtime/streaming.go | 2 +- tools/mcp/adapter.go | 5 ++--- tools/mcp/mcp.go | 4 ++-- 8 files changed, 17 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index f97810f..c8f3d16 100644 --- a/README.md +++ b/README.md @@ -221,10 +221,10 @@ Deliberately not in scope (numbers from the same conceptual list): valid. - **Compaction at a clean boundary.** `compaction.Split` walks backward counting user messages and cuts at one — never inside a - tool-call/tool-result pair. The prompt itself (`compaction/prompt.go`) - is adapted from Claude Code's `BASE_COMPACT_PROMPT` and emits a - 9-section structured summary inside an `` + `` - envelope; the `` block is stripped before re-injection. + tool-call/tool-result pair. The prompt (`compaction/prompt.go`) + emits a 9-section structured summary inside an `` + + `` envelope; the `` block is stripped before + re-injection. - **Plug-points are nil-friendly.** `MemoryProvider`, `KnowledgeGraph`, `SkillProvider`, `SubagentResolver`, `PermissionChecker`, `LifecycleHooks`, and `session.Store` are all @@ -284,8 +284,9 @@ these, you'll need to bring them yourself or layer them on top: - **Auth / billing / multi-tenant infrastructure.** Per-agent policy lives in `PermissionChecker`; everything else is your problem. -- **Shell-command hooks (Claude Code style).** Hooks are typed Go - callbacks on `LifecycleHooks`, not subprocess invocations. +- **Shell-command hooks.** Hooks are typed Go callbacks on + `LifecycleHooks`, not subprocess invocations driven by a config + file. ## Testing diff --git a/compaction/compaction.go b/compaction/compaction.go index a7642a9..5ffa3ad 100644 --- a/compaction/compaction.go +++ b/compaction/compaction.go @@ -19,9 +19,6 @@ import ( // The breaker resets on any genuine summarizer success (stage 1 or 2 // returning real content). It exists to prevent a session whose context // is irrecoverably over the limit from hammering the API on every turn. -// -// Pattern from Claude Code MAX_CONSECUTIVE_AUTOCOMPACT_FAILURES -// (src/services/compact/autoCompact.ts:67-70). const MaxConsecutiveFailures = 3 // Reason identifies why compaction was triggered. diff --git a/compaction/prompt.go b/compaction/prompt.go index 8d8241b..24f0552 100644 --- a/compaction/prompt.go +++ b/compaction/prompt.go @@ -57,9 +57,6 @@ func transcriptDelimiterSuffix() string { // - The block is a drafting scratchpad (stripped before // injection by FormatCompactSummary). It improves summary quality on // small models without polluting the resulting context. -// -// Pattern adapted from Claude Code's BASE_COMPACT_PROMPT -// (claude-code-source/src/services/compact/prompt.ts:61-143). const summarizationPromptHeader = `You are summarizing an AI assistant's conversation so it can continue past the context window. CRITICAL: Respond with TEXT ONLY. Do NOT call any tools. The output must be an block followed by a block — nothing else. @@ -247,9 +244,6 @@ var blankLineCollapseRE = regexp.MustCompile(`\n{3,}`) // returned as-is so we never silently drop content. Multiple // blocks (rare, but possible) are each unwrapped consistently so no literal // tags leak into the injected context. -// -// Pattern adapted from Claude Code's formatCompactSummary -// (claude-code-source/src/services/compact/prompt.ts:311-335). func FormatCompactSummary(raw string) string { out := analysisBlockRE.ReplaceAllString(raw, "") diff --git a/developer.md b/developer.md index d12af57..7129acc 100644 --- a/developer.md +++ b/developer.md @@ -362,8 +362,8 @@ reg.Register(&EnvTool{}) ### Returning images -Vision-capable models (Claude, GPT-4o, Gemini) can see images returned -from a tool. Set `ToolResult.Images`: +Vision-capable models can see images returned from a tool. Set +`ToolResult.Images`: ```go return tool.ToolResult{ diff --git a/runtime/context.go b/runtime/context.go index a4312df..403d83b 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -501,8 +501,8 @@ func FormatDateLine(now time.Time) string { // PostCompactRestoreFiles caps how many recently-touched files // buildPostCompactRestore re-injects after a successful compaction. -// 5 mirrors Claude Code's harness behaviour (harness.md §3) and keeps -// the restore message bounded. +// 5 keeps the restore message bounded while covering the typical +// "the last few files I was working on" recall horizon. const PostCompactRestoreFiles = 5 // PostCompactRestoreBytesPerFile bounds the per-file byte budget for @@ -542,7 +542,7 @@ func extractPathFromInput(raw []byte) string { // // Format is wrapped in ...... // tags so the model recognises it as out-of-band context, not a fresh -// user request. Mirrors how Claude Code re-injects POST_COMPACT files. +// user request. func buildPostCompactRestore(files []string, maxFiles, maxBytesPerFile int) llm.Message { if len(files) == 0 || maxFiles <= 0 || maxBytesPerFile <= 0 { return llm.Message{} diff --git a/runtime/streaming.go b/runtime/streaming.go index b3f2572..57668e8 100644 --- a/runtime/streaming.go +++ b/runtime/streaming.go @@ -14,7 +14,7 @@ import ( // 3. Otherwise off. // // Strict "1" for the env fallback (rather than truthy parsing) keeps the -// env contract simple and matches Claude Code's binary-feature-gate posture. +// env contract simple and unambiguous. // Note: an explicit `false` in JSON5 behaves the same as the field being // absent — to disable, leave both unset. func (r *Runtime) streamingToolsEnabled() bool { diff --git a/tools/mcp/adapter.go b/tools/mcp/adapter.go index 1faa916..d11cae4 100644 --- a/tools/mcp/adapter.go +++ b/tools/mcp/adapter.go @@ -20,9 +20,8 @@ type mcpToolAdapter struct { } // Name returns "mcp____". The double-underscore -// namespacing matches Claude Code so the LLM treats these tools the -// same way it would in CC and so they can't collide with built-in -// harness tools. +// namespacing prevents collisions with built-in harness tools and +// is the convention most agent harnesses use for MCP-sourced tools. func (a *mcpToolAdapter) Name() string { return "mcp__" + a.serverName + "__" + a.sdkTool.Name } diff --git a/tools/mcp/mcp.go b/tools/mcp/mcp.go index f812a12..628b62f 100644 --- a/tools/mcp/mcp.go +++ b/tools/mcp/mcp.go @@ -35,8 +35,8 @@ import ( // (Streamable HTTP via the SDK's StreamableClientTransport). type ServerConfig struct { // Name namespaces the server's tools. Adapter tool names become - // "mcp____", matching Claude Code's convention so the - // LLM treats them the same way. + // "mcp____" — the conventional double-underscore + // scheme that prevents collisions with built-in tools. Name string // Command + Args + Env wire the stdio transport. Env is merged into