1bcoder 0.1.4__tar.gz → 0.1.6__tar.gz

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 (92) hide show
  1. {1bcoder-0.1.4 → 1bcoder-0.1.6/1bcoder.egg-info}/PKG-INFO +244 -20
  2. {1bcoder-0.1.4 → 1bcoder-0.1.6}/1bcoder.egg-info/SOURCES.txt +6 -1
  3. 1bcoder-0.1.4/README.md → 1bcoder-0.1.6/PKG-INFO +258 -19
  4. 1bcoder-0.1.4/1bcoder.egg-info/PKG-INFO → 1bcoder-0.1.6/README.md +1653 -1444
  5. 1bcoder-0.1.6/_bcoder_data/doc/OLLAMA_SERVER_PARAM.md +170 -0
  6. 1bcoder-0.1.6/_bcoder_data/proc/md.py +22 -0
  7. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/mdx.py +11 -1
  8. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/profiles.txt +7 -0
  9. 1bcoder-0.1.6/_bcoder_data/scripts/simargl-cli_index_files.txt +3 -0
  10. 1bcoder-0.1.6/_bcoder_data/scripts/simargl-cli_index_units.txt +3 -0
  11. 1bcoder-0.1.6/_bcoder_data/scripts/simargl-cli_search.txt +4 -0
  12. {1bcoder-0.1.4 → 1bcoder-0.1.6}/chat.py +8415 -7396
  13. {1bcoder-0.1.4 → 1bcoder-0.1.6}/map_index.py +1 -1
  14. {1bcoder-0.1.4 → 1bcoder-0.1.6}/pyproject.toml +1 -1
  15. 1bcoder-0.1.6/tests/test_utils.py +143 -0
  16. 1bcoder-0.1.4/_bcoder_data/proc/md.py +0 -14
  17. {1bcoder-0.1.4 → 1bcoder-0.1.6}/1bcoder.egg-info/dependency_links.txt +0 -0
  18. {1bcoder-0.1.4 → 1bcoder-0.1.6}/1bcoder.egg-info/entry_points.txt +0 -0
  19. {1bcoder-0.1.4 → 1bcoder-0.1.6}/1bcoder.egg-info/requires.txt +0 -0
  20. {1bcoder-0.1.4 → 1bcoder-0.1.6}/1bcoder.egg-info/top_level.txt +0 -0
  21. {1bcoder-0.1.4 → 1bcoder-0.1.6}/LICENSE +0 -0
  22. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/__init__.py +0 -0
  23. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/agents/advance.txt +0 -0
  24. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/agents/ask.txt +0 -0
  25. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/agents/compact.txt +0 -0
  26. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/agents/concepts.txt +0 -0
  27. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/agents/fill.txt +0 -0
  28. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/agents/planning.txt +0 -0
  29. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/agents/scan.txt +0 -0
  30. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/agents/sqlite.txt +0 -0
  31. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/aliases.txt +0 -0
  32. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/doc/MCP.md +0 -0
  33. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/doc/PARAM.md +0 -0
  34. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/doc/PROC.md +0 -0
  35. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/map.txt +0 -0
  36. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/action-required.py +0 -0
  37. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/add-save.py +0 -0
  38. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/assist.py +0 -0
  39. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/collect-files.py +0 -0
  40. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/ctx_cut.py +0 -0
  41. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/extract-code.py +0 -0
  42. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/extract-files.py +0 -0
  43. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/extract-list.py +0 -0
  44. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/grounding-check.py +0 -0
  45. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/pattern-gate.py +0 -0
  46. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/regexp-extract.py +0 -0
  47. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/rude_words.py +0 -0
  48. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/scan-save.py +0 -0
  49. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/secret_check.py +0 -0
  50. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/sql_readonly_guard.py +0 -0
  51. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/proc/tempctx-cut.py +0 -0
  52. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/prompts/analysis.txt +0 -0
  53. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/prompts/sumarise.txt +0 -0
  54. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/prompts.txt +0 -0
  55. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/AddFunction.txt +0 -0
  56. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/AskProject.txt +0 -0
  57. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/CheckRequirements.txt +0 -0
  58. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/DockerMySQL.txt +0 -0
  59. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/DockerNginx.txt +0 -0
  60. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/DockerPython.txt +0 -0
  61. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/DockerStack.txt +0 -0
  62. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/DuckDuckGoInstant.txt +0 -0
  63. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/EnvTemplate.txt +0 -0
  64. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/Explain.txt +0 -0
  65. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/ExploreProjectStructure.txt +0 -0
  66. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/GitIgnorePython.txt +0 -0
  67. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/MySQLDump.txt +0 -0
  68. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/NewScript.txt +0 -0
  69. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/PipFreeze.txt +0 -0
  70. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/PyPI.txt +0 -0
  71. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/Refactor.txt +0 -0
  72. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/RunAndFix.txt +0 -0
  73. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/SQLiteSchema.txt +0 -0
  74. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/WikiPage.txt +0 -0
  75. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/WikiSearch.txt +0 -0
  76. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/auto-bkup.txt +0 -0
  77. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/edit-control.txt +0 -0
  78. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/parallel_call.txt +0 -0
  79. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/personal/content/create-regular-content.txt +0 -0
  80. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/personal/content/plan.txt +0 -0
  81. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/personal/test/collect-data-from-test-environment.txt +0 -0
  82. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/plan.txt +0 -0
  83. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/remote/create-content-on-remote-server.txt +0 -0
  84. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/set_ctx.txt +0 -0
  85. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/team-map-worker.txt +0 -0
  86. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/team-search-worker.txt +0 -0
  87. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/team-summarize.txt +0 -0
  88. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/team-tree-worker.txt +0 -0
  89. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/scripts/test.txt +0 -0
  90. {1bcoder-0.1.4 → 1bcoder-0.1.6}/_bcoder_data/teams/code-analysis.yaml +0 -0
  91. {1bcoder-0.1.4 → 1bcoder-0.1.6}/map_query.py +0 -0
  92. {1bcoder-0.1.4 → 1bcoder-0.1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: 1bcoder
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: AI coding assistant agent for 1B–7B local models (Ollama, LMStudio, llama.cpp). Terminal REPL with file editing, project map, agents, scripts, and parallel multi-model queries.
5
5
  Project-URL: Homepage, https://github.com/szholobetsky/1bcoder
6
6
  Project-URL: Repository, https://github.com/szholobetsky/1bcoder
@@ -15,15 +15,70 @@ Dynamic: license-file
15
15
 
16
16
  # 1bcoder
17
17
 
18
- AI coding assistant agent for 1B–7B local models running locally via [Ollama](https://ollama.com), [LMStudio](https://lmstudio.ai), or [LiteLLM](https://litellm.ai).
18
+ AI coding assistant for small local models (0.5B–4B) runs via [Ollama](https://ollama.com), [LMStudio](https://lmstudio.ai), or any OpenAI-compatible backend.
19
19
 
20
20
  ---
21
21
 
22
- **Core idea:** 1B models hallucinate badly when asked to rewrite large blocks of code. 1bcoder works around this by keeping changes small and structured — the model outputs a single-line fix (`LINE N: content`) or a minimal SEARCH/REPLACE block, which the tool then applies with a diff preview before writing to disk.
22
+ ## The problem
23
23
 
24
- Planning and navigation are externalized: plans live in `.txt` files, project structure is indexed into a searchable map so the model never has to hold the whole codebase in its head.
24
+ Small local models are widely available. Most users interact with them through a chat UI and that works well for quick questions. But chat has hard limits: you cannot feed it a 2000-line log file, cannot ask it to run the tests and read the output, cannot have it walk through a large codebase one chunk at a time. For that kind of work you need an agentic system.
25
25
 
26
- **Target:** programmers running `qwen2.5-coder:0.6b` or `llama3.2:1b` on a 4 GB machineoffline, no cloud, no subscription. The tool does the heavy lifting so the model doesn't have to.
26
+ The problem is that every existing agentic system assumes a capable model underneathtypically 8B+ with native tool-calling support. Their system prompts alone consume more tokens than a 1B model's entire context window. Their tool-calling protocols are complex enough that small models hallucinate the format, miss instructions, or loop. So small models are treated as unusable and left out entirely.
27
+
28
+ This is wrong. Small and very small models are genuinely useful — they just require a different kind of tool.
29
+
30
+ ## Privacy and security
31
+
32
+ Every prompt you send to a cloud-based AI assistant leaves your machine. Your code, your architecture decisions, your internal API names, your database schemas, your business logic — all of it travels to a third-party server, is logged, may be used for training, and is subject to the data retention policies of a company you don't control.
33
+
34
+ For personal projects this is an acceptable tradeoff. For professional work it rarely is. Most employment contracts prohibit sending proprietary code to external services. Many industries (finance, healthcare, defense, government) have regulatory requirements that make cloud AI assistance legally problematic or outright forbidden. Even where there is no explicit rule, leaking internal architecture to a vendor is a security risk that most engineering teams would not accept from any other tool.
35
+
36
+ 1bcoder runs entirely on your hardware. The model runs locally. No prompt leaves your machine. No API key, no telemetry, no network connection required. Your code stays where it is — in your editor, on your filesystem, behind your firewall.
37
+
38
+ This is not a niche concern. It is the default requirement for any serious professional environment.
39
+
40
+ ## What different model sizes can actually do
41
+
42
+ | Size | Reliable in 1bcoder |
43
+ |---|---|
44
+ | 0.5b | Explain a 10–20 line function; identify a known technology from a file name; write a standard construct in an unfamiliar language |
45
+ | 1b | Explain a full module; recognize a tech stack from a directory tree; answer questions about error messages and short log excerpts |
46
+ | 1b thinking | Explain whole-file logic; identify design patterns across a module — still unreliable for editing |
47
+ | 2b–4b | Edit files under instruction; write new functions; follow SEARCH/REPLACE format consistently |
48
+
49
+ Every tier is useful. Each requires a different approach to context preparation. 1bcoder provides the tools to do that preparation with surgical precision.
50
+
51
+ ## How 1bcoder works
52
+
53
+ 1bcoder does not depend on the model for navigation or file selection. The programmer controls what goes into context — using a command system to read files, inject logs, run shell commands, and prepare input before asking the model a question. The model's job is a single bounded subtask on pre-prepared input, not autonomous exploration.
54
+
55
+ This is **human-directed** work: the programmer covers what the small model cannot do, and the model handles what it actually does well.
56
+
57
+ Key design decisions:
58
+
59
+ - **Short agent system prompts, at most 5 tools per agent, one function per agent** — `ask`, `edit`, `fill`, `scan`, `compact`. Not universal agents with bloated skill sets.
60
+ - **Tolerant of long and malformed output** — post-processing is automatic; the programmer does not teach the model JSON syntax.
61
+ - **`/parallel`** — send the same context to several models simultaneously and combine results; a 0.5b and a 1b model working together often outperform either alone; designed to coordinate small models running on multiple machines or phones.
62
+ - **`/map`** — project structure index with structural diff; lets the model navigate a codebase without loading it into context.
63
+ - **`/ctx`** — surgical context management: savepoints, selective compaction, named context library, multi-turn rollback. Small models cannot afford wasted tokens.
64
+ - **`/scan`** — reads any large file chunk by chunk and builds a themed summary without overflowing context.
65
+ - **`/proc`** — parameterized command scripts for repeatable preparation workflows.
66
+
67
+ The combination is what matters: commands to build context precisely, agents scoped to one task, and parallel queries to cover what any single small model misses.
68
+
69
+ ## The autonomy tradeoff
70
+
71
+ Most agent system developers aim for full autonomy: the agent reads the task, explores the codebase, writes the code, runs the tests, and ships — without human involvement. Full autonomy is a legitimate goal. It also requires the largest possible models: GPT-4-class or 70B+ locally, with long context, reliable tool-calling, and robust reasoning under uncertainty. Below that threshold, fully autonomous agents fail in ways that are hard to predict and slow to debug.
72
+
73
+ 1bcoder takes the opposite side of this tradeoff deliberately.
74
+
75
+ We accept that the agent will only be partly autonomous. With a 4B model you can run `/agent ask` safely — it explores, reads, and reports, but does not edit. With a 1.5B model the agent loop is unreliable; use it for single bounded tasks with a clear success criterion. With a 0.5B model there is no autonomous loop at all — but the model is still useful for explaining a function, identifying a pattern, or generating a boilerplate construct when you hand it the exact 15 lines it needs.
76
+
77
+ **Partial autonomy is not a failure mode. It is the design.**
78
+
79
+ The programmer stays in the loop — confirming actions, choosing which files to load, deciding when the model is confused and needs a narrower question. This is not a weakness to be engineered away. It is the honest recognition that small models are precise tools, not general reasoners, and that the programmer's judgment is part of the system.
80
+
81
+ The payoff: 1bcoder works offline, on a laptop, on a phone, on hardware you already own. No subscription. No API key. No 30-second round trips. The model that runs on your machine right now — however small — is enough to start.
27
82
 
28
83
  ---
29
84
 
@@ -69,32 +124,34 @@ Tasks that require the model to decide *what to look at* — refactoring across
69
124
  ## Features
70
125
 
71
126
  - Plain terminal REPL — works in any shell, IDE terminal, or SSH session; status line before each prompt shows active model, disk size, quantization, native context limit, and context fill %
72
- - **`/read`** injects files without line numbers (clean text, ideal for `notes.txt` and structured data); **`/readln`** injects with line numbers (use before `/fix` or `/patch` when line references matter)
127
+ - **`/read`** injects files without line numbers (clean text, ideal for `notes.txt` and structured data); **`/readln`** injects with line numbers (use before `/fix` or `/patch` when line references matter); both accept comma- or space-separated file lists — use directly with `{{find_files}}` or `{{map_files}}` captured from `/find` or `/map find`
73
128
  - **Command autocorrection** — typos in command names, file paths, and keywords are detected and fixed automatically before execution, for both human input and agent actions
74
129
  - **`/tree [path]`** — display directory tree of the whole project or any subtree; ask to inject into context (or pass `ctx` to skip the prompt)
75
- - **`/find <pattern>`** — search filenames and file content with regex; supports `-f`/`-c`/`-i`/`--ext` flags; highlights matches, asks to inject results into context
130
+ - **`/find <pattern>`** — search filenames and file content with regex; supports `-f`/`-c`/`-i`/`--ext` flags; highlights matches, asks to inject results into context; sets `{{find_files}}` after every search; **`/find <terms> -r`** ranked BM25 mode returns top-10 files by relevance; hidden directories (`.git`, `.venv`, etc.) excluded automatically
76
131
  - AI proposes a **one-line fix** (`/fix`) or a **SEARCH/REPLACE patch** (`/patch`) — always shows a diff before applying
77
132
  - **Apply AI code blocks directly** with `/edit <file> code` (new/full file) or `/patch <file> code` (SEARCH/REPLACE from reply, no line numbers needed) — preferred for agent mode
78
133
  - **`<think>` tag support** — reasoning blocks shown in terminal by default; `/think hide` suppresses terminal display; `/think include` keeps reasoning in context for chained turns
79
134
  - Run shell commands and inject their output with `/run`
80
135
  - Save AI replies to files with `/save` (code-fence stripping, multiple files, append modes)
81
- - **Session persistence** — `/ctx save` / `/ctx load` dump and restore full conversations; `/ctx list` browses the `.1bcoder/ctx/` project context library; `/ctx compact` summarizes and compresses the context via AI; `/ctx savepoint` marks a position for rollback or selective compaction; `/ctx clear N` drops the last N messages
82
- - **Scripts** — reusable sequences of commands stored as `.txt` files, run step-by-step or fully automated
136
+ - **Session persistence** — `/ctx save` / `/ctx load` dump and restore full conversations; `/ctx list` browses the `.1bcoder/ctx/` project context library; `/ctx compact` summarizes and compresses the context via AI; `/ctx compact N` compacts last N messages in place; `/ctx savepoint` marks a position for rollback or selective compaction; `/ctx clear N` drops the last N messages
137
+ - **Context composer** — `/ctx compose` builds a merged context from multiple saved ctx files with content-level dedup (identical message blocks appear once); workflow: `/proj find` → numbered results → `/ctx compose add N,M` → `/ctx compose run task.ctx` `/ctx load task.ctx`
138
+ - **Scripts** — reusable sequences of commands stored as `.txt` files; `/script run <file> [key=value ...]` runs all steps automatically; `/script apply` runs step-by-step with Y/n confirmation
83
139
  - **Script from history** — `/script create ctx` captures this session's commands into a reusable script automatically
84
- - **Project map** — scan any codebase into a searchable index (`/map index`), query it (`/map find`), trace call chains (`/map trace`), and diff changes (`/map idiff`) — now includes `ORPHAN_DRIFT` alert (dead code delta) and `GHOST ALERT` (deleted file that other files depended on)
140
+ - **Project map** — scan any codebase into a searchable index (`/map index`), query it (`/map find`), trace call chains (`/map trace`), and diff changes (`/map idiff`) — now includes `ORPHAN_DRIFT` alert (dead code delta) and `GHOST ALERT` (deleted file that other files depended on); `/map find` sets `{{map_files}}` after every hit; hidden directories excluded from indexing
85
141
  - **Ask mode** — `/ask <question>` is an alias for `/agent ask`: a read-only research loop for 4B models that explores the project with tree/find/map tools, never edits files, auto-truncates large results to protect context
86
142
  - **Agent mode** — `/agent <task>` runs an autonomous loop; stops when the model outputs plain text with no ACTION; after the loop a `[s]ummary / [a]ll / [n]one` prompt lets you pull agent results into main context
87
143
  - **Named agents** — define custom agents in `.1bcoder/agents/<name>.txt` (system prompt, tools, max_turns, aliases, `on_done`, `params`, `before`, `gates`); call with `/agent <name> task` or `/<name> task` directly; agent-scoped aliases active only during that run
88
144
  - **`/plan <goal>`** — planning agent: researches the project, writes a natural-language step-by-step plan to `plan.txt`; run `/agent <task> file: plan.txt` to execute it step by step
89
145
  - **`/fill`** — fill agent: reads NaN session variables, scans project for `.var` files and config files, sets each value automatically
90
146
  - **Session variables** — `{{name}}` placeholders substituted in any command; save/load from `.var` files for offline reuse without loading files into context
91
- - **Project config** — `/config save` persists session state (host, model, ctx, params, vars, procs) to `.1bcoder/config.yml`; `/config save global` saves to `~/.1bcoder/config.yml`; on startup, the first config with `auto: true` (local global) is applied automatically
147
+ - **Project context** — `/proj set <key>` creates `.1bcoder/projects/<key>/` with `project.txt` (description, keywords, file list); `/proj save`, `/proj find`, `/proj keyword add`, `/proj file add`, `/proj index` (regex-extracts file paths from saved ctx files); active project saved in config and auto-restored on next startup
148
+ - **Project config** — `/config save` persists session state (host, model, ctx, params, vars, procs, active project) to `.1bcoder/config.yml`; `/config save global` saves to `~/.1bcoder/config.yml`; on startup, the first config with `auto: true` (local → global) is applied automatically
92
149
  - **Aliases** — define command shortcuts with `/alias /name = expansion` (supports `{{args}}`); persisted in `aliases.txt`; loaded from global then project directory at startup and survive `/clear`
93
150
  - **Backup/restore** — `/bkup save` rotates existing backups (`file.bkup` → `file.bkup(1)`, `file.bkup(2)`…) so no snapshot is ever overwritten; `/bkup restore` always restores the latest
94
151
  - **`/tempctx`** — agent-internal context control: `/tempctx N` sets a private token budget, `/tempctx cut` removes oldest messages, `/tempctx clear` resets to system+task, `/tempctx show` prints size; only active inside an agent loop so agents can't touch the main context; also settable via `params = agent_ctx = N` in agent files
95
152
  - **Agent proc hooks** — `before =` (runs before every LLM call, injects output as `[context]`) and `gates =` (runs after every reply, `FAIL:` retries the current plan step); enables supervised loops, convention enforcement, and hallucination checks without changing the model
96
153
  - **`/scan <file> <theme>`** — named agent that reads any file chunk by chunk, extracts info relevant to a theme, and builds a summary in `.1bcoder/scan_result.txt`; uses `/tempctx cut` between chunks so the agent context never overflows; result is injected into main context at the end
97
- - **MCP support** — connect external tool servers (filesystem, web, git, database, browser…) via the Model Context Protocol
154
+ - **MCP support** — connect external tool servers (filesystem, web, git, database, browser…) via the Model Context Protocol; `/mcp connect <name> <command> [--cwd <dir>]` launches the server subprocess with an optional working directory override
98
155
  - **Parallel queries** — send prompts to multiple models simultaneously with `/parallel`; control context sent (`--ctx`/`--last`/`--no-ctx`) and route replies back into main context (`ctx` output) for sub-agent workflows
99
156
  - **Command hooks** — `/hook before|after <cmd> <script>` runs a script before or after edit/patch/fix/insert; `before` hook cancels the command if the script is missing; `{{file}}` and `{{range}}` injected automatically
100
157
  - Switch model or host at runtime without restarting (`/model gemma3:1b`, `/host openai://localhost:1234`)
@@ -246,6 +303,31 @@ Examples:
246
303
 
247
304
  ## Command Reference
248
305
 
306
+ ### Multi-line input
307
+
308
+ `/text` opens a full multi-line editor inside the terminal and sends the composed text to the AI as a regular message.
309
+
310
+ | Key / Command | Action |
311
+ |---|---|
312
+ | Enter | New line |
313
+ | Ctrl+D | Submit without saving |
314
+ | `/end` on its own line + Enter | Submit without saving |
315
+ | `/save` on its own line + Enter | Save to `.1bcoder/task.txt` and submit |
316
+ | `/save filename.txt` on its own line + Enter | Save to custom file and submit |
317
+ | Ctrl+C | Cancel without sending |
318
+
319
+ Requires `prompt_toolkit` for full editing (arrow keys, Home/End, scroll). Falls back to plain line-by-line input if not installed.
320
+
321
+ ```
322
+ > /text
323
+ ··· Describe the bug in detail here.
324
+ ··· Paste stack traces, requirements, anything long.
325
+ ··· /save
326
+ [text] saved → .1bcoder/task.txt
327
+ ```
328
+
329
+ ---
330
+
249
331
  ### File operations
250
332
 
251
333
  | Command | Description |
@@ -595,7 +677,7 @@ tools =
595
677
 
596
678
  ### Named agents
597
679
 
598
- Custom agents are defined in `.1bcoder/agents/<name>.txt` (project-local) or `<install>/.1bcoder/agents/<name>.txt` (global). Local files override global ones. Call them with `/agent <name> task` or directly as `/<name> task`.
680
+ Custom agents are defined in `.1bcoder/agents/<name>.txt` (project-local) or `~/.1bcoder/agents/<name>.txt` (global). Local files override global ones. Call them with `/agent <name> task` or directly as `/<name> task`.
599
681
 
600
682
  **Agent file format:**
601
683
 
@@ -782,6 +864,7 @@ Lines starting with `[v]` are already done and skipped. Lines starting with `#`
782
864
  | `/script reset` | Unmark all done steps (also happens automatically when a script runs to completion) |
783
865
  | `/script reapply [key=value ...]` | Reset all done steps then apply automatically; prompts for any NaN `{{variables}}` before running |
784
866
  | `/script refresh` | Reload script from disk and show contents |
867
+ | `/script run <file> [key=value ...]` | **Run all steps automatically** — shorthand for `apply -y` |
785
868
  | `/script apply [file] [key=value ...]` | Run steps one by one (Y/n/q per step) |
786
869
  | `/script apply -y [file] [key=value ...]` | Run all pending steps automatically |
787
870
 
@@ -807,7 +890,8 @@ what is wrong in lines {{range}}?
807
890
  ```
808
891
 
809
892
  ```
810
- /script apply fix-fn.txt file=calc.py range=1-4 hint="wrong operator"
893
+ /script run fix-fn.txt file=calc.py range=1-4 hint="wrong operator"
894
+ /script apply fix-fn.txt file=calc.py range=1-4 # same but asks Y/n per step
811
895
  ```
812
896
 
813
897
  Run a script non-interactively from the command line:
@@ -961,7 +1045,119 @@ procs:
961
1045
  - collect-files output.txt
962
1046
  ```
963
1047
 
964
- When `auto: true`, host and model are used at startup to connect; ctx, params, vars, and procs are also restored.
1048
+ When `auto: true`, host and model are used at startup to connect; ctx, params, vars, procs, and active project are also restored.
1049
+
1050
+ ---
1051
+
1052
+ ### Project management (`/proj`)
1053
+
1054
+ Track ctx files and notes per project ticket, feature branch, or work item — stored locally in `.1bcoder/projects/` relative to the working directory. Each project has a human-editable `project.txt` with description, keywords, and file list.
1055
+
1056
+ ```
1057
+ /proj set ABC-123 # activate project (creates .1bcoder/projects/ABC-123/)
1058
+ /proj set role-impl # any valid folder name works
1059
+ /proj status # show active project and project.txt
1060
+ /proj list # all projects, newest first (* = active)
1061
+ ```
1062
+
1063
+ **Save and browse ctx files:**
1064
+ ```
1065
+ /proj save session1.txt # save current ctx to .1bcoder/projects/ABC-123/session1.txt
1066
+ /proj show # list ctx files in active project (newest first)
1067
+ /proj load session1.txt # load ctx file from active project (path resolved automatically)
1068
+ ```
1069
+
1070
+ **Annotate with keywords and files:**
1071
+ ```
1072
+ /proj keyword add ppcon, payment, legacy
1073
+ /proj file add models.py, views.py, finance/amort.py
1074
+ ```
1075
+
1076
+ **Index file paths from saved ctx files** (extracts from `/read`, `/edit`, `/patch`, `/save`, `/insert` command args):
1077
+ ```
1078
+ /proj index
1079
+ ```
1080
+
1081
+ **Search across all projects** in current working directory:
1082
+ ```
1083
+ /proj find payment # fast: search project.txt + ctx filenames (default)
1084
+ /proj find payment -f # same as above (explicit)
1085
+ /proj find payment -c # content: also grep inside ctx files with line numbers
1086
+ ```
1087
+
1088
+ `-f` output (compact):
1089
+ ```
1090
+ ABC-123 — keywords: payment | role-impl — ctx: payment_flow.txt
1091
+ ```
1092
+
1093
+ `-c` output (with content):
1094
+ ```
1095
+ ABC-123 — keywords: payment
1096
+ [project: role-impl]
1097
+ [ctx: user_action_flow.txt]
1098
+ 1021: system highlight current payment in the grid
1099
+ 1122: when user request payment
1100
+ ```
1101
+
1102
+ **Persist active project** — included in `/config save`, auto-restored on next startup:
1103
+ ```
1104
+ /proj set ABC-123
1105
+ /config save
1106
+ # next startup: [proj] ABC-123
1107
+ ```
1108
+
1109
+ **`project.txt` format** (human-editable):
1110
+ ```
1111
+ Description: Fix amortization calculation in legacy Oracle module
1112
+ Keywords: ppcon, payment, legacy
1113
+ Files:
1114
+ models.py
1115
+ finance/amort.py
1116
+ views.py
1117
+ ```
1118
+
1119
+ ---
1120
+
1121
+ ### Context composer (`/ctx compose`)
1122
+
1123
+ Build a merged context from multiple saved ctx files. Identical message blocks appear only once (content-level dedup) — shared tree/read results from different ctx files are merged into one root, then unique branches are appended.
1124
+
1125
+ **Workflow with `/proj find`:**
1126
+ ```
1127
+ /proj find isbn # search projects — results numbered [1], [2], ...
1128
+ /ctx compose add 1,3 # add result #1 and #3 to queue
1129
+ /ctx compose add all # or add all results
1130
+ /ctx compose list # review: filename, size, accumulated total
1131
+ /ctx compose run task.ctx # merge → task.ctx (dedup applied)
1132
+ /ctx load task.ctx # load — LLM wakes up knowing all branches
1133
+ ```
1134
+
1135
+ **Direct compose (no queue):**
1136
+ ```
1137
+ /ctx compose book-html.txt models.txt requirements.txt
1138
+ ```
1139
+ If no output file given with `run`, merges directly into current context.
1140
+
1141
+ **Path resolution** — bare filename is resolved automatically:
1142
+ 1. `.1bcoder/ctx/<name>`
1143
+ 2. `.1bcoder/projects/<active_key>/<name>`
1144
+ 3. full path as-is
1145
+
1146
+ **Queue commands:**
1147
+ ```
1148
+ /ctx compose add <file> add file to queue
1149
+ /ctx compose add 1,2,3 add by number from last /proj find
1150
+ /ctx compose add all add all /proj find results
1151
+ /ctx compose list show queue with sizes and running total
1152
+ /ctx compose clear clear queue
1153
+ /ctx compose run [out.txt] merge and write (or load into context)
1154
+ ```
1155
+
1156
+ **`/ctx compact N`** — compact last N messages in place without touching the rest:
1157
+ ```
1158
+ /ctx compact 1 # the LLM wrote 800 tokens — compress that one reply
1159
+ /ctx compact 3 # compress last 3 messages into one block
1160
+ ```
965
1161
 
966
1162
  ---
967
1163
 
@@ -970,12 +1166,14 @@ When `auto: true`, host and model are used at startup to connect; ctx, params, v
970
1166
  Connect external tool servers to give the AI access to filesystems, databases, web pages, and more.
971
1167
 
972
1168
  ```
973
- /mcp connect <name> <command>
1169
+ /mcp connect <name> <command> [--cwd <dir>]
974
1170
  /mcp tools [name]
975
- /mcp call <server/tool> [json_args]
1171
+ /mcp call <server/tool> {json_args}
976
1172
  /mcp disconnect <name>
977
1173
  ```
978
1174
 
1175
+ `--cwd <dir>` sets the working directory for the subprocess — useful when the MCP server needs to find files relative to a specific project root.
1176
+
979
1177
  ```
980
1178
  /mcp connect fs npx -y @modelcontextprotocol/server-filesystem .
981
1179
  /mcp connect web uvx mcp-server-fetch
@@ -984,6 +1182,30 @@ Connect external tool servers to give the AI access to filesystems, databases, w
984
1182
  /mcp disconnect fs
985
1183
  ```
986
1184
 
1185
+ **simargl** — semantic file search via task/commit history (see [simargl](https://github.com/szholobetsky/simargl)):
1186
+
1187
+ ```bash
1188
+ pip install simargl
1189
+ cd C:/Project/my-app
1190
+ simargl index files .
1191
+ ```
1192
+
1193
+ ```
1194
+ # connect once per session (model loads here, ~30-60s first time)
1195
+ /mcp connect simargl simargl-mcp
1196
+
1197
+ # search — instant after connect
1198
+ /mcp call simargl/find {"query": "add author field to book class", "mode": "file"}
1199
+
1200
+ # or use the built-in script
1201
+ /script run simargl-find.txt query="add author field to book class" mode=file
1202
+ ```
1203
+
1204
+ If you used a custom `--project` at index time, pass it at connect:
1205
+ ```
1206
+ /mcp connect simargl simargl-mcp --project-id bookcrossing
1207
+ ```
1208
+
987
1209
  See `/doc MCP` for a full list of ready-to-use servers.
988
1210
 
989
1211
  ---
@@ -1122,9 +1344,10 @@ Save any useful message as a reusable template and load it later with `{{param}}
1122
1344
  ```
1123
1345
  /prompt save ConvertJavaToPy # saves last user message as ConvertJavaToPy.txt
1124
1346
  /prompt load # numbered list, select by number, fill {{params}} interactively
1347
+ /prompt load 2 # load prompt #2 directly, skipping the selection prompt
1125
1348
  ```
1126
1349
 
1127
- Templates stored in `<install>/.1bcoder/prompts/`. Use `{{keyword}}` placeholders — values are prompted on load.
1350
+ Templates stored in `~/.1bcoder/prompts.txt` (one entry per line: `name: text`). Use `{{keyword}}` placeholders — values are prompted interactively on load.
1128
1351
 
1129
1352
  ---
1130
1353
 
@@ -1227,7 +1450,7 @@ workers:
1227
1450
  /script apply team-summarize.txt --param keyword=auth --param task="404 on login"
1228
1451
  ```
1229
1452
 
1230
- Built-in team scripts in `<install>/.1bcoder/scripts/`:
1453
+ Built-in team scripts in `~/.1bcoder/scripts/`:
1231
1454
 
1232
1455
  | Script | Worker role |
1233
1456
  |---|---|
@@ -1251,7 +1474,8 @@ Built-in team scripts in `<install>/.1bcoder/scripts/`:
1251
1474
  | `/ctx clear <n>` | Remove last N messages from context |
1252
1475
  | `/ctx cut` | Remove oldest messages until context fits |
1253
1476
  | `/ctx compact` | Ask AI to summarize the conversation, replace context with summary |
1254
- | `/ctx save <file>` | Save full conversation to file |
1477
+ | `/ctx compact <N>` | Summarize last N messages in place, replace with one compact block |
1478
+ | `/ctx save <file>` | Save full conversation to file (global ctx folder) |
1255
1479
  | `/ctx load <file>` | Restore a saved conversation (bare name resolved from `.1bcoder/ctx/`) |
1256
1480
  | `/ctx list` | List files in `.1bcoder/ctx/` project context library |
1257
1481
  | `/ctx savepoint set` | Mark current position as a savepoint |
@@ -24,6 +24,7 @@ _bcoder_data/agents/planning.txt
24
24
  _bcoder_data/agents/scan.txt
25
25
  _bcoder_data/agents/sqlite.txt
26
26
  _bcoder_data/doc/MCP.md
27
+ _bcoder_data/doc/OLLAMA_SERVER_PARAM.md
27
28
  _bcoder_data/doc/PARAM.md
28
29
  _bcoder_data/doc/PROC.md
29
30
  _bcoder_data/proc/action-required.py
@@ -72,6 +73,9 @@ _bcoder_data/scripts/edit-control.txt
72
73
  _bcoder_data/scripts/parallel_call.txt
73
74
  _bcoder_data/scripts/plan.txt
74
75
  _bcoder_data/scripts/set_ctx.txt
76
+ _bcoder_data/scripts/simargl-cli_index_files.txt
77
+ _bcoder_data/scripts/simargl-cli_index_units.txt
78
+ _bcoder_data/scripts/simargl-cli_search.txt
75
79
  _bcoder_data/scripts/team-map-worker.txt
76
80
  _bcoder_data/scripts/team-search-worker.txt
77
81
  _bcoder_data/scripts/team-summarize.txt
@@ -81,4 +85,5 @@ _bcoder_data/scripts/personal/content/create-regular-content.txt
81
85
  _bcoder_data/scripts/personal/content/plan.txt
82
86
  _bcoder_data/scripts/personal/test/collect-data-from-test-environment.txt
83
87
  _bcoder_data/scripts/remote/create-content-on-remote-server.txt
84
- _bcoder_data/teams/code-analysis.yaml
88
+ _bcoder_data/teams/code-analysis.yaml
89
+ tests/test_utils.py