1bcoder 0.1.2__tar.gz → 0.1.4__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 (88) hide show
  1. {1bcoder-0.1.2 → 1bcoder-0.1.4/1bcoder.egg-info}/PKG-INFO +272 -27
  2. {1bcoder-0.1.2 → 1bcoder-0.1.4}/1bcoder.egg-info/SOURCES.txt +14 -0
  3. 1bcoder-0.1.2/README.md → 1bcoder-0.1.4/PKG-INFO +284 -26
  4. 1bcoder-0.1.2/1bcoder.egg-info/PKG-INFO → 1bcoder-0.1.4/README.md +269 -39
  5. 1bcoder-0.1.4/_bcoder_data/agents/compact.txt +15 -0
  6. 1bcoder-0.1.4/_bcoder_data/agents/concepts.txt +21 -0
  7. 1bcoder-0.1.4/_bcoder_data/agents/scan.txt +31 -0
  8. 1bcoder-0.1.4/_bcoder_data/aliases.txt +16 -0
  9. 1bcoder-0.1.4/_bcoder_data/doc/PROC.md +235 -0
  10. 1bcoder-0.1.4/_bcoder_data/proc/action-required.py +42 -0
  11. 1bcoder-0.1.4/_bcoder_data/proc/assist.py +48 -0
  12. 1bcoder-0.1.4/_bcoder_data/proc/ctx_cut.py +19 -0
  13. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/proc/grounding-check.py +2 -1
  14. 1bcoder-0.1.4/_bcoder_data/proc/pattern-gate.py +28 -0
  15. 1bcoder-0.1.4/_bcoder_data/proc/rude_words.py +34 -0
  16. 1bcoder-0.1.4/_bcoder_data/proc/scan-save.py +19 -0
  17. 1bcoder-0.1.4/_bcoder_data/proc/secret_check.py +29 -0
  18. 1bcoder-0.1.4/_bcoder_data/proc/sql_readonly_guard.py +40 -0
  19. 1bcoder-0.1.4/_bcoder_data/proc/tempctx-cut.py +19 -0
  20. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/profiles.txt +6 -0
  21. 1bcoder-0.1.4/_bcoder_data/scripts/auto-bkup.txt +4 -0
  22. 1bcoder-0.1.4/_bcoder_data/scripts/edit-control.txt +6 -0
  23. {1bcoder-0.1.2 → 1bcoder-0.1.4}/chat.py +1356 -271
  24. {1bcoder-0.1.2 → 1bcoder-0.1.4}/pyproject.toml +5 -1
  25. 1bcoder-0.1.2/_bcoder_data/aliases.txt +0 -8
  26. 1bcoder-0.1.2/_bcoder_data/doc/PROC.md +0 -150
  27. {1bcoder-0.1.2 → 1bcoder-0.1.4}/1bcoder.egg-info/dependency_links.txt +0 -0
  28. {1bcoder-0.1.2 → 1bcoder-0.1.4}/1bcoder.egg-info/entry_points.txt +0 -0
  29. {1bcoder-0.1.2 → 1bcoder-0.1.4}/1bcoder.egg-info/requires.txt +0 -0
  30. {1bcoder-0.1.2 → 1bcoder-0.1.4}/1bcoder.egg-info/top_level.txt +0 -0
  31. {1bcoder-0.1.2 → 1bcoder-0.1.4}/LICENSE +0 -0
  32. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/__init__.py +0 -0
  33. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/agents/advance.txt +0 -0
  34. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/agents/ask.txt +0 -0
  35. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/agents/fill.txt +0 -0
  36. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/agents/planning.txt +0 -0
  37. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/agents/sqlite.txt +0 -0
  38. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/doc/MCP.md +0 -0
  39. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/doc/PARAM.md +0 -0
  40. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/map.txt +0 -0
  41. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/proc/add-save.py +0 -0
  42. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/proc/collect-files.py +0 -0
  43. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/proc/extract-code.py +0 -0
  44. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/proc/extract-files.py +0 -0
  45. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/proc/extract-list.py +0 -0
  46. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/proc/md.py +0 -0
  47. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/proc/mdx.py +0 -0
  48. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/proc/regexp-extract.py +0 -0
  49. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/prompts/analysis.txt +0 -0
  50. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/prompts/sumarise.txt +0 -0
  51. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/prompts.txt +0 -0
  52. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/AddFunction.txt +0 -0
  53. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/AskProject.txt +0 -0
  54. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/CheckRequirements.txt +0 -0
  55. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/DockerMySQL.txt +0 -0
  56. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/DockerNginx.txt +0 -0
  57. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/DockerPython.txt +0 -0
  58. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/DockerStack.txt +0 -0
  59. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/DuckDuckGoInstant.txt +0 -0
  60. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/EnvTemplate.txt +0 -0
  61. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/Explain.txt +0 -0
  62. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/ExploreProjectStructure.txt +0 -0
  63. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/GitIgnorePython.txt +0 -0
  64. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/MySQLDump.txt +0 -0
  65. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/NewScript.txt +0 -0
  66. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/PipFreeze.txt +0 -0
  67. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/PyPI.txt +0 -0
  68. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/Refactor.txt +0 -0
  69. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/RunAndFix.txt +0 -0
  70. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/SQLiteSchema.txt +0 -0
  71. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/WikiPage.txt +0 -0
  72. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/WikiSearch.txt +0 -0
  73. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/parallel_call.txt +0 -0
  74. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/personal/content/create-regular-content.txt +0 -0
  75. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/personal/content/plan.txt +0 -0
  76. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/personal/test/collect-data-from-test-environment.txt +0 -0
  77. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/plan.txt +0 -0
  78. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/remote/create-content-on-remote-server.txt +0 -0
  79. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/set_ctx.txt +0 -0
  80. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/team-map-worker.txt +0 -0
  81. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/team-search-worker.txt +0 -0
  82. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/team-summarize.txt +0 -0
  83. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/team-tree-worker.txt +0 -0
  84. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/scripts/test.txt +0 -0
  85. {1bcoder-0.1.2 → 1bcoder-0.1.4}/_bcoder_data/teams/code-analysis.yaml +0 -0
  86. {1bcoder-0.1.2 → 1bcoder-0.1.4}/map_index.py +0 -0
  87. {1bcoder-0.1.2 → 1bcoder-0.1.4}/map_query.py +0 -0
  88. {1bcoder-0.1.2 → 1bcoder-0.1.4}/setup.cfg +0 -0
@@ -1,7 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: 1bcoder
3
- Version: 0.1.2
3
+ Version: 0.1.4
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
+ Project-URL: Homepage, https://github.com/szholobetsky/1bcoder
6
+ Project-URL: Repository, https://github.com/szholobetsky/1bcoder
5
7
  Requires-Python: >=3.10
6
8
  Description-Content-Type: text/markdown
7
9
  License-File: LICENSE
@@ -76,21 +78,25 @@ Tasks that require the model to decide *what to look at* — refactoring across
76
78
  - **`<think>` tag support** — reasoning blocks shown in terminal by default; `/think hide` suppresses terminal display; `/think include` keeps reasoning in context for chained turns
77
79
  - Run shell commands and inject their output with `/run`
78
80
  - Save AI replies to files with `/save` (code-fence stripping, multiple files, append modes)
79
- - **Session persistence** — `/ctx save` / `/ctx load` dump and restore full conversations; `/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
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
80
82
  - **Scripts** — reusable sequences of commands stored as `.txt` files, run step-by-step or fully automated
81
83
  - **Script from history** — `/script create ctx` captures this session's commands into a reusable script automatically
82
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)
83
85
  - **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
84
86
  - **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
85
- - **Named agents** — define custom agents in `.1bcoder/agents/<name>.txt` (system prompt, tools, max_turns, aliases, `on_done`); call with `/agent <name> task` or `/<name> task` directly; agent-scoped aliases active only during that run
86
- - **`/plan <goal>`** — planning agent: researches the project, writes a natural-language step-by-step plan to `plan.txt`; run `/agent <task> plan plan.txt` to execute it step by step
87
+ - **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
+ - **`/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
87
89
  - **`/fill`** — fill agent: reads NaN session variables, scans project for `.var` files and config files, sets each value automatically
88
90
  - **Session variables** — `{{name}}` placeholders substituted in any command; save/load from `.var` files for offline reuse without loading files into context
89
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
90
92
  - **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`
91
93
  - **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
+ - **`/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
+ - **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
+ - **`/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
92
97
  - **MCP support** — connect external tool servers (filesystem, web, git, database, browser…) via the Model Context Protocol
93
- - **Parallel queries** — send prompts to multiple models simultaneously with `/parallel`, with saved profiles
98
+ - **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
+ - **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
94
100
  - Switch model or host at runtime without restarting (`/model gemma3:1b`, `/host openai://localhost:1234`)
95
101
  - **Model parameters** — `/param temperature 0.2`, `/param enable_thinking false` — sent with every request, auto-cast to correct type
96
102
  - **Multi-provider** — connect to Ollama, LMStudio, or LiteLLM using `ollama://` / `openai://` URL scheme; plain host defaults to Ollama
@@ -105,7 +111,7 @@ Tasks that require the model to decide *what to look at* — refactoring across
105
111
  pip install 1bcoder
106
112
  ```
107
113
 
108
- On first launch, default agents, procs, and scripts are copied to `~/.1bcoder/` automatically.
114
+ On first launch, default agents, procs, scripts, profiles, and aliases are copied to `~/.1bcoder/` automatically. On upgrade (`pip install --upgrade 1bcoder`), new entries in `aliases.txt` and `profiles.txt` are merged in without overwriting your customisations.
109
115
 
110
116
  ### Option 2 — Clone and install locally
111
117
 
@@ -115,6 +121,16 @@ cd 1bcoder
115
121
  pip install -e .
116
122
  ```
117
123
 
124
+ When installed from source with `pip install -e .`, the default data files are not copied automatically. Run the included script once to populate `~/.1bcoder/`:
125
+
126
+ ```bat
127
+ deploy_bcoder_data.bat
128
+ ```
129
+
130
+ This copies everything from `_bcoder_data\` (agents, procs, aliases, profiles, scripts) to `%USERPROFILE%\.1bcoder\`. Re-run after pulling updates to sync new defaults.
131
+
132
+ > **Warning:** This will overwrite any files you have customised in `~/.1bcoder\`. Back up your changes before running.
133
+
118
134
  ### Option 3 — Install directly from GitHub
119
135
 
120
136
  ```bash
@@ -549,8 +565,8 @@ When the loop finishes you are prompted: **`[s]ummary / [a]ll / [n]one`** — ch
549
565
  | `f` | Send feedback to the AI and skip the action (redirect the model mid-loop) |
550
566
  | `q` | Stop the agent |
551
567
 
552
- - **`plan step1, step2, ...`** — optional comma-separated list of items injected as hints one per turn
553
- - **`plan <file.txt>`** — load steps from a `.txt` or `.md` file; numbered/bulleted list items become steps; `### Example` / `### Summary` sections are injected as context before step 1; `max_turns` is raised automatically if the file has more steps than the default limit
568
+ - **`plan: step1, step2, ...`** — optional comma-separated list of items injected as hints one per turn
569
+ - **`file: <steps.txt>`** — load steps from a `.txt` or `.md` file; numbered/bulleted list items become steps; `### Example` / `### Summary` sections are injected as context before step 1; `max_turns` is raised automatically if the file has more steps than the default limit; gate FAIL on a step retries it
554
570
 
555
571
  When the loop finishes you are prompted: **`[s]ummary / [a]ll / [n]one`** — choose how much of the agent's conversation to pull into your main context.
556
572
 
@@ -558,8 +574,8 @@ When the loop finishes you are prompted: **`[s]ummary / [a]ll / [n]one`** — ch
558
574
  /agent find and fix the divide by zero bug in calc.py
559
575
  /agent -t 1 read models.py and explain the User class
560
576
  /agent -y -t 5 refactor utils.py
561
- /agent read file plan models.py, views.py, urls.py
562
- /agent implement the changes plan plan.txt # load steps from plan.txt
577
+ /agent read files plan: models.py, views.py, urls.py
578
+ /agent implement the changes file: plan.txt # load steps from plan.txt
563
579
  ```
564
580
 
565
581
  Configure the default agent in `.1bcoder/agent.txt`:
@@ -607,18 +623,48 @@ tools =
607
623
  aliases =
608
624
  /search = /map find {{args}}
609
625
  /sql = /run python db.py "{{args}}"
626
+
627
+ params =
628
+ num_predict = 150
629
+ agent_ctx = 4000
630
+ temperature = 0.2
631
+
632
+ before =
633
+ assist /short
634
+
635
+ gates =
636
+ action-required
637
+ pattern-gate "@Query" "use CriteriaBuilder only"
610
638
  ```
611
639
 
612
640
  - **`system =`** — inline multiline system prompt; indented lines continue the block; `{tool_list}` is substituted automatically from the `tools =` list
613
- - **`tools =`** — one tool name per indented line; controls what the agent knows about and what gets shown in its system prompt
641
+ - **`tools =`** — one tool name per indented line; controls what the agent knows about and what gets shown in its system prompt; empty `tools =` line means no tools (pure text agent)
614
642
  - **`aliases =`** — agent-scoped aliases; active only during this agent's run, restored to global state after; `{{args}}` is replaced by everything after the alias name
615
- - **`on_done = <command>`** slash command executed once when the agent finishes naturally (no more ACTIONs); use to save the agent's final reply to a file (e.g. `on_done = /save plan.txt -w`)
643
+ - **`params =`**model and agent parameters set for this run; `agent_ctx` sets the agent's private context limit (equivalent to `/tempctx N`); `num_predict`, `temperature`, etc. are forwarded to the model
644
+ - **`before =`** — one proc per indented line; runs before every LLM call; all stdout injected as `[context]` into the agent's message list; useful for injecting a hint or parallel sub-query result each turn
645
+ - **`gates =`** — one proc per indented line (with optional args); runs after each reply; if any proc prints `FAIL:`, the current plan step is retried and the FAIL reason is shown to the model as feedback
646
+ - **`on_done = <command>`** — slash command executed once when the agent finishes naturally (no more ACTIONs); use to save the agent's final reply to a file (e.g. `on_done = /ctx compact scan_result`)
616
647
 
617
648
  ```ini
618
649
  # Example: planning agent saves its output automatically
619
650
  on_done = /save plan.txt -w
620
651
  ```
621
652
 
653
+ **Gate procs** — built-in procs designed for use in `gates =`:
654
+
655
+ | Proc | What it checks | FAIL condition |
656
+ |---|---|---|
657
+ | `action-required` | Agent reply contains `ACTION:` or a completion phrase | Neither found — suggests the bare command if one appears anywhere in the reply |
658
+ | `pattern-gate "regexp" "msg"` | Reply matches the given regular expression | Match found — prints `msg` as the FAIL reason |
659
+ | `grounding-check` | Identifiers in reply exist in `map.txt` | Grounding score < 50% (prints warning; does not FAIL by default) |
660
+
661
+ **Before procs** — built-in procs designed for use in `before =`:
662
+
663
+ | Proc | What it does |
664
+ |---|---|
665
+ | `assist /short` | Reads last reply, asks the LLM for a one-sentence next-step hint, injects as `[context]` |
666
+ | `assist /parallel profile <name>` | Same but uses a parallel profile to query the hint model |
667
+
622
668
  Built-in named agents (global install):
623
669
 
624
670
  | Agent | Command | Description |
@@ -627,6 +673,7 @@ Built-in named agents (global install):
627
673
  | `advance` | `/advance <task>` or `/agent advance` | Full toolset for 7B+ models |
628
674
  | `planning` | `/plan <goal>` | Researches project, writes natural-language plan to `plan.txt` |
629
675
  | `fill` | `/fill` | Reads NaN vars, finds `.var` files, sets missing values from project files |
676
+ | `scan` | `/scan <file> <theme>` | Reads large file chunk by chunk, extracts themed info, saves to `.1bcoder/scan_result.txt` |
630
677
 
631
678
  **`/agent advance`** — named agent from `agents/advance.txt`, full toolset for larger models (7B+), includes `run`, `diff`, `map`, `bkup`, and all edit tools. Shortcut: `/advance`:
632
679
 
@@ -635,6 +682,63 @@ Built-in named agents (global install):
635
682
  /advance read and summarise plan models.py, views.py
636
683
  ```
637
684
 
685
+ **`/concepts <topic>`** — alias for `/agent concepts`. Pure brainstorm agent: no tools, no files. Iterates through a list of concept seeds injected via `plan:`, produces a synthesis paragraph per turn. Useful for exploring design ideas, academic framing, or philosophical grounding without polluting the tool context.
686
+
687
+ ```
688
+ /concepts symbol grounding in software engineering
689
+ ```
690
+
691
+ ---
692
+
693
+ ### Agent procs: before and gates
694
+
695
+ `before =` and `gates =` turn an agent into a supervised loop — useful when the model is small or the task requires strict compliance.
696
+
697
+ **`before =`** fires before every LLM call. All stdout is injected as a `[context]` message so the model sees it before generating its reply. Use cases:
698
+ - `assist /short` — ask a second model for a one-sentence hint based on the last reply
699
+ - `assist /parallel profile ten_experts` — poll multiple models for the next search direction
700
+
701
+ **`gates =`** fires after every reply. Each proc receives the reply on stdin. If any prints `FAIL:`, the agent:
702
+ 1. Re-injects the current plan step (so the model sees the hint again)
703
+ 2. Feeds the FAIL reason as user feedback
704
+ 3. Retries the turn (does not advance to the next plan step)
705
+
706
+ This is the key difference from a regular proc: a gate can hold the agent on a step until it produces a compliant reply.
707
+
708
+ **Combined example** — agent that must always emit an ACTION:
709
+
710
+ ```ini
711
+ # agents/strict.txt
712
+ tools =
713
+ read
714
+ patch
715
+ tempctx
716
+
717
+ gates =
718
+ action-required
719
+
720
+ params =
721
+ agent_ctx = 6000
722
+ num_predict = 200
723
+ ```
724
+
725
+ ```
726
+ /agent strict fix the authentication bug file: plan.txt
727
+ ```
728
+
729
+ If the model reasons without acting, `action-required` prints `FAIL:` and the step is retried with the failure reason visible.
730
+
731
+ **Pattern gate** — enforce coding conventions across all turns:
732
+
733
+ ```ini
734
+ gates =
735
+ pattern-gate "from dual" "no FROM DUAL allowed"
736
+ pattern-gate "select \*" "use explicit columns"
737
+ action-required
738
+ ```
739
+
740
+ Multiple gates can be stacked. All run after each reply; a single FAIL from any of them retries the step.
741
+
638
742
  ---
639
743
 
640
744
  ### Aliases
@@ -675,7 +779,7 @@ Lines starting with `[v]` are already done and skipped. Lines starting with `#`
675
779
  | `/script show` | Display steps of the current script |
676
780
  | `/script add <command>` | Append a step to the current script |
677
781
  | `/script clear` | Wipe current script completely |
678
- | `/script reset` | Unmark all done steps |
782
+ | `/script reset` | Unmark all done steps (also happens automatically when a script runs to completion) |
679
783
  | `/script reapply [key=value ...]` | Reset all done steps then apply automatically; prompts for any NaN `{{variables}}` before running |
680
784
  | `/script refresh` | Reload script from disk and show contents |
681
785
  | `/script apply [file] [key=value ...]` | Run steps one by one (Y/n/q per step) |
@@ -725,6 +829,7 @@ Session variables store named values that are substituted as `{{name}}` in any c
725
829
  /var set name =MyService literal value
726
830
  /var def port db host declare multiple NaN variables (skips if already set)
727
831
  /var get list all variables (NaN = unset)
832
+ /var get port print value of a single variable (useful with ->)
728
833
  /var del port remove a variable
729
834
  ```
730
835
 
@@ -770,9 +875,12 @@ Any `{{key}}` found but not yet set is registered as NaN — `/script reapply` w
770
875
 
771
876
  ---
772
877
 
773
- ### Output capture (`->` and `$`)
878
+ ### Output capture (`->`, `$` and `~`)
879
+
880
+ Any command — LLM reply, tool output, or proc result — can be captured into a session variable using the `->` suffix. Two special tokens expand anywhere in a command or message:
774
881
 
775
- Any commandLLM reply, tool output, or proc result — can be captured into a session variable using the `->` suffix. The special token `$` expands to the last captured output anywhere in a command or message.
882
+ - `$` — last captured output (last AI reply or tool result)
883
+ - `~` — last user input (last message or command you typed)
776
884
 
777
885
  ```
778
886
  /map keyword extract auth.py -> keywords # capture tool output into variable
@@ -788,6 +896,15 @@ summarize this for me -> myplan # capture LLM reply
788
896
  /var set port result # also works: grab key from proc output
789
897
  ```
790
898
 
899
+ **`~` — repeat or redirect the last question:**
900
+ ```
901
+ як працює цей метод? # ask main model
902
+ /small ~ # same question → small model
903
+ /ask ~ # same question → agent mode
904
+ /explain "$" # ask small model to explain the reply
905
+ поясни: $ # ask main model to explain its own reply
906
+ ```
907
+
791
908
  `->` stores the full text (including ANSI-stripped terminal output) and also updates `$` for immediate reuse. Variables captured with `->` appear in `/var get` like any other session variable.
792
909
 
793
910
  ---
@@ -867,24 +984,67 @@ Connect external tool servers to give the AI access to filesystems, databases, w
867
984
  /mcp disconnect fs
868
985
  ```
869
986
 
870
- See [MCP.md](MCP.md) for a full list of ready-to-use servers.
987
+ See `/doc MCP` for a full list of ready-to-use servers.
871
988
 
872
989
  ---
873
990
 
874
991
  ### Parallel queries
875
992
 
876
- Send prompts to multiple models at the same time. Each answer is saved to its own file.
993
+ Send a prompt to multiple models at the same time. No quoting required.
877
994
 
878
995
  ```
879
- /parallel ["prompt"] [profile <name>] [host:port|model|file ...]
996
+ /parallel [main question] [list: a1, a2, a3] profile: name
997
+ [ctx: full|last|none] [file: path [-n N]]
998
+ [collect: compact [profile: name]] [--seq]
880
999
  ```
881
1000
 
1001
+ **Prompt modes**
1002
+
1003
+ | Mode | Behaviour |
1004
+ |---|---|
1005
+ | plain text | Same prompt sent to all workers |
1006
+ | `list: a1, a2, a3` | Aspects distributed one per worker; combined with the main question as `{main question}\n\nAspect: {aspect_i}` |
1007
+ | comma-separated prompts | Matched 1:1 to workers (last reused for remaining) |
1008
+
1009
+ Use `list:` when you want to explore a single question from multiple angles simultaneously — each model gets the full question plus one specific aspect to focus on:
1010
+
1011
+ ```
1012
+ /parallel Hegel philosophy list: axiology, epistemology, ethics, logic profile: four-models
1013
+ ```
1014
+
1015
+ **Context modes** (default: `ctx: last`)
1016
+
1017
+ | Keyword | Context sent to workers |
1018
+ |---|---|
1019
+ | `ctx: full` | Full conversation context |
1020
+ | `ctx: last` | Last message only (default) |
1021
+ | `ctx: none` | No context — prompt only |
1022
+
1023
+ **`$` and `~` expansion** — `$` expands to the last AI reply, `~` to your last input:
1024
+
1025
+ ```
1026
+ /parallel $ profile: short # ask short model to summarise last reply
1027
+ /parallel ~ list: pros, cons profile: two-models # weigh your last question from two angles
1028
+ ```
1029
+
1030
+ **File chunking** — split a file across workers:
1031
+
1032
+ ```
1033
+ /parallel file: bigfile.txt -n auto profile: cluster # -n auto = one chunk per worker
1034
+ /parallel file: notes.md profile: small # === separator used if present
1035
+ ```
1036
+
1037
+ **Collect** — compact all worker replies into the context after they finish:
1038
+
882
1039
  ```
883
- /parallel "review this for bugs" \
884
- localhost:11434|llama3.2:1b|answers/llm1.txt \
885
- localhost:11435|qwen2.5:1b|answers/llm2.txt
1040
+ /parallel list: q1, q2 profile: small1 collect: compact
1041
+ /parallel list: q1, q2 profile: small1 collect: compact profile: short
886
1042
  ```
887
1043
 
1044
+ `collect: compact` sets a savepoint automatically before workers run, then calls `/ctx compact savepoint` (optionally with an external model) once all workers finish. The result is available as `$`.
1045
+
1046
+ **Sequential mode** — `--seq` runs workers one after another instead of in parallel.
1047
+
888
1048
  **Profiles** — save a set of workers for reuse:
889
1049
 
890
1050
  ```
@@ -893,7 +1053,6 @@ Send prompts to multiple models at the same time. Each answer is saved to its ow
893
1053
  /parallel profile list # show all profiles (local + global)
894
1054
  /parallel profile show <name> # print raw profile string
895
1055
  /parallel profile add <name> # append current host+model to a profile
896
- /parallel "explain this" profile review
897
1056
  ```
898
1057
 
899
1058
  Profiles stored in `~/.1bcoder/profiles.txt` (global) or `.1bcoder/profiles.txt` (project-local):
@@ -902,6 +1061,58 @@ review: localhost:11434|ministral3:3b|ans/review.txt localhost:11435|cogito:3b|a
902
1061
  fast: localhost:11434|qwen2.5-coder:0.6b|ans/q.txt # quick sanity check
903
1062
  ```
904
1063
 
1064
+ **Sub-agent profiles** — built-in profiles that return answers directly to the main context:
1065
+
1066
+ ```
1067
+ small: localhost:11434|qwen3:0.6b|ctx
1068
+ explain: localhost:11434|gemma3:1b|ctx
1069
+ thinking: localhost:11434|lfm2.5-thinking:1.2b|ctx
1070
+ short: localhost:11434|llama3.2:1b|ctx
1071
+ ```
1072
+
1073
+ These are aliased as `/small`, `/explain`, `/thinking`, `/short`:
1074
+
1075
+ ```
1076
+ /small what does this function return? # ask tiny model, last message as context
1077
+ /explain $ # ask gemma to explain last reply
1078
+ /short ~ ctx: none # repeat last question with no context
1079
+ ```
1080
+
1081
+ ---
1082
+
1083
+ ### Hooks (`/hook`)
1084
+
1085
+ Run a script automatically **before** or **after** a command. Useful for backups before edits, linting after patches, or any pre/post workflow step.
1086
+
1087
+ ```
1088
+ /hook before <cmd> <script> # run script before every <cmd>
1089
+ /hook after <cmd> <script> # run script after every <cmd>
1090
+ /hook list # show active hooks
1091
+ /hook clear <cmd> # remove hooks for <cmd>
1092
+ /hook clear # remove all hooks
1093
+ ```
1094
+
1095
+ `<cmd>` is the command name without the slash: `edit`, `patch`, `fix`, `insert`, `run`.
1096
+
1097
+ **Two script types:**
1098
+ - `.txt` — 1bcoder script (sequence of commands). `{{file}}` and `{{range}}` are injected as session variables.
1099
+ - `.py` — Python guard subprocess. Receives trigger content on `stdin`, outputs `BLOCK:`/`ALERT:`/`ACTION:` lines.
1100
+
1101
+ **Auto-injected for `.txt` scripts:**
1102
+
1103
+ | Variable | Value |
1104
+ |---|---|
1105
+ | `{{file}}` | file argument of the triggering command |
1106
+ | `{{range}}` | line range (if specified), e.g. `10-25` |
1107
+
1108
+ **Examples:**
1109
+ ```
1110
+ /hook before edit /bkup {{file}} # backup before every edit (.txt script)
1111
+ /hook before run sql_readonly_guard.py # block dangerous SQL (.py guard)
1112
+ ```
1113
+
1114
+ Missing `.txt` script cancels a `before` hook. `.py` guard cancels only if it prints `BLOCK:`. Step errors inside `.txt` scripts do not cancel the command.
1115
+
905
1116
  ---
906
1117
 
907
1118
  ### Prompt templates
@@ -927,22 +1138,51 @@ Run a Python script against the last LLM reply. Useful for extracting filenames,
927
1138
  /proc run <name> -f <file> # run against an external file instead of last reply
928
1139
  /proc on grounding-check # persistent: run after every reply automatically
929
1140
  /proc off # stop persistent processor
1141
+ /proc before on assist /short # before-proc: run BEFORE every LLM call, inject output as [context]
1142
+ /proc before off # stop before processor
1143
+ /proc gate on action-required # gate: run after reply; FAIL retries current plan step
1144
+ /proc gate on pattern-gate "regexp" "message" # gate with regexp
1145
+ /proc gate off # stop gate processor
930
1146
  /proc new my-proc # create a new processor from template
931
1147
  ```
932
1148
 
933
- **Processor protocol:** `stdin` = last LLM reply · `stdout` = result · `key=value` lines = extracted params · `ACTION: /command` = confirmed and executed (run mode only) · exit 1 = failure.
1149
+ **Processor protocol:**
1150
+ - `stdin` = last LLM reply
1151
+ - `stdout` = result (injected into context)
1152
+ - `key=value` lines = extracted params
1153
+ - `ACTION: /command` = confirmed and executed (run mode only)
1154
+ - `ALERT: message` = warning printed, continues
1155
+ - `BLOCK: reason` = cancels the triggering command (hook mode only)
1156
+ - `FAIL: reason` = gate mode: retries plan step and feeds reason to model; proc mode: prints warning
1157
+ - exit 1 = show stderr as warning, skip ACTION
1158
+ - `BCODER_WORKDIR` env var is set to the current working directory in all proc subprocesses (use to find `map.txt`, project files, etc.)
934
1159
 
935
- Built-in processors in `<install>/.1bcoder/proc/`:
1160
+ Built-in processors in `~/.1bcoder/proc/`:
936
1161
 
937
1162
  | Processor | Purpose | Best mode |
938
1163
  |---|---|---|
939
1164
  | `extract-files` | Extract filenames, `ACTION: /read` if one found | one-shot |
940
1165
  | `extract-code` | Extract code blocks; `ACTION: /save <file>` if one block + filename detected | one-shot |
941
1166
  | `extract-list` | Convert first bullet/numbered list in reply to comma-separated line | one-shot |
942
- | `grounding-check` | Score identifiers against `map.txt`, warn if <50% | persistent |
1167
+ | `grounding-check` | Score identifiers against `map.txt`, warn if <50% | persistent / gate |
943
1168
  | `collect-files` | Accumulate filenames to `.1bcoder/collected-files.txt` | persistent |
944
- | `md` | Render last reply as formatted Markdown in terminal (`pip install rich`) | one-shot |
1169
+ | `md` | Render last reply as formatted Markdown in terminal | one-shot |
945
1170
  | `mdx` | Render last reply as Markdown + LaTeX (KaTeX) + Mermaid diagrams in browser | one-shot |
1171
+ | `ctx_cut` | Auto `/ctx cut` when context exceeds threshold (default 90%) | persistent |
1172
+ | `rude_words` | Alert if reply contains profanity (`ua` arg adds Ukrainian list) | persistent |
1173
+ | `secret_check` | Alert if reply contains sensitive names (google, anthropic…) | persistent |
1174
+ | `sql_readonly_guard` | Alert (proc) or block (hook) on write SQL statements | both |
1175
+ | `action-required` | FAIL if agent reply has no `ACTION:` and no completion phrase | gate |
1176
+ | `pattern-gate` | FAIL if reply matches given regexp (`argv[1]` = pattern, `argv[2]` = message) | gate |
1177
+ | `assist` | Before-proc: reads last reply, asks LLM for one-sentence next-step hint | before |
1178
+
1179
+ **Guard usage examples:**
1180
+ ```
1181
+ /proc on ctx_cut 80 # auto cut at 80%
1182
+ /proc on rude_words ua # profanity check + Ukrainian
1183
+ /proc on secret_check client=acme # + custom keyword
1184
+ /hook before run sql_readonly_guard.py # block /run with DELETE/DROP/UPDATE
1185
+ ```
946
1186
 
947
1187
  See `/doc PROC` for the full protocol, built-in processor reference, and guide to writing your own.
948
1188
 
@@ -1012,11 +1252,16 @@ Built-in team scripts in `<install>/.1bcoder/scripts/`:
1012
1252
  | `/ctx cut` | Remove oldest messages until context fits |
1013
1253
  | `/ctx compact` | Ask AI to summarize the conversation, replace context with summary |
1014
1254
  | `/ctx save <file>` | Save full conversation to file |
1015
- | `/ctx load <file>` | Restore a saved conversation |
1255
+ | `/ctx load <file>` | Restore a saved conversation (bare name resolved from `.1bcoder/ctx/`) |
1256
+ | `/ctx list` | List files in `.1bcoder/ctx/` project context library |
1016
1257
  | `/ctx savepoint set` | Mark current position as a savepoint |
1017
1258
  | `/ctx savepoint rollback` | Remove all messages added since the savepoint |
1018
1259
  | `/ctx savepoint compact` | Summarize messages since savepoint, replace with summary |
1019
1260
  | `/ctx savepoint show` | Show savepoint info and messages added since |
1261
+ | `/tempctx <N>` | Set agent context limit to N tokens for this run (also settable via `params = agent_ctx = N` in agent file) |
1262
+ | `/tempctx show` | Show agent context size — only available inside an agent loop |
1263
+ | `/tempctx cut` | Remove oldest messages from agent context until it fits |
1264
+ | `/tempctx clear` | Reset agent context to system prompt + task only |
1020
1265
  | `/think exclude` | Strip `<think>` blocks from context (default) |
1021
1266
  | `/think include` | Keep `<think>` blocks in context (pass model reasoning to next turn) |
1022
1267
  | `/think show` | Show `<think>` blocks in terminal (default) |
@@ -17,21 +17,33 @@ _bcoder_data/profiles.txt
17
17
  _bcoder_data/prompts.txt
18
18
  _bcoder_data/agents/advance.txt
19
19
  _bcoder_data/agents/ask.txt
20
+ _bcoder_data/agents/compact.txt
21
+ _bcoder_data/agents/concepts.txt
20
22
  _bcoder_data/agents/fill.txt
21
23
  _bcoder_data/agents/planning.txt
24
+ _bcoder_data/agents/scan.txt
22
25
  _bcoder_data/agents/sqlite.txt
23
26
  _bcoder_data/doc/MCP.md
24
27
  _bcoder_data/doc/PARAM.md
25
28
  _bcoder_data/doc/PROC.md
29
+ _bcoder_data/proc/action-required.py
26
30
  _bcoder_data/proc/add-save.py
31
+ _bcoder_data/proc/assist.py
27
32
  _bcoder_data/proc/collect-files.py
33
+ _bcoder_data/proc/ctx_cut.py
28
34
  _bcoder_data/proc/extract-code.py
29
35
  _bcoder_data/proc/extract-files.py
30
36
  _bcoder_data/proc/extract-list.py
31
37
  _bcoder_data/proc/grounding-check.py
32
38
  _bcoder_data/proc/md.py
33
39
  _bcoder_data/proc/mdx.py
40
+ _bcoder_data/proc/pattern-gate.py
34
41
  _bcoder_data/proc/regexp-extract.py
42
+ _bcoder_data/proc/rude_words.py
43
+ _bcoder_data/proc/scan-save.py
44
+ _bcoder_data/proc/secret_check.py
45
+ _bcoder_data/proc/sql_readonly_guard.py
46
+ _bcoder_data/proc/tempctx-cut.py
35
47
  _bcoder_data/prompts/analysis.txt
36
48
  _bcoder_data/prompts/sumarise.txt
37
49
  _bcoder_data/scripts/AddFunction.txt
@@ -55,6 +67,8 @@ _bcoder_data/scripts/RunAndFix.txt
55
67
  _bcoder_data/scripts/SQLiteSchema.txt
56
68
  _bcoder_data/scripts/WikiPage.txt
57
69
  _bcoder_data/scripts/WikiSearch.txt
70
+ _bcoder_data/scripts/auto-bkup.txt
71
+ _bcoder_data/scripts/edit-control.txt
58
72
  _bcoder_data/scripts/parallel_call.txt
59
73
  _bcoder_data/scripts/plan.txt
60
74
  _bcoder_data/scripts/set_ctx.txt