Skip to content

feat: add honcho context injection controls#81

Open
de1tydev wants to merge 2 commits into
plastic-labs:mainfrom
de1tydev:feat/honcho-context-injection-controls
Open

feat: add honcho context injection controls#81
de1tydev wants to merge 2 commits into
plastic-labs:mainfrom
de1tydev:feat/honcho-context-injection-controls

Conversation

@de1tydev
Copy link
Copy Markdown

@de1tydev de1tydev commented May 2, 2026

Summary

  • add configurable Honcho prompt context injection controls for peer cards, session summaries, and full representations
  • allow newer OpenClaw runtimes to request a builtin memory backend descriptor while preserving qmd as the default
  • update plugin schema/UI hints and runtime coverage for the new backend descriptor

This is split out from #78 and intentionally avoids capture-path changes.

Validation

  • pnpm exec vitest run test/runtime.test.ts
  • pnpm build

Summary by CodeRabbit

  • New Features
    • Configurable context injection: toggle peer card, toggle session summary, and choose representation (off/full).
    • Selectable memory backend (qmd or builtin); system status now reports the active backend.
    • All options exposed and manageable via the plugin settings UI.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d153b5d8-f1f9-4267-827d-84c237cd2e48

📥 Commits

Reviewing files that changed from the base of the PR and between ecf589c and 5c6d309.

📒 Files selected for processing (4)
  • hooks/context.ts
  • openclaw.plugin.json
  • runtime.ts
  • test/runtime.test.ts

Walkthrough

This PR adds configurable context injection controls and memory backend selection. New configuration types and schema enable users to toggle peer card insertion, session summary inclusion, and representation depth, plus choose between "qmd" and "builtin" memory backends. Context injection logic and runtime initialization now respect these configuration flags.

Changes

Context Injection and Memory Backend Configuration

Layer / File(s) Summary
Data Shape
config.ts
New types ContextInjectionMode, MemoryBackendMode, and HonchoContextInjectionConfig added; HonchoConfig now includes contextInjection and memoryBackend fields.
Configuration Parsing
config.ts
honchoConfigSchema.parse now derives contextInjection from config/environment with boolean defaults for peerCard and sessionSummary (both true), resolves representation from config or HONCHO_CONTEXT_REPRESENTATION env var (defaulting to "full"), and sets memoryBackend based on "qmd" vs "builtin" selection.
Plugin Schema and UI
openclaw.plugin.json
New configSchema properties define contextInjection (with toggles and enum) and memoryBackend (enum: "qmd" | "builtin"); matching uiHints added with labels and help text.
Context Injection Gating
hooks/context.ts
Peer card (Key facts) and full representation are now conditionally appended only when state.cfg.contextInjection.peerCard and representation === "full" respectively; session context request now passes summary flag from config instead of hardcoded true.
Runtime Backend Selection
runtime.ts
resolveHonchoMemoryBackendConfig accepts memoryBackend parameter and returns "builtin" descriptor only when that value is "builtin"; runtime wiring passes state.cfg.memoryBackend to resolver; status() now reports configured backend.
Tests
test/runtime.test.ts
Test state cfg includes contextInjection with representation: "full" and memoryBackend: "qmd"; transcript read test asserts manager.status().backend matches; resolveHonchoMemoryBackendConfig test now passes "builtin" argument and validates backend selection.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A rabbit hops through config lands,
Setting contexts by command,
Memories built or QMD queried,
No more hard-coded burdens hurried! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: add honcho context injection controls' accurately summarizes the primary changes in the changeset, which add configurable context injection controls and memory backend support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…-injection-controls

# Conflicts:
#	runtime.ts
#	test/runtime.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant