fancyboi999/dsh-newwindows

dsh-newwindows

⚡ Summary-free context window rollover, model-authored notes, and scoped history lookup plugin for DeepSeek Harness (DSH). Inspired by OpenAI Codex.

Uncategorizedai-agentcodexcompaction

dsh-newwindows

中文说明 | English

dsh-newwindows is a performance-oriented extension plugin for DeepSeek Harness (DSH/Cordis). Inspired by the modern OpenAI Codex runtime context architecture, it delivers Summary-Free Context Rollover, Model-Authored Notes, and Scoped Raw History Lookup.

Eliminate sluggish, lossy LLM recursive summarization and empower your agents with microsecond-level, deterministic context relay during long-horizon tasks.


✨ Key Features

  • ⚡ Zero-Token Summary-Free Rollover: Bypasses costly recursive LLM summarization. Leverages DSH surface replacement for sub-millisecond context reset, completely eliminating 5~20 second stalls and token billing overhead.
  • 🛡️ Node 0 Absolute Invariant: Permanent retention of initial system prompts (startSeq = 1). Never loses core identity, system rules, or global tool specifications across window transitions.
  • 📝 Model-Authored Notes: Agents actively curate architectural decisions and pending tasks during reasoning. Active notes are automatically formatted and injected as deterministic seeds into new windows.
  • 🔒 Concurrency & Tool Safety Barrier: The new_context tool declares exclusive execution. Latched state machines postpone compaction until the step boundary, guaranteeing all concurrent tool calls and results pair completely before rollover.
  • ⏱️ Single-Shot Budget Reminder: Triggers a gentle reminder when approaching budget boundaries (e.g. 75%). State-latched de-duplication prevents context spamming.
  • 🔍 Scoped Raw History Lookup: Immutable physical logs remain intact. Provides a bounded, read-only inspection tool with strict pagination and per-item character truncation.

💡 Comparison Matrix

Evaluation DimensionTraditional LLM Compaction (compaction-basic)dsh-newwindows Rollover
Latency & Token CostConsumes 1k4k tokens, blocks for 520 secondsZero inference tokens, microsecond local surface replacement
Fidelity & PrecisionHallucination prone; loses exact paths, lines, and errorsZero loss on key decisions via structured notes; raw logs kept intact
Prompt CachingRewriting chat history shatters backend KV cacheDiscrete windows preserve deterministic system prefixes
TraceabilityAmbiguous, flattened conversational historyMonotonic window chain tracked via UUIDv7 and sequential indexes
History RecyclabilitySummarized history is permanently inaccessibleDedicated bounded tool enables on-demand retrospective lookup

🚀 Installation & Setup

Option 1: Via Cordis Bundle Patch (cordis.patch.yml)

Declare the plugin in your DSH bundle configuration:

- insert:
    - id: dsh-newwindows
      name: '@deepseek-ai/cordis-plugin-group'
      group: true
      isolate:
        newWindows: true
      config:
        - id: dsh-newwindows-runtime
          name: 'dsh-newwindows'

Option 2: Programmatic Loading

import { Context } from '@deepseek-ai/cordis'
import plugin from 'dsh-newwindows'

const ctx = new Context()

// Load plugin with custom configuration
await ctx.plugin(plugin, {
  auto: true,
  reminderThresholdRatio: 0.75,
  overflowThresholdRatio: 0.90,
  maxNotes: 30,
})

// Access registered services from context
const { notesStore, windowChain, engine } = ctx.newWindows

⚙️ Configuration Options

The plugin accepts the following parameters during initialization:

OptionTypeDefaultDescription
autobooleantrueAutomatically track context usage and trigger overflow rollover
reminderThresholdRationumber0.75Budget ratio to emit a single-shot reminder to organize notes
overflowThresholdRationumber0.90Hard budget ratio to enforce context rollover
maxNotesnumber30Maximum number of notes stored per conversation
maxNoteCharsnumber4000Hard ceiling for total note characters
seedGoalPromptstring"Continue execution..."Guidance prompt appended with active notes into the fresh window

🤖 Contributed Agent Tools

Once activated, dsh-newwindows equips the agent with three specialized tools:

1. note_action

  • Purpose: Structured state scratchpad.
  • Actions: create, update, delete, list.
  • Use Case: Allows the agent to persistently retain technical milestones, constraints, and pending todos across window rollovers.

2. new_context

  • Purpose: Explicit window rollover trigger.
  • Mechanism: Declares exclusive execution mode. The agent initiates rollover upon phase completion or high context usage, specifying next_goal to cleanly start a fresh window.

3. lookup_raw_history

  • Purpose: Safe diagnostic probe over archived interactions.
  • Mechanism: Provides bounded, read-only pagination over shadowed raw events with optional role filtering (user, assistant, tool).

📖 Architecture & Developer Documentation


📄 License

Licensed under the Apache-2.0 License. Core mechanisms inspired by the OpenAI Codex context management architecture.