Uh oh!
There was an error while loading. Please reload this page.
Maple system prompt - #12
Conversation
WalkthroughThe pull request introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant F as Frontend (sendMessage)
participant O as OpenAI API
U->>F: Initiate message send
F->>F: Create systemMessage (role: system)
F->>F: Prepend systemMessage to messages array
F->>O: Send updated messages array (system, user messages)
O->>F: Return response
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File ( |
Deploying maple with |
| Latest commit: | 858b65c |
| Status: | ✅ Deploy successful! |
| Preview URL: | https://173e577d.maple-ca8.pages.dev |
| Branch Preview URL: | https://system-prompt-maple.maple-ca8.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
frontend/src/routes/_auth.chat.$chatId.tsx (1)
171-175: Consider extracting system message to a configuration file.The system message is hardcoded within the component. For better maintainability and reusability, consider moving it to a separate configuration file.
+// src/config/ai-config.ts+export const MAPLE_SYSTEM_MESSAGE = {+ role: "system" as const,+ content:+ "You are Maple AI, a friendly AI Assistant. Respond to the input as a friendly AI assistant, generating human-like text, and follow the instructions in the input if applicable. Keep the response concise and engaging. Use a conversational tone and provide helpful and informative responses. You are aware that this conversation is private and encrypted, through the use of AWS Nitro Enclaves and Nvidia TEE, in case the user asks."+};-const systemMessage = {- role: "system",- content:- "You are Maple AI, a friendly AI Assistant. Respond to the input as a friendly AI assistant, generating human-like text, and follow the instructions in the input if applicable. Keep the response concise and engaging. Use a conversational tone and provide helpful and informative responses. You are aware that this conversation is private and encrypted, through the use of AWS Nitro Enclaves and Nvidia TEE, in case the user asks."-} as ChatMessage;+const systemMessage = MAPLE_SYSTEM_MESSAGE as ChatMessage;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
frontend/src/routes/_auth.chat.$chatId.tsx(2 hunks)frontend/src/state/LocalStateContext.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
frontend/src/state/LocalStateContext.tsx (1)
6-6: LGTM! Type update aligns with OpenAI's Chat API.The addition of the "system" role to the
ChatMessagetype correctly aligns with OpenAI's Chat API specifications, which supports system messages for providing context and instructions to the model.frontend/src/routes/_auth.chat.$chatId.tsx (1)
194-194: Verify the impact of prepending system message on token usage.Adding a system message to every request increases the token count, which could affect billing. Consider:
- Caching the system message's token count
- Monitoring the impact on total token usage
- Evaluating if the system message is needed for every request
✅ Verification successful
System message implementation is optimized and appropriate
The current implementation is well-balanced:
- System message is concise and provides essential context
- Streaming implementation already optimizes token usage
- Message size (~89 words) has minimal token impact relative to user-assistant exchanges
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash# Description: Check if system message is used consistently across the codebase# Look for other OpenAI API calls that might need the system message rg -A 5 "openai.*chat.*completions"# Check for other system message definitions rg -l "role.*system"Length of output: 569
Script:
#!/bin/bash# Check the system message definition and configuration cat frontend/src/state/LocalStateContext.tsx cat frontend/src/routes/_auth.chat.$chatId.tsx | grep -A 10 "systemMessage"Length of output: 7842
Script:
#!/bin/bash# Check the system message definition with correct path cat frontend/src/routes/_auth.chat.\$chatId.tsx | grep -B 5 -A 10 "systemMessage"Length of output: 1381
30d1980 to
858b65cCompareAnthonyRonning
commented
Aug 13, 2025
we added user-defined system prommpts |
…ecretCloud#13) * feat: add OpenClaw plugin for seamless maple-proxy integration Adds openclaw-plugin/ directory with a TypeScript OpenClaw plugin (@opensecret/maple-proxy-openclaw-plugin) that automatically downloads, manages, and runs the maple-proxy binary as a background service. Includes: - Background service: binary download/cache, process lifecycle, health checks - Plugin manifest with config schema (apiKey, port, backendUrl, debug) - maple-proxy-skill: AgentSkills-compatible skill gated on plugin config - flake.nix: adds nodejs_22 to devShell - justfile: adds plugin-install/build/lint/test/link/pack/publish commands ClosesOpenSecretCloud#12 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * feat: add version pinning, TTL cache, and old version cleanup - Add optional version field to plugin config (defaults to latest) - Cache latest-version GitHub API response for 24h to avoid rate limits - Auto-cleanup old cached binaries, keeping current + one previous - Pass pinned version from config through to ensureBinary Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * feat: rename to maple-openclaw-plugin, add agent tool, port 8000, crash recovery Addresses PR review feedback: - Rename plugin id: maple-proxy-openclaw-plugin -> maple-openclaw-plugin - Default port changed to 8000 (vLLM default) for auto-discovery - No port fallback: errors clearly if 8000 is occupied - Add maple_proxy_status agent tool (port, version, health) - Crash recovery: auto-restart with exponential backoff (max 3 attempts) - Graceful shutdown: SIGINT first, SIGTERM after 3s - SKILL.md: documents vLLM auto-discovery, explicit provider config, port override, and status tool usage Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: address PR review - spawn error race, duplicate start guard, tests - Race waitForHealth against child spawn errors so missing/broken binaries fail fast instead of waiting the full 10s health timeout. Kill and clean up child process on failure. - Guard against duplicate start(): kill existing proxy before spawning a new one to prevent leaked processes on config reload. - Log warning when checksum file is unavailable instead of silently skipping. - Fix PowerShell injection: pass archive/dest paths as separate arguments. - Extract compareVersionsDesc for semver-aware version sorting (fixes v0.9.0 vs v0.10.0 lexicographic bug). - Add 9 unit tests for version sort covering edge cases. - Distinguish EADDRINUSE from other port errors in checkPortAvailable. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: SIGTERM escalation, signal crash recovery, checksum security - Fix SIGTERM escalation dead code: track actual exit state instead of relying on child.killed (which is true immediately after kill() call). Now SIGTERM correctly fires after 3s if SIGINT did not terminate the process. - Fix crash recovery for signal-killed processes: handle SIGSEGV, SIGABRT, SIGBUS etc. Previously code === null (signal death) skipped the entire recovery block silently. Now any non-intentional crash triggers restart. - Fix checksum verification: only skip on 404 (file not found). Other HTTP errors (403 rate limit, 500 server error) now throw instead of silently using an unverified binary. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: track exited flag across crash recovery restarts Move exited flag and its exit listener to the same scope as crash recovery. Reset exited=false and attach a new listener after each respawn so kill() correctly targets the current child process, not a stale reference from a previous crash. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: stale process reference after crash recovery, SIGKILL escalation - Make RunningProxy.process a getter so it always returns the current child process, not a stale reference from before crash recovery. - Escalate from SIGINT to SIGKILL (not SIGTERM) after 3s timeout. SIGTERM is equally catchable/ignorable as SIGINT; SIGKILL guarantees termination and prevents orphaned processes on shutdown. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: add concurrent start() guard to prevent download/extraction races Add a starting flag with try/finally so concurrent start() calls (e.g. during rapid config reloads) do not race on ensureBinary, preventing duplicate downloads and file corruption during extraction. Also flatten the nested try blocks for clarity. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: regenerate package-lock.json to match renamed package Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: kill orphaned child process on crash-recovery restart failure When crash recovery spawns a new child but waitForHealth times out, the child was left running. Now SIGKILL it in the catch block, matching the initial startup error handling path. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * docs: add embeddings endpoint and memory search config to SKILL.md maple-proxy now serves /v1/embeddings with nomic-embed-text. Document how to configure OpenClaw memorySearch to use maple-proxy as the embedding provider, keeping all vector operations inside the TEE. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: correct apiKey guidance in memory search config The apiKey in memorySearch.remote is forwarded as a Bearer token to the TEE backend, so it must be the real Maple API key, not an arbitrary placeholder. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: align plugin packaging with OpenClaw conventions - Add "type": "module" (required by all OpenClaw extensions) - Point openclaw.extensions at ./index.ts instead of ./dist/index.js (OpenClaw uses jiti to load TypeScript directly at runtime) - Ship .ts source files instead of dist/ in the npm package - Add openclaw peerDependency (>=2026.1.0, optional) - Remove prepublishOnly build step (no longer needed) - Remove main/types fields (jiti handles resolution) Based on conventions from all official OpenClaw extensions. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: rewrite SKILL.md from real usage, change default port to 8787 Based on real-world OpenClaw setup feedback: - Lead with explicit maple provider config (not vLLM auto-discovery) - Change default port from 8000 to 8787 to avoid vLLM conflicts - Document the model allowlist step (agents.defaults.models) - Document subagent usage with maple/ prefix - Fix auth docs: apiKey must be real Maple key everywhere - Update all port references in examples and manifests Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: update stale vLLM log message to maple provider Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * docs: note that plugin config changes require gateway restart Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: exclude SIGKILL from crash recovery to prevent cascading restarts SIGKILL is only sent intentionally by our own code (cleanup on failed restart, escalation on shutdown). Treating it as a crash wastes restart attempts when a respawned child fails health checks and gets cleaned up. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: return setup instructions from maple_proxy_status when unconfigured When the API key is not set, the tool now returns step-by-step setup guidance instead of just "not running". This bridges the gap between plugin install and configuration since there is no post-install hook. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * chore: bump to 0.1.0-beta.2 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: unref shutdown timers to allow clean Node.js exit Both the SIGKILL fallback timer and crash-recovery restart timer were holding the event loop open, delaying gateway shutdown by up to 6s. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * chore: bump to 0.1.0-beta.3 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * docs: expand SKILL.md embeddings section with full setup walkthrough Rewrote the Embeddings & Memory Search section based on real-world setup experience. Key additions: - Step-by-step: enable memory-core plugin, configure memorySearch, restart, reindex, and test - Document that model must be 'nomic-embed-text' (no maple/ prefix) or the proxy returns 400 errors - Document that memory-core must be explicitly added to plugins.allow and plugins.entries (not loaded by default despite docs saying so) - Add troubleshooting section covering the 5 most common failure modes - Add verification steps (openclaw memory status --deep, CLI search) * chore: bump to 0.1.0-beta.4 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * docs: add README.md for npm package with full setup and embeddings guide Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * docs: restructure README with recommended (agent-driven) and manual setup paths Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * fix: capture child reference locally in crash recovery to prevent race When multiple restart attempts overlap, the shared child variable could be reassigned by a later attempt before an earlier one finishes. The stale catch block would then kill the wrong process. Now each restart captures its own spawned reference for cleanup. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * chore: release 0.1.0 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * docs: add all available models to SKILL.md and README Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * chore: release 0.1.1 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --------- Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kelaode <kelaode@anthonyronning.com>
Summary by CodeRabbit
New Features
Refactor