Skip to content

Commit 6c1a330

Browse files
madtankCipherclaude
authored
fix(setup): non-destructive sync + context window reduction (#34)
* fix: reduce context injection window to prevent group thread overflow - fullLengthMessages: 5 → 3 - additionalMessages: 15 → 7 - fullMaxChars: 2000 → 1500 - truncatedMaxChars: 500 → 400 Total messages injected per message: 20 → 10. Root cause: in active group threads with many long agent responses, the per-message context injection was pushing even fresh sessions over the model's context limit. /new and /reset don't help because the history is re-injected from the platform on every incoming message, not from session history. Also applied to installed extension at .openclaw/extensions/ax-platform/ and switched compaction.mode to 'summarize' in openclaw.json. * fix(setup): make sync non-destructive to prevent config corruption setup.sh sync was overwriting critical config during agent credential updates — hardcoding backendUrl, wiping workspace paths, deleting heartbeat/model config, clearing the plugin install manifest, and removing staging agents not in ax-agents.env. Changes: - sync now only updates plugins.entries.ax-platform.config.agents - agent entries and bindings are merged (add missing, never overwrite) - extension files are copied over (no delete-first) - config is backed up before every sync (~/.openclaw/backups/) - gateway restart uses openclaw CLI with proper process detection - CLAUDE.md updated to document the safe deployment flow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Cipher <cipher@ax-platform.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 926e149 commit 6c1a330

3 files changed

Lines changed: 284 additions & 155 deletions

File tree

CLAUDE.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,26 @@ Guidance for Claude Code when working with the **aX Platform Plugin for Clawdbot
1515
./setup.sh status
1616
```
1717

18-
## IMPORTANT: Rebuild After Code Changes
18+
## IMPORTANT: Deploy After Code Changes
1919

20-
**After modifying any TypeScript files in `extension/`, you MUST rebuild and restart:**
20+
**After modifying any TypeScript files in `extension/`, you MUST deploy and restart:**
2121

2222
```bash
2323
./setup.sh sync
2424
```
2525

26-
This copies the updated code to `~/.clawdbot/extensions/ax-platform/` and restarts the gateway.
26+
This does three things:
27+
1. Copies extension code from `extension/` to `~/.openclaw/extensions/ax-platform/`
28+
2. Updates agent credentials from `ax-agents.env` (preserves all other config)
29+
3. Restarts the gateway to pick up changes
2730

2831
**Without this step, your code changes will NOT take effect!**
2932

33+
**SAFETY:** `sync` only updates agent credentials and copies extension files.
34+
It never overwrites `backendUrl`, `outbound` config, workspace paths, heartbeat
35+
settings, model config, or other user-managed settings in `openclaw.json`.
36+
Config is backed up before every sync to `~/.openclaw/backups/`.
37+
3038
Common symptoms of forgetting to rebuild:
3139
- Old error messages still appearing (e.g., "[Duplicate dispatch - already processed]" instead of new message)
3240
- New logging not showing up

extension/lib/context.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@
1212
import type { ContextData, Message } from "./types.js";
1313

1414
// Configuration - can be overridden per-agent in the future
15+
// NOTE (2026-02-19): Reduced history window to prevent context overflow in active threads.
16+
// Group threads with many long agent messages were pushing the injected context over
17+
// the model's limit even on fresh sessions (since history is re-injected per message).
18+
// Previous: 5+15=20 messages. Current: 3+7=10 messages.
1519
const DEFAULT_CONFIG = {
1620
// How many recent messages to include at full length
17-
fullLengthMessages: 5,
21+
fullLengthMessages: 3,
1822
// How many additional messages to include (truncated)
19-
additionalMessages: 15,
23+
additionalMessages: 7,
2024
// Max chars for truncated messages (older ones in the window)
21-
truncatedMaxChars: 500,
25+
truncatedMaxChars: 400,
2226
// Max chars for full-length messages (most recent)
23-
fullMaxChars: 2000,
27+
fullMaxChars: 1500,
2428
// Max agent descriptions
2529
maxAgentDescChars: 120,
2630
// Max agents to show

0 commit comments

Comments
 (0)