-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllms-full.txt
More file actions
1852 lines (1293 loc) · 65.1 KB
/
llms-full.txt
File metadata and controls
1852 lines (1293 loc) · 65.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# AbstractCode (llms-full)
> Full, unabridged content of the core documentation files for this repo.
> Contains docs and project policies; it does not inline source code (see `llms.txt`).
> Recommended: use `llms.txt` as the index when link-fetching is available; use `llms-full.txt` for offline/single-file context.
> Generated from the files listed below. Relative Markdown links are normalized to repo-root paths.
> If you update docs/policies, regenerate this file.
> Last generated: 2026-02-09
Files included (source):
- `README.md`
- `CHANGELOG.md`
- `CHANGELOD.md`
- `CONTRIBUTING.md`
- `SECURITY.md`
- `ACKNOWLEDMENTS.md`
- `ACKNOWLEDGMENTS.md`
- `docs/getting-started.md`
- `docs/README.md`
- `docs/architecture.md`
- `docs/cli.md`
- `docs/api.md`
- `docs/faq.md`
- `docs/workflows.md`
- `docs/ui_events.md`
- `docs/web.md`
- `docs/deployment-web.md`
- `docs/deployment-iphone.md`
---
<!-- FILE: README.md -->
# AbstractCode
Durable terminal TUI for agentic coding on the AbstractFramework stack (**AbstractAgent + AbstractRuntime + AbstractCore**).
Status: **pre-alpha** (APIs and UX may change).
Next: [`docs/getting-started.md`](docs/getting-started.md).
## AbstractFramework ecosystem
AbstractCode is part of **AbstractFramework**:
- [AbstractFramework](https://github.com/lpalbou/AbstractFramework)
- [AbstractCore](https://github.com/lpalbou/abstractcore) (providers + tools)
- [AbstractRuntime](https://github.com/lpalbou/abstractruntime) (durable runs)
## Features
- Interactive TUI (`abstractcode`) with **durable runs** (resume/pause/cancel), snapshots, and logs
- **Approval-gated tools** by default (with an allowlist you can configure)
- Built-in agents: `react`, `memact`, `codeact` (from `abstractagent`)
- Plan + Review modes (`--plan`, `--review`; `/plan`, `/review`)
- VisualFlow workflows:
- run locally: `abstractcode flow ...` (optional extra)
- run as an agent: `abstractcode --agent <flow_ref>`
- Remote tool execution via **MCP** (`/mcp`, `/executor`)
- Optional gateway-first Web UI in `web/`
## How it fits together (diagram)
```mermaid
flowchart LR
U[User] --> AC[AbstractCode\n(TUI/CLI host)]
AC --> AA[AbstractAgent\n(agent logic)]
AC --> AR[AbstractRuntime\n(durable execution)]
AR --> CORE[AbstractCore\n(LLM providers + tools)]
AC -->|approve| TOOLS[Local tools]
AC <--> MCP[MCP servers\n(remote tools)]
WEB[web/\n(browser host)] <--> GW[AbstractGateway\n(/api/gateway/*)]
AC -. optional .-> GW
```
## Install
Python: **3.10+**
```bash
pip install abstractcode
```
Optional (run VisualFlow locally via `abstractcode flow ...`):
```bash
pip install "abstractcode[flow]"
```
From source (development):
```bash
pip install -e ".[dev]"
```
## Quickstart (TUI)
Ollama (default provider):
```bash
abstractcode --provider ollama --model qwen3:1.7b-q4_K_M
```
OpenAI-compatible server (e.g. LM Studio):
```bash
abstractcode --provider openai --base-url http://127.0.0.1:1234/v1 --model qwen/qwen3-next-80b
```
Inside the app:
- `/help` shows the authoritative command list
- type a task (or use `/task ...`)
- tool approvals: `/auto-accept` (or start with `--auto-approve`)
- attach files with `@path/to/file` in your prompt
## Persistence (durable runs)
Default paths:
- state file: `~/.abstractcode/state.json`
- durable stores: `~/.abstractcode/state.d/`
- saved settings: `~/.abstractcode/state.config.json`
Disable persistence:
```bash
abstractcode --no-state
```
## Workflows
- Local runs: `abstractcode flow run <flow_id_or_path> ...` (requires `abstractcode[flow]`)
- Workflow agent: `abstractcode --agent /path/to/workflow.json ...`
- Remote control-plane: `abstractcode gateway --help`
- Bundle management on a gateway: `abstractcode workflow --help`
Details: [`docs/workflows.md`](docs/workflows.md).
## Web UI
The web host lives in `web/` and connects to an **AbstractGateway** at `/api/gateway/*`.
Start here:
- [`docs/web.md`](docs/web.md)
- [`docs/deployment-web.md`](docs/deployment-web.md)
## Documentation
- Start here: [`docs/getting-started.md`](docs/getting-started.md)
- FAQ: [`docs/faq.md`](docs/faq.md)
- Docs index: [`docs/README.md`](docs/README.md)
- Agent-oriented docs: [`llms.txt`](llms.txt) and [`llms-full.txt`](llms-full.txt)
- [`docs/architecture.md`](docs/architecture.md)
- [`docs/cli.md`](docs/cli.md)
- [`docs/api.md`](docs/api.md)
- [`docs/workflows.md`](docs/workflows.md)
- [`docs/ui_events.md`](docs/ui_events.md)
## Development
```bash
pip install -e ".[dev]"
pytest -q
ruff check .
black .
```
## Project
- Changelog: [`CHANGELOG.md`](CHANGELOG.md)
- Contributing: [`CONTRIBUTING.md`](CONTRIBUTING.md)
- Security: [`SECURITY.md`](SECURITY.md)
- Acknowledgments: [`ACKNOWLEDMENTS.md`](ACKNOWLEDMENTS.md)
## License
MIT. See [`LICENSE`](LICENSE).
---
<!-- FILE: CHANGELOG.md -->
# Changelog
All notable changes to AbstractCode will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.3.1] - 2026-02-04
### Added
- **Workflow-driven UI events (network-safe)**:
- Workflows can emit `Emit Event(name="abstract.message")` to show a message/notification in AbstractCode.
- Workflows can emit `Emit Event(name="abstract.tool_execution")` and `Emit Event(name="abstract.tool_result")` to render tool-call + tool-result UX blocks (without requiring actual tool execution).
- `WAIT_EVENT` can carry a `prompt` so workflows can do durable ask+wait under `WaitReason.EVENT` (useful for thin clients); AbstractCode will prompt and resume.
- `abstract.status` payload supports `duration` (seconds): default `-1` (sticky), `> 0` auto-clears unless superseded.
- Tool event payloads can be a **single object or a list** (e.g., wire `LLM Call.tool_calls` / `Tool Calls.results` directly into an `Emit Event`).
- Backward compatibility: `abstractcode.*` remains a deprecated alias accepted by existing hosts.
- **Documentation refresh for public release**: clearer user-facing docs (`docs/getting-started.md`, `docs/architecture.md`, `docs/cli.md`, `docs/api.md`, `docs/faq.md`) plus `SECURITY.md`, `CONTRIBUTING.md`, and `ACKNOWLEDMENTS.md`.
### Fixed
- Align package version metadata and `abstractcode.__version__`.
- `/help` now shows the correct `/gpu [status|on|off]` usage.
## [0.3.0] - 2026-02-03
### Added
- **Workflow Agent Support** (`abstractcode/workflow_agent.py`): Run VisualFlow workflows as first-class agents via `abstractcode --agent <flow_id|flow_name|/path/to/flow.json>`
- `abstractcode.agent.v1` interface contract requires host-configurable `provider`/`model`/`tools` start pins (in addition to `prompt`/`response`)
- Workflows can emit `Emit Event(name="abstract.status")` to update TUI footer status text in real time
- `On Flow End.meta` (and optional `scratchpad`/`success`) surfaced as assistant-message metadata (`workflow_meta`, `workflow_scratchpad`, `workflow_success`)
- File-backed persistence support for durable workflow execution
- Documented in README with usage examples
- **MCP (Model Context Protocol) Integration**: Connect to remote MCP servers for tool execution
- `/mcp` command to configure and manage MCP server connections
- `/executor` command to set default tool executor (local vs remote MCP server, session-persistent)
- Automatic tool synchronization from MCP servers
- Spinner feedback for remote MCP tool calls
- Support for stdio-based MCP servers
- MCP tools integrated into native tool allowlist
- **Enhanced History Commands**:
- `/history copy` command to copy full conversation history to clipboard
- **Collapsible Thought/Tool Blocks**: Tool-using iterations now render **Thought** and **Tool Call** as **click-to-toggle** blocks (collapsed by default) with high-signal one-line summary always visible
- **Spinner Shimmer**: Status bar spinner text has subtle **reflect/shimmer** highlight traversing the entire text so "still working" is obvious without re-rendering scrollback
- **`/logs provider --no-tool-defs`**: Optionally replace provider request `tools` array (full tool definitions) with array of tool names for compact sharing/debugging
- **Terminal Markdown Module** (`abstractcode/terminal_markdown.py`): Dedicated module for rendering Markdown in terminal with newline unescaping
- **New Test Coverage**:
- Workflow agent tests (`test_workflow_agent.py`)
- MCP remote tool execution tests (`test_remote_mcp_tool_execution.py`, `test_remote_mcp_tool_execution_stdio.py`)
- Repeat guardrail tests (`test_repeat_guardrail_write_file_content.py`)
- Tool examples toggle tests (`test_tools_examples_toggle.py`)
- History copy tests (`test_history_copy_full_to_clipboard.py`)
- Executor command tests (`test_executor_command.py`, `test_executor_real_logic.py`)
- Spinner shimmer tests (`test_fullscreen_ui_spinner_shimmer.py`)
- Log provider tests (`test_log_provider_no_tool_defs.py`, `test_log_provider_tool_calls_anthropic.py`)
- Answer markdown tests (`test_answer_markdown_newline_unescape.py`)
### Changed
- **`/clear`**: Now clears the screen (UI output) in addition to clearing in-memory conversation context
- **`/memorize`**: Renamed from memory-note command to **Memorize** (consistent UX term) to avoid ambiguity with span tagging
- **`/recall`**: Richer filtering and rehydration controls:
- Added `--tags-mode all|any`, repeatable `--user NAME`, and repeatable `--location LOC`
- Repeating `--tag k=v` now builds multi-value tags (e.g. `--tag person=alice --tag person=bob`)
- `--into-context` now also rehydrates matching `memory_note` spans as synthetic system message (`[MEMORY NOTE] ...`)
- **Logging Commands**: Replaced legacy `/context` + `/llm` with `/logs runtime` + `/logs provider` (no backward compatibility)
- `/logs provider` now reads from durable ledger and includes **all LLM provider calls in current session** (across runs) unless `--run` is used
- `/logs provider` renders OpenAI/LMS-style "Received request … Generated prediction …" blocks (no truncation)
- `/logs runtime ... copy` and `/logs provider ... copy` now accept `copy` as trailing token and copy without rendering
- **Verifier (Review) Mode**: Now enabled by default to prevent premature "stops" when model returns incomplete prose without tool calls
- Added `--no-review` to disable (not recommended)
- Default `--review-max-rounds` increased to 3
- **Tool Prompt Examples**: Now **off by default** to avoid large token overhead; use `/tools examples on` to enable
- **Output Versioning**: FullScreenUI now uses output versioning and caching for improved render performance
- **Scrolling Behavior**: Enhanced scrolling in FullScreenUI with better page up/down and smooth scroll support
### Fixed
- **Spinner Shimmer Sweep**: Status bar spinner shimmer now traverses **entire** spinner text (previously capped to first ~10 visible characters)
- **Tool Result Visibility**: Increased default tool observation preview to **1000 characters** (was 120) so small-but-critical outputs (e.g. exit codes, working directories) not silently truncated in UI
- **ANSWER Newline Rendering**: Unescape literal `\n` / `\r\n` sequences into real line breaks before terminal Markdown rendering, so multi-line answers display correctly
- **Web Search Reliability**: Added `ddgs>=9.10.0` as dependency so default `web_search` tool works without manual installs
- **Native Tools Prompt Accounting**: ReactShell token estimation now excludes full `Tools (session)` Active Memory catalog for **native-tool models**, matching prompt actually sent to OpenAI-compatible servers (e.g. LMStudio)
- **LLM-Call Payload Observability**: `/logs provider` shows verbatim provider request/response (`_provider_request` + `raw_response`), `/logs runtime` shows durable runtime step trace for LLM/tool calls
- **`/logs provider` Tool-Call Detection**: Best-effort tool-call summary now detects Anthropic `tool_use` blocks in addition to OpenAI-style `tool_calls`
- **Repeat Guardrail**: Reset duplicate-tool-call caches on **new runs** and **/cancel**, block `write_file` calls missing `content` to prevent repeated 0‑byte file writes
- **File Tool CWD Injection**: File tools (read/write/edit) no longer inject `cwd` into UI preview, preventing confusion when relative paths shown
- **Async Run Controls**: Improved async handling for pause/resume/cancel controls
- **Flow CLI Entry Validation**: Added required entry inputs validation in CLI flow commands
### Removed
- **`/new`, `/reset`**: Removed alias commands (identical to `/clear`). Use `/clear`
- **Legacy `/context`, `/llm`**: Removed in favor of `/logs runtime` and `/logs provider`
### Technical Details
- **44 commits**, **30 files changed**: 8,731 insertions, 756 deletions
- New modules: `workflow_agent.py` (721 lines), `terminal_markdown.py` (168 lines)
- 15 new test files covering workflow agents, MCP integration, repeat guardrails, and UI enhancements
- AbstractCore dependency updated to include `[tools]` extras for web search reliability
- Enhanced ReactShell with MCP client management, executor configuration, and improved token estimation
### Migration Notes
- Legacy `/context` and `/llm` commands removed; use `/logs runtime` and `/logs provider` instead
- Tool prompt examples now off by default; enable with `/tools examples on` if needed
- Verifier (review) mode now enabled by default; disable with `--no-review` if unwanted
## [0.2.0] - 2025-12-17
### Initial Release
AbstractCode is an interactive terminal CLI for multi-agent agentic coding, providing a clean and powerful interface for AI-assisted development workflows.
#### Core Features
**Interactive Terminal Interface**
- Full-screen terminal UI built with prompt_toolkit featuring scrollable output, ANSI color support, and mouse interaction
- Clean command-line interface with slash-prefixed commands (`/help`, `/status`, `/task`, etc.)
- Real-time status bar showing provider, model, and context token usage
- Animated spinner with visual feedback during agent reasoning
- Multi-line input support with command history and autocomplete
**Multi-Agent Support**
- React agent with thought-action-observation reasoning loops
- CodeAct agent with Python code execution capabilities
- Configurable iteration limits (default: 25) and context tokens (default: 32768)
- Multiple LLM provider support (Ollama, OpenAI, and more via AbstractCore)
- Dynamic model selection with per-provider configuration
**Built-in Tool Suite**
- `list_files` - Find and list files using glob patterns
- `search_files` - Search file contents with regex patterns
- `read_file` - Read files with optional line range selection
- `write_file` - Write to files with automatic directory creation
- `edit_file` - Edit files using regex or line-based replacements
- `execute_command` - Execute shell commands with security gating
- `web_search` - Search the web via DuckDuckGo (no API key required)
- `fetch_url` - Fetch and process web content
**State Management & Persistence**
- Durable file-backed state with JSON storage (`~/.abstractcode/state.json`)
- Directory-based stores for run, ledger, and snapshot persistence
- Session resumption with conversation history restoration
- Named snapshots for saving and loading specific run states
- Optional in-memory mode for ephemeral sessions
**Security & Safety**
- Interactive tool approval with detailed argument preview
- Per-tool approval flow with yes/no/all/edit/quit options
- Argument editing in JSON format before execution
- Double-confirmation required for shell command execution
- Session-based "approve all" mode with persistence
- Optional auto-approve mode for non-interactive use
**Context & Memory Management**
- Conversation history tracking with `/history` command
- Memory usage breakdown by component (`/memory` command)
- Intelligent conversation compaction with three modes:
- Light compression (minimal reduction)
- Standard compression (balanced approach)
- Heavy compression (aggressive reduction)
- Configurable message preservation for recent context
- Focus-based summarization to maintain topic coherence
**Configuration & Customization**
- Persistent configuration file (`*.config.json`) for saved settings
- Environment variables for default agent type, state file location, and limits
- CLI arguments for provider, model, iterations, tokens, and behavior
- Runtime commands for adjusting max tokens, max messages, and auto-approve
- Color output with `NO_COLOR` environment variable support
**Interactive Commands**
Task Management:
- `/task <description>` - Start a new task
- `/resume` - Resume the last saved or waiting run
- `/clear` (aliases: `/reset`, `/new`) - Clear memory and start fresh
Information & Status:
- `/help` - Display all available commands
- `/tools` - List available tools with descriptions
- `/status` - Show current run ID, workflow, status, and waiting reason
- `/history [N]` - Display recent conversation history
- `/memory` - Show token usage breakdown
Configuration:
- `/auto-accept [on|off]` - Toggle auto-approve for tool execution
- `/max-tokens [N]` - Show or set maximum context tokens (-1 for auto-detection)
- `/max-messages [N]` - Show or set maximum history messages
- `/compact [mode] [--preserve N]` - Compress conversation with configurable preservation
Snapshots:
- `/snapshot save <name>` - Save current run state as named snapshot
- `/snapshot load <name>` - Load a saved snapshot by name
- `/snapshot list` - List all available snapshots
**Keyboard & Mouse Controls**
- Enter - Submit input
- Up/Down arrows - Navigate command history or completion menu
- Page Up/Page Down - Scroll output area
- Home/End - Jump to top or bottom of output
- Ctrl+Up/Ctrl+Down - Smooth scroll output
- Ctrl+L - Clear output area
- Ctrl+C/Ctrl+D - Exit application
- Mouse wheel - Scroll output area
- Mouse click - Position cursor in input
**Technical Architecture**
- Thread-safe multi-threaded design with worker, spinner, and render threads
- Atomic ANSI parsing with cached snapshots to prevent race conditions
- Integration with AbstractCore for LLM capabilities
- Integration with AbstractRuntime for workflow orchestration
- Integration with AbstractAgent for agent implementations
- Efficient lazy imports for fast `--help` response time
- Graceful error handling with state preservation on interruption
#### Dependencies
**Required:**
- `prompt_toolkit>=3.0.0` - Terminal UI framework
**Implicit (from AbstractCore/AbstractRuntime/AbstractAgent):**
- AbstractCore for LLM provider abstraction
- AbstractRuntime for workflow and state management
- AbstractAgent for React and CodeAct agent implementations
#### Installation
```bash
pip install abstractcode
```
#### Quick Start
```bash
# Start with default settings (Ollama + qwen3:1.7b)
abstractcode
# Use a specific provider and model
abstractcode --provider openai --model gpt-4o-mini
# Use CodeAct agent with auto-approve
abstractcode --agent codeact --auto-approve
# Disable state persistence
abstractcode --no-state
# Set custom iteration and token limits
abstractcode --max-iterations 50 --max-tokens 64000
```
#### Example Session
```bash
$ abstractcode
AbstractCode v0.2.0 | Provider: ollama | Model: qwen3:1.7b
> Create a Python script that analyzes a CSV file
🤖 Thinking: I'll create a CSV analysis script using pandas...
🔧 Tool: write_file
File: analyze_csv.py
[Approve] (y/n/all/edit/quit): y
✓ File written successfully
🤖 The script has been created. Would you like me to test it?
> yes, test it with a sample CSV
[Agent continues working...]
Commands: /help | /status | /tools | /history | /clear
```
---
## Versioning Notes
- **0.2.0**: Initial public release with full feature set
- **0.1.0**: Internal development version
---
[0.2.0]: https://github.com/lpalbou/abstractcode/releases/tag/v0.2.0
---
<!-- FILE: CHANGELOD.md -->
# Changelog
This repository’s changelog is maintained in [`CHANGELOG.md`](CHANGELOG.md).
This file exists only as a convenience for common typos and external references.
---
<!-- FILE: CONTRIBUTING.md -->
# Contributing to AbstractCode
Thanks for taking the time to contribute. This project is still **pre-alpha**, so feedback, bug reports, and small focused PRs are especially valuable.
AbstractCode is part of the **AbstractFramework** ecosystem:
- [AbstractFramework](https://github.com/lpalbou/AbstractFramework)
- [AbstractCore](https://github.com/lpalbou/abstractcore)
- [AbstractRuntime](https://github.com/lpalbou/abstractruntime)
## Quick links
- Getting started: [`docs/getting-started.md`](docs/getting-started.md)
- Architecture: [`docs/architecture.md`](docs/architecture.md)
- CLI reference: [`docs/cli.md`](docs/cli.md)
- Docs index: [`docs/README.md`](docs/README.md)
## Development setup
Prereqs:
- Python **3.10+**
- (Optional) Node.js if you work on the web app (`web/`)
Install in editable mode with dev tools:
```bash
pip install -e ".[dev]"
```
Run tests:
```bash
pytest -q
```
Format and lint:
```bash
ruff check .
black .
```
## What to include in a PR
- A clear description of the problem and the approach.
- Tests for behavior changes (or a short explanation if a test is not practical).
- Docs updates when you change CLI flags/commands or UX behavior (prefer evidence-backed notes pointing to the relevant files/functions).
- Changelog entry if the change is user-facing (see [`CHANGELOG.md`](CHANGELOG.md)).
## Reporting bugs / feature requests
If you found a bug or want a feature:
- Prefer a minimal reproducible example and include:
- OS + Python version
- `abstractcode --help` output (or version)
- what you expected vs what happened
Security issues: please follow [`SECURITY.md`](SECURITY.md).
## Web app contributions
The web app lives in `web/`. Local development currently depends on shared UI packages via Vite path aliases.
See:
- [`docs/web.md`](docs/web.md)
- [`docs/deployment-web.md`](docs/deployment-web.md)
---
<!-- FILE: SECURITY.md -->
# Security policy
We take security seriously and appreciate responsible disclosure.
## Reporting a vulnerability
Please **do not** open a public GitHub issue for security reports.
Preferred options:
1) If GitHub Security Advisories are enabled for this repository, open a **private** security advisory.
2) Otherwise, email: `contact@abstractcore.ai`
Include as much of the following as you can:
- affected version(s)
- impact assessment (what an attacker can do)
- steps to reproduce (or a PoC)
- logs/error output if relevant
- whether you discovered it in a default configuration
- whether it also affects upstream components (AbstractCore / AbstractRuntime / AbstractAgent), if known
## Coordinated disclosure
We’ll acknowledge receipt and work with you on a coordinated timeline for a fix and release. If you need a specific credit line in release notes, mention it in your report.
---
<!-- FILE: ACKNOWLEDMENTS.md -->
# Acknowledgments
AbstractCode is built on (and inspired by) a lot of open-source work — thank you.
## Where dependencies are declared
- Python: `pyproject.toml`
- Web UI: `web/package.json` (and the fully resolved tree in `web/package-lock.json`)
- Web UI local packages: `web/vite.config.ts` aliases (`../../abstractuic/*`)
## Runtime dependencies (Python)
Declared in `pyproject.toml`:
- `abstractagent` — built-in agents (`react`, `memact`, `codeact`)
- `abstractruntime` — durable runs, stores, snapshots, and workflow execution
- `abstractcore[tools,media]` — provider/model abstraction + tools + rich media handling
- `prompt_toolkit` — interactive terminal UI (TUI)
- `ddgs` — DuckDuckGo-backed search backend used by the default `web_search` tool
## Optional extras (Python)
- `abstractflow` — VisualFlow execution (`pip install "abstractcode[flow]"`, declared in `pyproject.toml`)
- `abstractmemory` — optional memory/knowledge graph integration (imported in `abstractcode/react_shell.py`, not installed by default)
## Web UI dependencies (TypeScript/React)
Declared in `web/package.json`:
- `react`, `react-dom` — UI framework
- `vite`, `typescript` — build toolchain
- `vitest` — tests
- `@monaco-editor/react` — editor (Monaco wrapper)
- `marked` — Markdown rendering
- `dompurify` — HTML sanitization for rendered Markdown
Local UI packages (via `web/vite.config.ts` aliases):
- `@abstractuic/ui-kit` — shared theme/tokens and UI primitives
- `@abstractuic/panel-chat` — chat message rendering
- `@abstractuic/monitor-flow` — run/trace viewer (Context inspector)
- `@abstractutils/monitor-gpu` — optional GPU widget integration
## Development & packaging
Declared in `pyproject.toml` (dev/build):
- `pytest`, `pytest-cov` — tests/coverage
- `ruff`, `black` — linting/formatting
- `setuptools`, `wheel` — packaging
## Abstract* ecosystem
AbstractCode is part of the Abstract* stack and relies on:
- [AbstractFramework](https://github.com/lpalbou/AbstractFramework)
- [AbstractCore](https://github.com/lpalbou/abstractcore)
- [AbstractRuntime](https://github.com/lpalbou/abstractruntime)
- **AbstractAgent**
- (optional) **AbstractFlow** for local VisualFlow runs (`abstractcode[flow]`)
- **AbstractUIC** components in the Web UI (via `../../abstractuic/*`)
Thank you to all contributors and the broader open-source community.
---
<!-- FILE: ACKNOWLEDGMENTS.md -->
# Acknowledgments
This repository’s acknowledgments are maintained in [`ACKNOWLEDMENTS.md`](ACKNOWLEDMENTS.md).
This file exists only as a convenience for common spelling and external references.
---
<!-- FILE: docs/getting-started.md -->
# Getting started
AbstractCode is a **durable terminal TUI** for running agentic coding sessions on the AbstractFramework stack:
- **AbstractRuntime** provides durable runs/ledger/waits/artifacts.
- **AbstractAgent** provides the built-in agents (`react`, `memact`, `codeact`).
- **AbstractCore** provides provider/model abstraction and tool definitions.
Ecosystem links:
- [AbstractFramework](https://github.com/lpalbou/AbstractFramework)
- [AbstractCore](https://github.com/lpalbou/abstractcore)
- [AbstractRuntime](https://github.com/lpalbou/abstractruntime)
If you landed here directly, skim [`README.md`](README.md) for an overview.
## 1) Install
Python **3.10+**:
```bash
pip install abstractcode
```
Optional (run VisualFlow locally via `abstractcode flow ...`):
```bash
pip install "abstractcode[flow]"
```
Evidence:
- Package deps and extras: `pyproject.toml`
- CLI entrypoints: `abstractcode/__init__.py` and `abstractcode/__main__.py` → `abstractcode/cli.py`
## 2) Start the interactive TUI
Ollama (default provider):
```bash
abstractcode --provider ollama --model qwen3:1.7b-q4_K_M
```
OpenAI-compatible server (example: LM Studio):
```bash
abstractcode --provider openai --base-url http://127.0.0.1:1234/v1 --model qwen/qwen3-next-80b
```
In the app:
- `/help` shows the authoritative command list (implemented in `abstractcode/react_shell.py::_show_help`)
- type a task (or use `/task ...`)
Evidence:
- Arg parsing: `abstractcode/cli.py`
- Interactive host: `abstractcode/react_shell.py`
## 2b) Plan / Review modes (optional)
AbstractCode supports two UX modes that affect how the agent responds:
- **Plan mode**: the agent outputs a TODO plan before acting (`--plan` or `/plan on`)
- **Review mode**: the agent self-checks before concluding (`--review` / `--no-review`, or `/review ...`)
Evidence:
- CLI flags: `abstractcode/cli.py`
- TUI commands: `abstractcode/react_shell.py::_show_help`
## 3) Approvals, tools, and files
### Tool approvals (default-on)
By default, tool calls pause at a durable boundary and require approval.
- CLI: `--auto-approve` (unsafe; disables prompts)
- TUI: `/auto-accept` (persists when state is enabled)
Evidence:
- Runtime is wired with `PassthroughToolExecutor(mode="approval_required")` in `abstractcode/react_shell.py`.
- After approval, tools run via `MappingToolExecutor.from_tools(...)` in `abstractcode/react_shell.py`.
### Attach files with `@path`
Mention files in your prompt to attach them:
```text
Explain @abstractcode/cli.py and @docs/architecture.md
```
Evidence:
- Mention parsing + workspace roots/mounts: `abstractcode/file_mentions.py`
- Attachment ingestion to ArtifactStore: `abstractcode/react_shell.py::_ingest_attachments()`
Workspace mounts (optional):
- `ABSTRACTCODE_WORKSPACE_MOUNTS` (preferred)
- `ABSTRACTGATEWAY_WORKSPACE_MOUNTS` (compat)
Format: newline-separated `name=/abs/path` entries.
## 4) Persistence (durable runs)
Defaults:
- state file: `~/.abstractcode/state.json`
- durable stores: `~/.abstractcode/state.d/`
- saved settings: `~/.abstractcode/state.config.json`
Disable persistence:
```bash
abstractcode --no-state
```
Evidence: file-backed vs in-memory stores are selected in `abstractcode/react_shell.py`.
## 5) Workflows and web UI (optional)
Workflows:
- Local VisualFlow runs: `abstractcode flow ...` (requires `abstractcode[flow]`)
- Workflow agent mode: `abstractcode --agent <flow_ref>`
- Gateway control-plane: `abstractcode gateway ...`
- Gateway bundle management: `abstractcode workflow ...`
Details: [`docs/workflows.md`](docs/workflows.md).
Web UI:
- The gateway-first web host is in `web/` (separate Node/Vite build; not part of the pip wheel).
Details: [`docs/web.md`](docs/web.md) and [`docs/deployment-web.md`](docs/deployment-web.md).
## Next
- Docs index: [`docs/README.md`](docs/README.md)
- FAQ (common issues): [`docs/faq.md`](docs/faq.md)
- CLI/TUI reference (env vars, persistence details, MCP): [`docs/cli.md`](docs/cli.md)
- Architecture (diagrams): [`docs/architecture.md`](docs/architecture.md)
- API and integration points: [`docs/api.md`](docs/api.md)
- Workflow UI events contract: [`docs/ui_events.md`](docs/ui_events.md)
- Contributing: [`CONTRIBUTING.md`](CONTRIBUTING.md)
- Security policy: [`SECURITY.md`](SECURITY.md)
---
<!-- FILE: docs/README.md -->
# AbstractCode documentation
Start here: [`docs/getting-started.md`](docs/getting-started.md).
AbstractCode is part of the **AbstractFramework** ecosystem:
- [AbstractFramework](https://github.com/lpalbou/AbstractFramework)
- [AbstractCore](https://github.com/lpalbou/abstractcore) (providers + tools)
- [AbstractRuntime](https://github.com/lpalbou/abstractruntime) (durable execution)
## Entry points
- First-time setup + quick usage: [`docs/getting-started.md`](docs/getting-started.md)
- Frequently asked questions: [`docs/faq.md`](docs/faq.md)
- Project overview + install + quickstart: [`README.md`](README.md)
- Agent-oriented docs: [`llms.txt`](llms.txt) and [`llms-full.txt`](llms-full.txt)
- Architecture (with diagrams): [`docs/architecture.md`](docs/architecture.md)
- CLI/TUI reference (commands, persistence, env): [`docs/cli.md`](docs/cli.md)
- API and integration points: [`docs/api.md`](docs/api.md)
- Workflows (VisualFlow + bundles + gateway): [`docs/workflows.md`](docs/workflows.md)
- Workflow-driven UI events contract: [`docs/ui_events.md`](docs/ui_events.md)
## Web app
- Web overview + local dev/build notes: [`docs/web.md`](docs/web.md)
- Deployment (gateway-first): [`docs/deployment-web.md`](docs/deployment-web.md)
- iPhone / PWA notes: [`docs/deployment-iphone.md`](docs/deployment-iphone.md)
## Project
- Changelog: [`CHANGELOG.md`](CHANGELOG.md)
- Contributing: [`CONTRIBUTING.md`](CONTRIBUTING.md)
- Security: [`SECURITY.md`](SECURITY.md)
- Acknowledgments: [`ACKNOWLEDMENTS.md`](ACKNOWLEDMENTS.md)
---
<!-- FILE: docs/architecture.md -->
# AbstractCode architecture
> Last verified: 2026-02-09
> Scope: what is implemented in this repo (no roadmap claims).
Start here: [`docs/getting-started.md`](docs/getting-started.md).
AbstractCode is a **host UI** for running durable agent/workflow executions built on:
- **AbstractAgent** (agents)
- **AbstractRuntime** (durable runtime: runs, ledger, waits, artifacts)
- **AbstractCore** (provider/model abstraction + tool definitions)
This repo contains:
- Python CLI/TUI package: `abstractcode/`
- Gateway-first web host UI: `web/` (separate build; not part of the pip wheel)
Related:
- CLI/TUI reference: [`docs/cli.md`](docs/cli.md)
- Workflows: [`docs/workflows.md`](docs/workflows.md)
- UI events contract: [`docs/ui_events.md`](docs/ui_events.md)
- Web overview: [`docs/web.md`](docs/web.md)
## Big picture (CLI/TUI)
```mermaid
flowchart LR
U[User\n(terminal)] -->|input| UI[FullScreenUI\n(prompt_toolkit)]
UI <--> SH[ReactShell\n(command router + UX)]
SH -->|start/tick| RT[AbstractRuntime\n(durable execution)]
RT -->|LLM calls| LLM[AbstractCore LLM client\n(provider/model)]
RT -->|tool calls (durable wait)| PTE[PassthroughToolExecutor\napproval_required]
SH -->|approve + execute| MTE[MappingToolExecutor\n(local tools or MCP)]
MTE -->|tool results| RT
RT --> RS[RunStore\n(JsonFileRunStore / InMemoryRunStore)]
RT --> LS[LedgerStore\n(JsonlLedgerStore / InMemoryLedgerStore)]
RT --> AS[ArtifactStore\n(FileArtifactStore / InMemoryArtifactStore)]
RT --> SS[SnapshotStore\n(JsonSnapshotStore / InMemorySnapshotStore)]
```
Evidence (implementation):
- CLI entrypoint + arg parsing: `abstractcode/cli.py`
- Interactive host: `abstractcode/react_shell.py` (`ReactShell`)
- UI: `abstractcode/fullscreen_ui.py` (`FullScreenUI`)
- Runtime wiring: `abstractcode/react_shell.py` (creates stores + `create_local_runtime(...)`)
## Web host (gateway-first)
The web app is a **thin host** that talks only to an AbstractGateway under `/api/gateway/*`.
```mermaid
sequenceDiagram
participant B as Browser (web/)
participant G as AbstractGateway (/api/gateway/*)
participant R as AbstractRuntime (remote)
B->>G: Start run / list runs / discovery
B->>G: Stream ledger (SSE + cursor replay)
G-->>B: Ledger events
B->>G: Submit durable commands (resume waits, tool approvals)
G->>R: Execute durable commands
```
Evidence (implementation):
- Gateway client + endpoints: `web/src/lib/gateway_client.ts`
- UI rendering from ledger stream: `web/src/ui/app.tsx`
## Repository layout
```text
abstractcode/ # Python package (published to pip)
__init__.py # console entrypoint: abstractcode:main
__main__.py # module entrypoint: python -m abstractcode
cli.py # argparse CLI + subcommands (flow/workflow/gateway)
react_shell.py # interactive shell + command routing
fullscreen_ui.py # prompt_toolkit full-screen UI
input_handler.py # prompt_toolkit input helpers
terminal_markdown.py # markdown rendering for terminal output
theme.py # themes + env overrides
file_mentions.py # @file parsing + workspace mount resolution
recall.py / remember.py # memory UX helpers (host-side)
flow_cli.py # local VisualFlow runner (requires abstractflow extra)
workflow_agent.py # run VisualFlow as an agent (abstractcode.agent.v1)
workflow_cli.py # manage .flow bundles on a gateway
gateway_cli.py # gateway HTTP client (runs, ledger follow, bundles, KG)
web/ # Web host UI (separate Node/Vite app)
docs/ # Documentation for this repo/package
tests/ # Test suite
```
## Execution modes
### 1) Interactive agents (default)
Command: `abstractcode ...`
Dispatch:
- `abstractcode/cli.py` constructs a `ReactShell` and enters the TUI loop.
- Built-in agent kinds are selected by `--agent` (`react|memact|codeact`).
Evidence:
- Agent selection + shell creation: `abstractcode/cli.py`
- Agent wiring + toolset selection: `abstractcode/react_shell.py`
### 2) One-shot (`--prompt`)
Command: `abstractcode --prompt "..." ...`
Behavior:
- runs a single task, prints the final answer, exits
- supports `@file` mentions (attachments are stored in the ArtifactStore)
Evidence: `abstractcode/cli.py::_run_one_shot_prompt()`.
### 3) Local VisualFlow runs (`abstractcode flow ...`)
Commands: `abstractcode flow run|resume|pause|...`
Behavior:
- runs VisualFlow workflows locally with durable stores, separate from the agent state file
Evidence:
- CLI parsing: `abstractcode/cli.py::build_flow_parser()`
- Flow driver: `abstractcode/flow_cli.py`
### 4) Workflow agent (`abstractcode --agent <flow_ref>`)
Runs a VisualFlow workflow as a first-class “agent” in the TUI, using the `abstractcode.agent.v1` contract.
Evidence: `abstractcode/workflow_agent.py` (`WorkflowAgent`).
### 5) Gateway control-plane (`abstractcode gateway ...`)
Commands: `abstractcode gateway run|attach|kg`
Behavior:
- starts/attaches to remote runs via gateway HTTP endpoints
- can query the persisted KG via the gateway (when enabled server-side)
Evidence: `abstractcode/gateway_cli.py`.
## Durability + tool approvals (core invariant)
AbstractCode keeps runs durable by persisting only JSON-safe state:
- tool **specs** and **requests** can be persisted
- tool **callables** are never persisted; they stay in the host process
Approval boundary (TUI):
1) runtime emits a durable wait for tool calls (`approval_required`)
2) host prompts the user (or auto-approves)
3) host executes tools (local or via MCP) and resumes the run with results
Evidence:
- Passthrough executor: `abstractcode/react_shell.py` (`PassthroughToolExecutor(mode="approval_required")`)
- Local executor: `abstractcode/react_shell.py` (`MappingToolExecutor.from_tools(...)`)
## Workflow-driven UX events
Workflows can emit `emit_event` effects (ledger-backed) to request host UX updates:
- status text: `abstract.status`