Skip to content

[codex] Simplify OpenClaw plugin text results#2608

Draft
Mijamind719 wants to merge 2 commits into
volcengine:mainfrom
Mijamind719:codex/refactor-openclaw-plugin-structure
Draft

[codex] Simplify OpenClaw plugin text results#2608
Mijamind719 wants to merge 2 commits into
volcengine:mainfrom
Mijamind719:codex/refactor-openclaw-plugin-structure

Conversation

@Mijamind719

@Mijamind719 Mijamind719 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a small textResult helper for standard OpenClaw text tool responses
  • replace repeated single-text content/detail result boilerplate across OpenViking tools
  • preserve memory_recall trace result typing by keeping per-result URI inference instead of search-level overrides

Impact

This keeps tool names, command names, output text, details payloads, registration order, search behavior, and memory injection behavior unchanged while reducing boilerplate.

Diff size

  • Overall PR: 6 files changed, 741 insertions(+), 920 deletions(-), net -179 lines
  • Additional simplify on top of helper split: index.ts net -163 lines

Validation

  • npm run typecheck
  • npm test
  • npm run build

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🏅 Score: 85
🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Deduplicate memories using a Set for linear performance

The current approach to deduplicating memories uses a nested findIndex, resulting in
quadratic time complexity O(n²). Replace it with a Set to track seen URIs for linear
O(n) performance.

examples/openclaw-plugin/memory-recall-tool.ts [250-252]

-const uniqueMemories = allMemories.filter((memory, index, self) =>
-  index === self.findIndex((m) => m.uri === memory.uri)
-);
+const seenUris = new Set<string>();
+const uniqueMemories = allMemories.filter((memory) => {
+  if (seenUris.has(memory.uri)) {
+    return false;
+  }
+  seenUris.add(memory.uri);
+  return true;
+});
Suggestion importance[1-10]: 6

__

Why: This is a valid performance optimization that reduces deduplication time complexity from O(n²) to O(n) by using a Set to track seen URIs, which is beneficial for larger datasets.

Low

@Mijamind719 Mijamind719 changed the title [codex] Refactor OpenClaw plugin registration modules [codex] Preserve OpenClaw memory recall trace typing Jun 15, 2026
@Mijamind719 Mijamind719 force-pushed the codex/refactor-openclaw-plugin-structure branch from b2bb80b to 16838db Compare June 15, 2026 01:33
@Mijamind719 Mijamind719 changed the title [codex] Preserve OpenClaw memory recall trace typing [codex] Simplify OpenClaw plugin text results Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant