feat: Claude Code patterns transfer (6 features + pipeline integration)#150
feat: Claude Code patterns transfer (6 features + pipeline integration)#150
Conversation
- Fix PromptRouter regex: \s not s for whitespace splitting - Fix ReactiveCompaction: downgrade least-relevant half, not most-relevant - Fix reactivePackerWrapper: truncate content after depth adjustment - Fix agentSearchIntegration: include metadata in cache key for freshness
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 255ed2ab3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const truncatedContent = contentStr.length > truncatedLength | ||
| ? contentStr.slice(0, truncatedLength) + ' | ||
| [... truncated by reactive compaction]' |
There was a problem hiding this comment.
Prevent truncated marker from increasing content size
The new truncation path appends a fixed "[... truncated by reactive compaction]" suffix without accounting for its length, so short files can become longer after “compaction” (for example, truncating a 5-character string to 1 character still yields a ~40-character result). In that case newTokens is reduced while the actual emitted content grows, which can silently violate token-budget assumptions and overflow downstream context windows.
Useful? React with 👍 / 👎.
| knowledge: KnowledgeSource[] = [], | ||
| ): AgentSearchService { | ||
| const hash = JSON.stringify(agents.map(a => a.id).sort()); | ||
| const hash = JSON.stringify(agents.map(a => [a.id, a.description, a.role, ...(a.tags ?? [])].join('|')).sort()); |
There was a problem hiding this comment.
Serialize agent hash fields without delimiter collisions
Building the cache key with [...].join('|') is ambiguous for free-form strings, so different agent metadata can collapse to the same hash whenever a field contains | (e.g., descriptions or tags), and the service will incorrectly reuse a stale _searchInstance instead of rebuilding the index. Using structured serialization per agent (rather than delimiter-joined text) avoids these false cache hits.
Useful? React with 👍 / 👎.
Claude Code Patterns → modular-patchbay
Transfer de 6 features + 5 adapters + pipeline wiring extraits du source code Claude Code.
Features (3 phases)
Phase 1 — Standalone modules (6 source + 6 test files, 58 tests)
src/prompt/SystemPromptBuilder.tssrc/context/ReactiveCompaction.tssrc/memory/MemoryStore.tssrc/context/ContextCollapse.tssrc/context/ToolUseSummary.tssrc/search/AgentSearch.tsPhase 2 — Adapters + barrel export
systemFrameBuilderAdapter.tsreactivePackerWrapper.tsmemoryStoreIntegration.tscontextMiddleware.tsagentSearchIntegration.tsPhase 3 — Pipeline wiring + E2E
systemFrameBuilder.ts→buildSystemFrameOptimized()packer.ts→packContextReactivecontextAssembler.ts→assemblePipelineContextWithMemory()pipelineChat.ts→ context middleware singletonserver/routes/agents.ts→GET /agents/searchserver/services/teamRunner.ts→ worktree auto-setup for agents with repoUrlsrc/claude-code-patterns/index.tsArchitecture
Testing
npx vitest runto verify locallyKey design choice
All integrations use adapter/wrapper pattern — zero modifications to existing function signatures, zero regression risk. Each adapter can be adopted incrementally.