Remove upstream-project attribution from docs and code comments

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.
This commit is contained in:
sausheong committed 2026-05-08 13:43:10 +08:00
1 parent fa61dbdf77
commit 7e9801bf9c
8 files changed
+17 -26

No files matched your search

+7 -6
View File
@@ -221,10 +221,10 @@ Deliberately not in scope (numbers from the same conceptual list):
valid. valid.
- **Compaction at a clean boundary.** `compaction.Split` walks - **Compaction at a clean boundary.** `compaction.Split` walks
backward counting user messages and cuts at one — never inside a backward counting user messages and cuts at one — never inside a
tool-call/tool-result pair. The prompt itself (`compaction/prompt.go`) tool-call/tool-result pair. The prompt (`compaction/prompt.go`)
is adapted from Claude Code's `BASE_COMPACT_PROMPT` and emits a emits a 9-section structured summary inside an `<analysis>` +
9-section structured summary inside an `<analysis>` + `<summary>` `<summary>` envelope; the `<analysis>` block is stripped before
envelope; the `<analysis>` block is stripped before re-injection. re-injection.
- **Plug-points are nil-friendly.** `MemoryProvider`, - **Plug-points are nil-friendly.** `MemoryProvider`,
`KnowledgeGraph`, `SkillProvider`, `SubagentResolver`, `KnowledgeGraph`, `SkillProvider`, `SubagentResolver`,
`PermissionChecker`, `LifecycleHooks`, and `session.Store` are all `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 - **Auth / billing / multi-tenant infrastructure.** Per-agent
policy lives in `PermissionChecker`; everything else is your policy lives in `PermissionChecker`; everything else is your
problem. problem.
- **Shell-command hooks (Claude Code style).** Hooks are typed Go - **Shell-command hooks.** Hooks are typed Go callbacks on
callbacks on `LifecycleHooks`, not subprocess invocations. `LifecycleHooks`, not subprocess invocations driven by a config
file.
## Testing ## Testing
-3
View File
@@ -19,9 +19,6 @@ import (
// The breaker resets on any genuine summarizer success (stage 1 or 2 // The breaker resets on any genuine summarizer success (stage 1 or 2
// returning real content). It exists to prevent a session whose context // returning real content). It exists to prevent a session whose context
// is irrecoverably over the limit from hammering the API on every turn. // 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 const MaxConsecutiveFailures = 3
// Reason identifies why compaction was triggered. // Reason identifies why compaction was triggered.
-6
View File
@@ -57,9 +57,6 @@ func transcriptDelimiterSuffix() string {
// - The <analysis> block is a drafting scratchpad (stripped before // - The <analysis> block is a drafting scratchpad (stripped before
// injection by FormatCompactSummary). It improves summary quality on // injection by FormatCompactSummary). It improves summary quality on
// small models without polluting the resulting context. // 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. 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 <analysis> block followed by a <summary> block — nothing else. CRITICAL: Respond with TEXT ONLY. Do NOT call any tools. The output must be an <analysis> block followed by a <summary> block — nothing else.
@@ -247,9 +244,6 @@ var blankLineCollapseRE = regexp.MustCompile(`\n{3,}`)
// returned as-is so we never silently drop content. Multiple <summary> // returned as-is so we never silently drop content. Multiple <summary>
// blocks (rare, but possible) are each unwrapped consistently so no literal // blocks (rare, but possible) are each unwrapped consistently so no literal
// tags leak into the injected context. // 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 { func FormatCompactSummary(raw string) string {
out := analysisBlockRE.ReplaceAllString(raw, "") out := analysisBlockRE.ReplaceAllString(raw, "")
+2 -2
View File
@@ -362,8 +362,8 @@ reg.Register(&EnvTool{})
### Returning images ### Returning images
Vision-capable models (Claude, GPT-4o, Gemini) can see images returned Vision-capable models can see images returned from a tool. Set
from a tool. Set `ToolResult.Images`: `ToolResult.Images`:
```go ```go
return tool.ToolResult{ return tool.ToolResult{
+3 -3
View File
@@ -501,8 +501,8 @@ func FormatDateLine(now time.Time) string {
// PostCompactRestoreFiles caps how many recently-touched files // PostCompactRestoreFiles caps how many recently-touched files
// buildPostCompactRestore re-injects after a successful compaction. // buildPostCompactRestore re-injects after a successful compaction.
// 5 mirrors Claude Code's harness behaviour (harness.md §3) and keeps // 5 keeps the restore message bounded while covering the typical
// the restore message bounded. // "the last few files I was working on" recall horizon.
const PostCompactRestoreFiles = 5 const PostCompactRestoreFiles = 5
// PostCompactRestoreBytesPerFile bounds the per-file byte budget for // PostCompactRestoreBytesPerFile bounds the per-file byte budget for
@@ -542,7 +542,7 @@ func extractPathFromInput(raw []byte) string {
// //
// Format is wrapped in <system-reminder>...<file path="...">...</file> // Format is wrapped in <system-reminder>...<file path="...">...</file>
// tags so the model recognises it as out-of-band context, not a fresh // 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 { func buildPostCompactRestore(files []string, maxFiles, maxBytesPerFile int) llm.Message {
if len(files) == 0 || maxFiles <= 0 || maxBytesPerFile <= 0 { if len(files) == 0 || maxFiles <= 0 || maxBytesPerFile <= 0 {
return llm.Message{} return llm.Message{}
+1 -1
View File
@@ -14,7 +14,7 @@ import (
// 3. Otherwise off. // 3. Otherwise off.
// //
// Strict "1" for the env fallback (rather than truthy parsing) keeps the // 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 // Note: an explicit `false` in JSON5 behaves the same as the field being
// absent — to disable, leave both unset. // absent — to disable, leave both unset.
func (r *Runtime) streamingToolsEnabled() bool { func (r *Runtime) streamingToolsEnabled() bool {
+2 -3
View File
@@ -20,9 +20,8 @@ type mcpToolAdapter struct {
} }
// Name returns "mcp__<server>__<tool>". The double-underscore // Name returns "mcp__<server>__<tool>". The double-underscore
// namespacing matches Claude Code so the LLM treats these tools the // namespacing prevents collisions with built-in harness tools and
// same way it would in CC and so they can't collide with built-in // is the convention most agent harnesses use for MCP-sourced tools.
// harness tools.
func (a *mcpToolAdapter) Name() string { func (a *mcpToolAdapter) Name() string {
return "mcp__" + a.serverName + "__" + a.sdkTool.Name return "mcp__" + a.serverName + "__" + a.sdkTool.Name
} }
+2 -2
View File
@@ -35,8 +35,8 @@ import (
// (Streamable HTTP via the SDK's StreamableClientTransport). // (Streamable HTTP via the SDK's StreamableClientTransport).
type ServerConfig struct { type ServerConfig struct {
// Name namespaces the server's tools. Adapter tool names become // Name namespaces the server's tools. Adapter tool names become
// "mcp__<Name>__<tool>", matching Claude Code's convention so the // "mcp__<Name>__<tool>" — the conventional double-underscore
// LLM treats them the same way. // scheme that prevents collisions with built-in tools.
Name string Name string
// Command + Args + Env wire the stdio transport. Env is merged into // Command + Args + Env wire the stdio transport. Env is merged into