open-agents-ai 0.32.1 → 0.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +231 -43
  2. package/dist/index.js +48 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -29,7 +29,7 @@ An autonomous multi-turn tool-calling agent that reads your code, makes changes,
29
29
 
30
30
  ## Features
31
31
 
32
- - **35 autonomous tools** — file I/O, shell, grep, web search/fetch, memory, sub-agents, background tasks, image/OCR, git, diagnostics, vision, desktop automation, structured files, code sandbox
32
+ - **35+ autonomous tools** — file I/O, shell, grep, web search/fetch/crawl, memory, sub-agents, background tasks, image/OCR, git, diagnostics, vision, desktop automation, structured files, code sandbox
33
33
  - **Moondream vision** — see and interact with the desktop via Moondream VLM (caption, query, detect, point-and-click)
34
34
  - **Desktop automation** — vision-guided clicking: describe a UI element in natural language, the agent finds and clicks it
35
35
  - **Auto-install desktop deps** — screenshot, mouse, OCR, and image tools auto-install missing system packages (scrot, xdotool, tesseract, imagemagick) on first use
@@ -46,13 +46,18 @@ An autonomous multi-turn tool-calling agent that reads your code, makes changes,
46
46
  - **Code sandbox** — isolated code execution in subprocess or Docker (JS, Python, Bash, TypeScript)
47
47
  - **Structured file reading** — parse CSV, TSV, JSON, Markdown tables with binary format detection
48
48
  - **Multi-provider web search** — DuckDuckGo (free), Tavily (structured), Jina AI (markdown) with auto-detection
49
+ - **Web crawling** — multi-page web scraping with Crawlee/Playwright for deep documentation extraction
49
50
  - **Task templates** — specialized system prompts and tool recommendations for code, document, analysis, plan tasks
50
51
  - **Auto-expanding context** — detects RAM/VRAM and creates an optimized model variant on first run
51
52
  - **Mid-task steering** — type while the agent works to add context without interrupting
52
- - **Smart compaction** — long conversations compressed preserving files, commands, errors, decisions
53
+ - **Smart compaction** — 6 context compaction strategies (default, aggressive, decisions, errors, summary, structured) with research-backed design
54
+ - **Memex experience archive** — large tool outputs archived during compaction with hash-based retrieval
53
55
  - **Persistent memory** — learned patterns stored in `.oa/memory/` across sessions
56
+ - **Session context persistence** — auto-saves context on task completion, manual `/context save|restore` across sessions
54
57
  - **Self-learning** — auto-fetches docs from the web when encountering unfamiliar APIs
55
- - **Seamless `/update`** — in-place update and reload without losing context
58
+ - **Seamless `/update`** — in-place update and reload with automatic context save/restore
59
+ - **Task control** — `/pause` (gentle halt at turn boundary), `/stop` (immediate kill), `/resume` to continue
60
+ - **Model-tier awareness** — dynamic tool sets, prompt complexity, and context limits scale with model size (small/medium/large)
56
61
 
57
62
  ## How It Works
58
63
 
@@ -92,6 +97,110 @@ The loop tracks iteration history, generates completion reports saved to `.aiwg/
92
97
  /ralph-abort # Cancel running loop
93
98
  ```
94
99
 
100
+ ## Context Compaction — Research-Backed Memory Management
101
+
102
+ Long conversations consume context window tokens. Open Agents uses progressive context compaction to compress older messages while preserving critical information — decisions, errors, file states, and task progress.
103
+
104
+ ### How It Works
105
+
106
+ Compaction triggers automatically when estimated token usage reaches 75% of the model's context window. The system:
107
+
108
+ 1. **Preserves** the system prompt and initial user task (head messages)
109
+ 2. **Summarizes** middle messages (tool calls, results, exploration) into a structured digest
110
+ 3. **Keeps** recent messages verbatim (scaled by model tier and context size)
111
+ 4. **Archives** large tool outputs to the Memex experience archive (retrievable by hash ID via `memex_retrieve`)
112
+
113
+ ### Compaction Strategies
114
+
115
+ Six strategies are available via `/compact <strategy>`:
116
+
117
+ | Strategy | What It Preserves | Best For |
118
+ |----------|-------------------|----------|
119
+ | `default` | Progressive summarization — decisions, errors, file changes, task state | General use |
120
+ | `aggressive` | Only key decisions and errors, maximum compression | Very long sessions |
121
+ | `decisions` | Action→outcome pairs only, discards exploration | Decision-heavy workflows |
122
+ | `errors` | Full error context preserved, successes compressed | Debugging sessions |
123
+ | `summary` | High-level paragraph summary, minimal detail | Quick context reset |
124
+ | `structured` | LLM-generated structured summary via a separate inference call | Highest quality summaries |
125
+
126
+ ### Automatic Compaction
127
+
128
+ Compaction thresholds scale dynamically with model size:
129
+
130
+ | Model Tier | Threshold | Recent Messages Kept |
131
+ |------------|-----------|---------------------|
132
+ | Large (30B+) | 40,000 tokens (or 75% of context) | 12 messages |
133
+ | Medium (8-29B) | 24,000 tokens (or 75% of context) | 8 messages |
134
+ | Small (≤7B) | 12,000 tokens (or 75% of context) | 4-6 messages |
135
+
136
+ ### Memex Experience Archive
137
+
138
+ During compaction, large tool outputs (file reads, grep results, command output) are archived with a short hash ID. The agent can recover any archived result using `memex_retrieve`:
139
+
140
+ ```
141
+ Agent: memex_retrieve(id="a3f2c1")
142
+ → [Full original content of the archived tool result]
143
+ ```
144
+
145
+ This gives the agent "perfect recall" of any prior tool output despite compaction.
146
+
147
+ ### Design Rationale
148
+
149
+ The compaction system draws on several research findings:
150
+
151
+ - **RECOMP** (arXiv:2310.04408, ICLR 2024) — Demonstrated that retrieved context can be compressed to 6% of original size with minimal quality loss. Our observation masking pre-pass applies this principle to tool outputs.
152
+ - **Tool Documentation Enables Zero-Shot Tool-Usage** (arXiv:2308.00675) — Showed that documentation quality matters more than example quantity. Our compaction preserves tool schemas while discarding verbose results.
153
+ - **ToolLLM DFSDT** (arXiv:2307.16789) — Validated that backtracking and error preservation improve multi-step task success by +35pp. Our error-preserving strategy directly implements this insight.
154
+ - **Long Context Does Not Solve Planning** (NATURAL PLAN, arXiv:2406.04520) — GPT-4 achieves only 31% on trip planning even with full context. This confirms that efficient context use outperforms naive context expansion, motivating aggressive compaction with selective preservation.
155
+
156
+ ### Domain-Aware Preservation
157
+
158
+ Compaction summaries include:
159
+ - **Task state** — current phase, goals, progress, blockers
160
+ - **File registry** — per-file metadata (last action, line count, purpose) for files touched during the session
161
+ - **Memex index** — hash IDs and one-line summaries of archived tool outputs
162
+
163
+ This ensures the agent can resume coherently after compaction without re-reading files or re-running commands.
164
+
165
+ ## Task Control
166
+
167
+ ### Pause, Stop, Resume, Destroy
168
+
169
+ | Command | Behavior |
170
+ |---------|----------|
171
+ | `/pause` | **Gentle halt** — lets the current inference turn finish, then stops before the next turn. No new tool calls or inference will begin until `/resume`. |
172
+ | `/stop` | **Immediate kill** — aborts the current inference mid-stream, saves task state for later resumption. |
173
+ | `/resume` | **Continue** — resumes a paused or stopped task from where it left off. Also resumes tasks saved by `/stop` or interrupted by `/update`. |
174
+ | `/destroy` | **Nuclear option** — aborts any active task, deletes the `.oa/` directory, clears the console, and exits to shell. |
175
+
176
+ ### Session Context Persistence
177
+
178
+ Context is automatically saved on every task completion and preserved across `/update` restarts.
179
+
180
+ ```bash
181
+ /context save # Force-save current session context
182
+ /context restore # Load previous session context into next task
183
+ /context show # Show saved context status (entries, last saved)
184
+ ```
185
+
186
+ The system maintains a rolling window of the last 20 session entries in `.oa/context/session-context.json`. When you run `/context restore`, the last 10 entries are formatted into a restore prompt and injected into your next task, giving the agent continuity across sessions.
187
+
188
+ During `/update`, context is automatically saved before the process restarts and restored when the new version resumes your task.
189
+
190
+ ### Auto-Restore on Startup
191
+
192
+ When you launch `oa` in a workspace that has saved session context from a previous run, you'll be prompted to restore it:
193
+
194
+ ```
195
+ ℹ Previous session found (5 entries, last active 2h ago)
196
+ ℹ Last task: fix the auth bug in src/middleware.ts
197
+ ℹ Restore previous context? (y/n)
198
+ ❯ y
199
+ ℹ Context restored from 5 session(s). Will be injected into your next task.
200
+ ```
201
+
202
+ Type `y` to restore — the previous session context will be prepended to your next task, giving the agent full continuity. Type `n` (or anything else) to start fresh. The prompt only appears on fresh starts, not on `/update` resumes (which auto-restore context).
203
+
95
204
  ## Dream Mode — Creative Idle Exploration
96
205
 
97
206
  When you're not actively tasking the agent, Dream Mode lets it creatively explore your codebase and generate improvement proposals autonomously. The system models real human sleep architecture with four stages per cycle:
@@ -268,24 +377,48 @@ The TUI features an animated multilingual phrase carousel, live metrics bar with
268
377
 
269
378
  | Command | Description |
270
379
  |---------|-------------|
271
- | `/help` | Show all available commands |
272
- | `/model <name>` | Switch to a different Ollama model |
380
+ | **Model & Endpoint** | |
381
+ | `/model <name>` | Switch to a different model |
382
+ | `/models` | List all available models |
273
383
  | `/endpoint <url>` | Connect to a remote vLLM or OpenAI-compatible API |
384
+ | `/endpoint <url> --auth <key>` | Set endpoint with Bearer auth |
385
+ | **Task Control** | |
386
+ | `/pause` | Pause after current turn finishes (gentle halt) |
387
+ | `/stop` | Kill current inference immediately, save state |
388
+ | `/resume` | Resume a paused or stopped task |
389
+ | `/destroy` | Remove `.oa/` folder, kill all tasks, clear console, exit |
390
+ | **Context & Memory** | |
391
+ | `/context save` | Force-save session context to `.oa/context/` |
392
+ | `/context restore` | Restore context from previous sessions into next task |
393
+ | `/context show` | Show saved session context status |
394
+ | `/compact` | Force context compaction now (default strategy) |
395
+ | `/compact <strategy>` | Compact with strategy: `aggressive`, `decisions`, `errors`, `summary`, `structured` |
396
+ | **Audio & Vision** | |
274
397
  | `/voice [model]` | Toggle TTS voice (GLaDOS, Overwatch) |
275
398
  | `/listen [mode]` | Toggle live microphone transcription |
276
399
  | `/dream [mode]` | Start dream mode (default, deep, lucid) |
277
- | `/stream` | Toggle streaming token display |
400
+ | **Display & Behavior** | |
401
+ | `/stream` | Toggle streaming token display with pastel syntax highlighting |
278
402
  | `/bruteforce` | Toggle brute-force mode (auto re-engage on turn limit) |
279
- | `/tools` | List available tools |
280
- | `/skills` | List/search available skills |
281
- | `/update` | Check for and install updates (seamless reload) |
403
+ | `/verbose` | Toggle verbose mode |
404
+ | **Tools & Skills** | |
405
+ | `/tools` | List agent-created custom tools |
406
+ | `/skills [keyword]` | List/search available AIWG skills |
407
+ | `/<skill-name> [args]` | Invoke an AIWG skill directly |
408
+ | **Metrics & Updates** | |
282
409
  | `/cost` | Show token cost breakdown for the current session |
283
410
  | `/evaluate` | Score the last completed task with LLM-as-judge |
284
- | `/stats` | Show session metrics (turns, tools, tokens, files) |
411
+ | `/stats` | Show session dashboard (turns, tools, tokens, files, task history) |
285
412
  | `/task-type <type>` | Set task type for specialized prompts (code, document, analysis, plan) |
413
+ | `/update` | Check for and install updates (seamless context-preserving reload) |
414
+ | `/update auto\|manual` | Set update mode (auto after task completion, or manual only) |
415
+ | **General** | |
286
416
  | `/config` | Show current configuration |
287
417
  | `/clear` | Clear the screen |
288
- | `/exit` | Quit |
418
+ | `/help` | Show all available commands |
419
+ | `/quit` | Exit |
420
+
421
+ All settings commands accept `--local` to save to project `.oa/settings.json` instead of global config.
289
422
 
290
423
  ### Mid-Task Steering
291
424
 
@@ -300,30 +433,32 @@ While the agent is working (shown by the `+` prompt), type to add context:
300
433
  ⎿ Edit: src/auth.ts
301
434
  ```
302
435
 
303
- ## Tools (35)
436
+ ## Tools (37)
304
437
 
305
438
  | Tool | Description |
306
439
  |------|-------------|
307
440
  | **File Operations** | |
308
- | `file_read` | Read file contents with line numbers (offset/limit) |
309
- | `file_write` | Create or overwrite files |
310
- | `file_edit` | Precise string replacement in files |
441
+ | `file_read` | Read file contents with line numbers (offset/limit for large files) |
442
+ | `file_write` | Create or overwrite files with automatic directory creation |
443
+ | `file_edit` | Precise string replacement in files (preferred over rewriting) |
444
+ | `file_patch` | Edit specific line ranges in large files (replace, insert_before/after, delete) |
311
445
  | `batch_edit` | Multiple edits across files in one call |
312
- | `list_directory` | List directory contents |
446
+ | `list_directory` | List directory contents with types and sizes |
313
447
  | **Search & Navigation** | |
314
- | `grep_search` | Search file contents with regex (ripgrep) |
315
- | `find_files` | Find files by glob pattern |
316
- | `codebase_map` | High-level project structure overview |
448
+ | `grep_search` | Search file contents with regex (ripgrep with grep fallback) |
449
+ | `find_files` | Find files by glob pattern (excludes node_modules/.git) |
450
+ | `codebase_map` | High-level project structure overview with directory tree |
317
451
  | **Shell & Execution** | |
318
- | `shell` | Execute any shell command |
452
+ | `shell` | Execute any shell command (non-interactive, CI=true) |
319
453
  | `code_sandbox` | Isolated code execution (JS, Python, Bash, TS) in subprocess or Docker |
320
- | `background_run` | Run shell command in background |
454
+ | `background_run` | Run shell command in background, returns task ID |
321
455
  | `task_status` | Check background task status |
322
456
  | `task_output` | Read background task output |
323
457
  | `task_stop` | Stop a background task |
324
458
  | **Web** | |
325
459
  | `web_search` | Search the web (DuckDuckGo, Tavily, Jina AI — auto-detected) |
326
- | `web_fetch` | Fetch and extract text from web pages |
460
+ | `web_fetch` | Fetch and extract text from web pages (HTML stripping) |
461
+ | `web_crawl` | Multi-page web scraping with Crawlee/Playwright for deep documentation |
327
462
  | **Structured Data** | |
328
463
  | `structured_file` | Generate CSV, TSV, JSON, Markdown tables, Excel-compatible files |
329
464
  | `read_structured_file` | Parse CSV, TSV, JSON, Markdown tables with binary detection |
@@ -332,24 +467,27 @@ While the agent is working (shown by the `+` prompt), type to add context:
332
467
  | `desktop_click` | Vision-guided clicking: describe a UI element, agent finds and clicks it |
333
468
  | `desktop_describe` | Screenshot + Moondream caption/query for desktop awareness |
334
469
  | `image_read` | Read images (base64 + OCR) |
335
- | `screenshot` | Capture screen/window |
336
- | `ocr` | Extract text from images (Tesseract) |
470
+ | `screenshot` | Capture screen/window/active window |
471
+ | `ocr` | Extract text from images (Tesseract with multi-variant preprocessing) |
472
+ | `ocr_pdf` | Add searchable text layer to scanned/image PDFs |
473
+ | `pdf_to_text` | Extract text from PDF using pdftotext (Poppler) |
474
+ | `transcribe_file` | Transcribe audio/video to text (Whisper) |
337
475
  | **Memory & Knowledge** | |
338
- | `memory_read` | Read from persistent memory store |
339
- | `memory_write` | Store patterns for future sessions |
476
+ | `memory_read` | Read from persistent memory store by topic |
477
+ | `memory_write` | Store facts/patterns in persistent memory with provenance tracking |
478
+ | `memex_retrieve` | Recover full tool output archived during context compaction by hash ID |
340
479
  | **Git & Diagnostics** | |
341
- | `diagnostic` | Lint/typecheck/test/build validation pipeline |
342
- | `git_info` | Structured git status, log, diff, branch info |
480
+ | `diagnostic` | Lint/typecheck/test/build validation pipeline in one call |
481
+ | `git_info` | Structured git status, log, diff, branch, staged/unstaged files |
343
482
  | **Agents & Skills** | |
344
- | `sub_agent` | Delegate to an independent agent |
345
- | `create_tool` | Create reusable custom tools at runtime |
483
+ | `create_tool` | Create reusable custom tools from workflow at runtime |
346
484
  | `manage_tools` | List, inspect, delete custom tools |
347
485
  | `skill_list` | Discover available AIWG skills |
348
486
  | `skill_execute` | Run an AIWG skill |
349
487
  | **AIWG SDLC** | |
350
488
  | `aiwg_setup` | Deploy AIWG SDLC framework |
351
- | `aiwg_health` | Analyze SDLC health |
352
- | `aiwg_workflow` | Execute AIWG workflows |
489
+ | `aiwg_health` | Analyze project SDLC health and readiness |
490
+ | `aiwg_workflow` | Execute AIWG commands and workflows |
353
491
 
354
492
  Read-only tools execute concurrently when called in the same turn. Mutating tools run sequentially.
355
493
 
@@ -366,6 +504,41 @@ On startup and `/model` switch, Open Agents detects your RAM/VRAM and creates an
366
504
  | 8GB+ | 8K tokens |
367
505
  | < 8GB | 4K tokens |
368
506
 
507
+ ## Model-Tier Awareness
508
+
509
+ Open Agents classifies models into three tiers and adapts its behavior accordingly:
510
+
511
+ | Tier | Parameters | Base Tools | System Prompt | Compaction |
512
+ |------|-----------|------------|---------------|------------|
513
+ | **Large** (≥30B) | 70B, 122B | All 37 tools | Full (344 lines) | 40K threshold |
514
+ | **Medium** (8-29B) | 9B, 27B | 15 core tools | Condensed (100 lines) | 24K threshold |
515
+ | **Small** (≤7B) | 4B, 1.5B | 6 base tools + explore_tools | Minimal (15 lines) | 12K threshold |
516
+
517
+ ### Tool Nesting for Small Models
518
+
519
+ Small models use an **explore_tools** meta-tool pattern inspired by hierarchical API retrieval research (ToolLLM, arXiv:2307.16789). Instead of presenting all 37 tools (which overwhelms small context windows), only 6 core tools are loaded initially:
520
+
521
+ - `file_read`, `file_write`, `file_edit`, `shell`, `task_complete`, `explore_tools`
522
+
523
+ The agent can call `explore_tools()` to see a catalog of additional tools with one-line descriptions, then `explore_tools(enable="grep_search")` to unlock specific tools as needed. This reduces tool schema tokens by ~80% while preserving access to the full toolset.
524
+
525
+ This approach is substantiated by:
526
+ - **Gorilla** (arXiv:2305.15334) — 7B model with retrieval outperforms GPT-4 on tool-calling hallucination rate
527
+ - **DFSDT** (arXiv:2307.16789) — ToolLLaMA-7B with depth-first search scored 66.7%, approaching GPT-4's 70.4%
528
+ - **Octopus v2** (arXiv:2404.01744) — 2B model achieved 99.5% function-calling accuracy with context-efficient tool encoding
529
+
530
+ ### Dynamic Context Limits
531
+
532
+ All context-dependent values scale automatically with the actual context window size:
533
+
534
+ | Setting | How It Scales |
535
+ |---------|---------------|
536
+ | Compaction threshold | min(tier default, 75% of context window) |
537
+ | Recent messages kept | 1 message per 2-4K of context (tier-dependent) |
538
+ | Max output tokens | 25% of context window (min 2048) |
539
+ | Tool output cap | 2K-8K chars (scales with context) |
540
+ | File read limits | 80-120 line cap for small/medium context windows |
541
+
369
542
  ## Voice Feedback (TTS)
370
543
 
371
544
  ```bash
@@ -476,13 +649,16 @@ Create `AGENTS.md`, `OA.md`, or `.open-agents.md` in your project root for agent
476
649
  ```
477
650
  .oa/
478
651
  ├── config.json # Project config overrides
479
- ├── settings.json # TUI settings
480
- ├── memory/ # Persistent memory store
652
+ ├── settings.json # TUI settings (model, endpoint, voice, stream, etc.)
653
+ ├── memory/ # Persistent memory store (topics, patterns, facts)
481
654
  ├── dreams/ # Dream mode proposals & checkpoints
482
655
  ├── transcripts/ # Audio/video transcriptions
483
656
  ├── index/ # Cached codebase index
484
- ├── context/ # Auto-generated project context
485
- └── history/ # Session history
657
+ ├── context/ # Session context persistence
658
+ └── session-context.json # Rolling 20-entry context window
659
+ ├── session/ # Compaction summaries for crash recovery
660
+ ├── history/ # Session history
661
+ └── pending-task.json # Saved task state for /stop and /update resume
486
662
  ```
487
663
 
488
664
  ## Model Support
@@ -541,10 +717,10 @@ The agent auto-detects the provider, normalizes the URL (strips `/v1/chat/comple
541
717
 
542
718
  ## Evaluation Suite
543
719
 
544
- 23 evaluation tasks test the agent's autonomous capabilities across coding, web research, SDLC analysis, and tool creation:
720
+ 33 evaluation tasks test the agent's autonomous capabilities across coding, web research, SDLC analysis, tool creation, and multi-file reasoning:
545
721
 
546
722
  ```bash
547
- node eval/run-agentic.mjs # Run all 23 tasks
723
+ node eval/run-agentic.mjs # Run all tasks
548
724
  node eval/run-agentic.mjs 04-add-test # Single task
549
725
  node eval/run-agentic.mjs --model qwen2.5-coder:32b # Different model
550
726
  ```
@@ -574,15 +750,23 @@ node eval/run-agentic.mjs --model qwen2.5-coder:32b # Different model
574
750
  | 21 | Large file patch | Precision Editing |
575
751
  | 22 | Skill discovery | Skill System |
576
752
  | 23 | Skill execution | Skill System |
753
+ | 24-30 | Additional coding tasks | Various |
754
+ | 31 | Web extractor bug fixes (3 bugs) | Multi-Bug Fix |
755
+ | 32 | CSV pipeline across 3 files | Multi-File Tracking |
756
+ | 33 | FSM bug fixes + factory implementation | State Machine |
757
+
758
+ Tasks 31-33 are designed for small model (≤9B) evaluation using `file_edit` patterns instead of `file_write` to avoid JSON truncation issues with smaller models.
577
759
 
578
- ### Benchmark Results (Qwen3.5-122B)
760
+ ### Benchmark Results
579
761
 
580
762
  ```
581
- Pass rate: 100% (8/8 core tasks)
582
- Total: 39 turns, 55 tool calls, ~10 minutes
583
- Average: 4.9 turns/task, 6.9 tools/task
763
+ Qwen3.5-122B: 100% pass rate (30/30 tasks)
764
+ Qwen3.5-27B: 100% pass rate (30/30 tasks)
765
+ Qwen3.5-9B: 100% pass rate (tasks 31-33, file_edit-optimized)
584
766
  ```
585
767
 
768
+ The eval runner includes model-tier-aware features: automatic tool set filtering, HTTP 500 recovery with file_edit hints, loop detection with tool banning, and tier-based output truncation.
769
+
586
770
  ## AIWG Integration
587
771
 
588
772
  Open Agents integrates with [AIWG](https://www.npmjs.com/package/aiwg) for AI-augmented software development:
@@ -602,10 +786,12 @@ oa "analyze this project's SDLC health and set up documentation"
602
786
 
603
787
  ## Architecture
604
788
 
605
- The core is `AgenticRunner` — a multi-turn tool-calling loop:
789
+ The core is `AgenticRunner` — a multi-turn tool-calling loop with context management:
606
790
 
607
791
  ```
608
792
  User task → System prompt + tools → LLM → tool_calls → Execute → Feed results → LLM
793
+ ↓ ↑
794
+ Compaction check ─── Memex archive ─── Context restore
609
795
  (repeat until task_complete or max turns)
610
796
  ```
611
797
 
@@ -614,6 +800,8 @@ User task → System prompt + tools → LLM → tool_calls → Execute → Feed
614
800
  - **Parallel-safe** — read-only tools concurrent, mutating tools sequential
615
801
  - **Observable** — every tool call and result emitted as a real-time event
616
802
  - **Bounded** — max turns, timeout, output limits prevent runaway loops
803
+ - **Context-aware** — dynamic compaction, Memex archiving, session persistence, model-tier scaling
804
+ - **Brute-force** — optional auto re-engagement when turn limit is hit (keeps going until task_complete or user abort)
617
805
 
618
806
  ## License
619
807
 
package/dist/index.js CHANGED
@@ -22029,6 +22029,19 @@ import { createRequire as createRequire2 } from "node:module";
22029
22029
  import { fileURLToPath as fileURLToPath7 } from "node:url";
22030
22030
  import { readFileSync as readFileSync18, rmSync as rmSync2 } from "node:fs";
22031
22031
  import { existsSync as existsSync24 } from "node:fs";
22032
+ function formatTimeAgo(date) {
22033
+ const seconds = Math.floor((Date.now() - date.getTime()) / 1e3);
22034
+ if (seconds < 60)
22035
+ return "just now";
22036
+ const minutes = Math.floor(seconds / 60);
22037
+ if (minutes < 60)
22038
+ return `${minutes}m ago`;
22039
+ const hours = Math.floor(minutes / 60);
22040
+ if (hours < 24)
22041
+ return `${hours}h ago`;
22042
+ const days = Math.floor(hours / 24);
22043
+ return `${days}d ago`;
22044
+ }
22032
22045
  function getVersion() {
22033
22046
  try {
22034
22047
  const require2 = createRequire2(import.meta.url);
@@ -22699,6 +22712,7 @@ async function startInteractive(config, repoPath) {
22699
22712
  let sessionFilesTouched = [];
22700
22713
  let sessionToolCallCount = 0;
22701
22714
  let restoredSessionContext = null;
22715
+ let pendingSessionRestore = false;
22702
22716
  let sessionSudoPassword = null;
22703
22717
  let sudoPromptPending = false;
22704
22718
  const idlePrompt = `${c2.bold(c2.white("\u276F "))}`;
@@ -23123,6 +23137,24 @@ async function startInteractive(config, repoPath) {
23123
23137
  }
23124
23138
  };
23125
23139
  showPrompt();
23140
+ if (!isResumed) {
23141
+ const savedCtx = loadSessionContext(repoRoot);
23142
+ if (savedCtx && savedCtx.entries.length > 0) {
23143
+ const lastEntry = savedCtx.entries[savedCtx.entries.length - 1];
23144
+ const lastTime = lastEntry.savedAt ? new Date(lastEntry.savedAt) : null;
23145
+ const timeAgo = lastTime ? formatTimeAgo(lastTime) : "unknown";
23146
+ const lastTask = lastEntry.task?.slice(0, 80) || "unknown";
23147
+ setTimeout(() => {
23148
+ writeContent(() => {
23149
+ renderInfo(`Previous session found (${savedCtx.entries.length} entries, last active ${timeAgo})`);
23150
+ renderInfo(`Last task: ${lastTask}${lastEntry.task && lastEntry.task.length > 80 ? "..." : ""}`);
23151
+ renderInfo(`Restore previous context? (y/n)`);
23152
+ });
23153
+ showPrompt();
23154
+ pendingSessionRestore = true;
23155
+ }, 150);
23156
+ }
23157
+ }
23126
23158
  if (hasTaskToResume) {
23127
23159
  const pendingTask = loadPendingTask(repoRoot);
23128
23160
  if (pendingTask) {
@@ -23166,6 +23198,22 @@ ${sessionCtx}` : "",
23166
23198
  }
23167
23199
  rl.on("line", (line) => {
23168
23200
  const input = line.trim();
23201
+ if (pendingSessionRestore) {
23202
+ pendingSessionRestore = false;
23203
+ const answer = input.toLowerCase();
23204
+ if (answer === "y" || answer === "yes") {
23205
+ const prompt = buildContextRestorePrompt(repoRoot);
23206
+ if (prompt) {
23207
+ restoredSessionContext = prompt;
23208
+ const info = loadSessionContext(repoRoot);
23209
+ writeContent(() => renderInfo(`Context restored from ${info?.entries.length ?? 0} session(s). Will be injected into your next task.`));
23210
+ }
23211
+ } else {
23212
+ writeContent(() => renderInfo("Starting fresh."));
23213
+ }
23214
+ showPrompt();
23215
+ return;
23216
+ }
23169
23217
  if (!input) {
23170
23218
  if (pasteBuffer.length > 0) {
23171
23219
  flushPasteBuffer();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.32.1",
3
+ "version": "0.32.2",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",