1bcoder 0.1.3__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 (87) hide show
  1. {1bcoder-0.1.3 → 1bcoder-0.1.4}/1bcoder.egg-info/PKG-INFO +185 -32
  2. {1bcoder-0.1.3 → 1bcoder-0.1.4}/1bcoder.egg-info/SOURCES.txt +10 -0
  3. {1bcoder-0.1.3 → 1bcoder-0.1.4}/PKG-INFO +185 -32
  4. {1bcoder-0.1.3 → 1bcoder-0.1.4}/README.md +184 -31
  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/proc/action-required.py +42 -0
  10. 1bcoder-0.1.4/_bcoder_data/proc/assist.py +48 -0
  11. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/grounding-check.py +2 -1
  12. 1bcoder-0.1.4/_bcoder_data/proc/pattern-gate.py +28 -0
  13. 1bcoder-0.1.4/_bcoder_data/proc/scan-save.py +19 -0
  14. 1bcoder-0.1.4/_bcoder_data/proc/tempctx-cut.py +19 -0
  15. 1bcoder-0.1.4/_bcoder_data/scripts/auto-bkup.txt +4 -0
  16. 1bcoder-0.1.4/_bcoder_data/scripts/edit-control.txt +6 -0
  17. {1bcoder-0.1.3 → 1bcoder-0.1.4}/chat.py +969 -261
  18. {1bcoder-0.1.3 → 1bcoder-0.1.4}/pyproject.toml +1 -1
  19. 1bcoder-0.1.3/_bcoder_data/aliases.txt +0 -13
  20. {1bcoder-0.1.3 → 1bcoder-0.1.4}/1bcoder.egg-info/dependency_links.txt +0 -0
  21. {1bcoder-0.1.3 → 1bcoder-0.1.4}/1bcoder.egg-info/entry_points.txt +0 -0
  22. {1bcoder-0.1.3 → 1bcoder-0.1.4}/1bcoder.egg-info/requires.txt +0 -0
  23. {1bcoder-0.1.3 → 1bcoder-0.1.4}/1bcoder.egg-info/top_level.txt +0 -0
  24. {1bcoder-0.1.3 → 1bcoder-0.1.4}/LICENSE +0 -0
  25. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/__init__.py +0 -0
  26. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/agents/advance.txt +0 -0
  27. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/agents/ask.txt +0 -0
  28. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/agents/fill.txt +0 -0
  29. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/agents/planning.txt +0 -0
  30. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/agents/sqlite.txt +0 -0
  31. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/doc/MCP.md +0 -0
  32. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/doc/PARAM.md +0 -0
  33. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/doc/PROC.md +0 -0
  34. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/map.txt +0 -0
  35. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/add-save.py +0 -0
  36. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/collect-files.py +0 -0
  37. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/ctx_cut.py +0 -0
  38. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/extract-code.py +0 -0
  39. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/extract-files.py +0 -0
  40. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/extract-list.py +0 -0
  41. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/md.py +0 -0
  42. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/mdx.py +0 -0
  43. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/regexp-extract.py +0 -0
  44. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/rude_words.py +0 -0
  45. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/secret_check.py +0 -0
  46. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/proc/sql_readonly_guard.py +0 -0
  47. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/profiles.txt +0 -0
  48. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/prompts/analysis.txt +0 -0
  49. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/prompts/sumarise.txt +0 -0
  50. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/prompts.txt +0 -0
  51. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/AddFunction.txt +0 -0
  52. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/AskProject.txt +0 -0
  53. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/CheckRequirements.txt +0 -0
  54. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/DockerMySQL.txt +0 -0
  55. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/DockerNginx.txt +0 -0
  56. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/DockerPython.txt +0 -0
  57. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/DockerStack.txt +0 -0
  58. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/DuckDuckGoInstant.txt +0 -0
  59. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/EnvTemplate.txt +0 -0
  60. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/Explain.txt +0 -0
  61. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/ExploreProjectStructure.txt +0 -0
  62. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/GitIgnorePython.txt +0 -0
  63. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/MySQLDump.txt +0 -0
  64. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/NewScript.txt +0 -0
  65. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/PipFreeze.txt +0 -0
  66. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/PyPI.txt +0 -0
  67. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/Refactor.txt +0 -0
  68. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/RunAndFix.txt +0 -0
  69. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/SQLiteSchema.txt +0 -0
  70. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/WikiPage.txt +0 -0
  71. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/WikiSearch.txt +0 -0
  72. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/parallel_call.txt +0 -0
  73. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/personal/content/create-regular-content.txt +0 -0
  74. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/personal/content/plan.txt +0 -0
  75. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/personal/test/collect-data-from-test-environment.txt +0 -0
  76. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/plan.txt +0 -0
  77. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/remote/create-content-on-remote-server.txt +0 -0
  78. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/set_ctx.txt +0 -0
  79. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/team-map-worker.txt +0 -0
  80. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/team-search-worker.txt +0 -0
  81. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/team-summarize.txt +0 -0
  82. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/team-tree-worker.txt +0 -0
  83. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/scripts/test.txt +0 -0
  84. {1bcoder-0.1.3 → 1bcoder-0.1.4}/_bcoder_data/teams/code-analysis.yaml +0 -0
  85. {1bcoder-0.1.3 → 1bcoder-0.1.4}/map_index.py +0 -0
  86. {1bcoder-0.1.3 → 1bcoder-0.1.4}/map_query.py +0 -0
  87. {1bcoder-0.1.3 → 1bcoder-0.1.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: 1bcoder
3
- Version: 0.1.3
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
5
  Project-URL: Homepage, https://github.com/szholobetsky/1bcoder
6
6
  Project-URL: Repository, https://github.com/szholobetsky/1bcoder
@@ -78,19 +78,22 @@ Tasks that require the model to decide *what to look at* — refactoring across
78
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
79
79
  - Run shell commands and inject their output with `/run`
80
80
  - 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 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
82
82
  - **Scripts** — reusable sequences of commands stored as `.txt` files, run step-by-step or fully automated
83
83
  - **Script from history** — `/script create ctx` captures this session's commands into a reusable script automatically
84
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)
85
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
86
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
87
- - **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
88
- - **`/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
89
89
  - **`/fill`** — fill agent: reads NaN session variables, scans project for `.var` files and config files, sets each value automatically
90
90
  - **Session variables** — `{{name}}` placeholders substituted in any command; save/load from `.var` files for offline reuse without loading files into context
91
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
92
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`
93
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
94
97
  - **MCP support** — connect external tool servers (filesystem, web, git, database, browser…) via the Model Context Protocol
95
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
96
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
@@ -118,6 +121,16 @@ cd 1bcoder
118
121
  pip install -e .
119
122
  ```
120
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
+
121
134
  ### Option 3 — Install directly from GitHub
122
135
 
123
136
  ```bash
@@ -552,8 +565,8 @@ When the loop finishes you are prompted: **`[s]ummary / [a]ll / [n]one`** — ch
552
565
  | `f` | Send feedback to the AI and skip the action (redirect the model mid-loop) |
553
566
  | `q` | Stop the agent |
554
567
 
555
- - **`plan step1, step2, ...`** — optional comma-separated list of items injected as hints one per turn
556
- - **`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
557
570
 
558
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.
559
572
 
@@ -561,8 +574,8 @@ When the loop finishes you are prompted: **`[s]ummary / [a]ll / [n]one`** — ch
561
574
  /agent find and fix the divide by zero bug in calc.py
562
575
  /agent -t 1 read models.py and explain the User class
563
576
  /agent -y -t 5 refactor utils.py
564
- /agent read file plan models.py, views.py, urls.py
565
- /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
566
579
  ```
567
580
 
568
581
  Configure the default agent in `.1bcoder/agent.txt`:
@@ -610,18 +623,48 @@ tools =
610
623
  aliases =
611
624
  /search = /map find {{args}}
612
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"
613
638
  ```
614
639
 
615
640
  - **`system =`** — inline multiline system prompt; indented lines continue the block; `{tool_list}` is substituted automatically from the `tools =` list
616
- - **`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)
617
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
618
- - **`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`)
619
647
 
620
648
  ```ini
621
649
  # Example: planning agent saves its output automatically
622
650
  on_done = /save plan.txt -w
623
651
  ```
624
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
+
625
668
  Built-in named agents (global install):
626
669
 
627
670
  | Agent | Command | Description |
@@ -630,6 +673,7 @@ Built-in named agents (global install):
630
673
  | `advance` | `/advance <task>` or `/agent advance` | Full toolset for 7B+ models |
631
674
  | `planning` | `/plan <goal>` | Researches project, writes natural-language plan to `plan.txt` |
632
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` |
633
677
 
634
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`:
635
679
 
@@ -638,6 +682,63 @@ Built-in named agents (global install):
638
682
  /advance read and summarise plan models.py, views.py
639
683
  ```
640
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
+
641
742
  ---
642
743
 
643
744
  ### Aliases
@@ -889,27 +990,60 @@ See `/doc MCP` for a full list of ready-to-use servers.
889
990
 
890
991
  ### Parallel queries
891
992
 
892
- Send a prompt to multiple models at the same time.
993
+ Send a prompt to multiple models at the same time. No quoting required.
994
+
995
+ ```
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]
999
+ ```
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:
893
1010
 
894
1011
  ```
895
- /parallel ["prompt"] [--ctx|--last|--no-ctx] [profile <name>] [host:port|model|(file or ctx) ...]
1012
+ /parallel Hegel philosophy list: axiology, epistemology, ethics, logic profile: four-models
896
1013
  ```
897
1014
 
898
- | Flag | Behaviour |
1015
+ **Context modes** (default: `ctx: last`)
1016
+
1017
+ | Keyword | Context sent to workers |
899
1018
  |---|---|
900
- | *(default)* | Full conversation context is sent to every worker |
901
- | `--last` | Only the last user message is sent (saves tokens for small models) |
902
- | `--no-ctx` | No context — prompt only (fastest, zero leakage) |
1019
+ | `ctx: full` | Full conversation context |
1020
+ | `ctx: last` | Last message only (default) |
1021
+ | `ctx: none` | No context — prompt only |
903
1022
 
904
- Workers write results to a file **or** inject them back into the main context:
1023
+ **`$` and `~` expansion** — `$` expands to the last AI reply, `~` to your last input:
905
1024
 
906
1025
  ```
907
- /parallel "review this for bugs" \
908
- localhost:11434|llama3.2:1b|ans/llm1.txt \
909
- localhost:11435|qwen2.5:1b|ctx
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
910
1028
  ```
911
1029
 
912
- Using `ctx` as the output target injects the worker's reply into the main conversation the next AI turn will see it.
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
+
1039
+ ```
1040
+ /parallel list: q1, q2 profile: small1 collect: compact
1041
+ /parallel list: q1, q2 profile: small1 collect: compact profile: short
1042
+ ```
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.
913
1047
 
914
1048
  **Profiles** — save a set of workers for reuse:
915
1049
 
@@ -919,7 +1053,6 @@ Using `ctx` as the output target injects the worker's reply into the main conver
919
1053
  /parallel profile list # show all profiles (local + global)
920
1054
  /parallel profile show <name> # print raw profile string
921
1055
  /parallel profile add <name> # append current host+model to a profile
922
- /parallel "explain this" profile review
923
1056
  ```
924
1057
 
925
1058
  Profiles stored in `~/.1bcoder/profiles.txt` (global) or `.1bcoder/profiles.txt` (project-local):
@@ -928,7 +1061,7 @@ review: localhost:11434|ministral3:3b|ans/review.txt localhost:11435|cogito:3b|a
928
1061
  fast: localhost:11434|qwen2.5-coder:0.6b|ans/q.txt # quick sanity check
929
1062
  ```
930
1063
 
931
- **Sub-agent profiles** — built-in profiles that return answers directly to the main context (`ctx`):
1064
+ **Sub-agent profiles** — built-in profiles that return answers directly to the main context:
932
1065
 
933
1066
  ```
934
1067
  small: localhost:11434|qwen3:0.6b|ctx
@@ -937,16 +1070,14 @@ thinking: localhost:11434|lfm2.5-thinking:1.2b|ctx
937
1070
  short: localhost:11434|llama3.2:1b|ctx
938
1071
  ```
939
1072
 
940
- These are aliased as `/small`, `/explain`, `/thinking`, `/short` — use them like sub-agents:
1073
+ These are aliased as `/small`, `/explain`, `/thinking`, `/short`:
941
1074
 
942
1075
  ```
943
- /small "what does this function return?" --no-ctx # ask tiny model, no context bleed
944
- /explain "$" # ask gemma to explain last reply
945
- /small ~ # repeat last question to a small model
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
946
1079
  ```
947
1080
 
948
- `~` expands to the last message you typed; `$` expands to the last AI reply — combine them to build sub-agent pipelines without copy-pasting.
949
-
950
1081
  ---
951
1082
 
952
1083
  ### Hooks (`/hook`)
@@ -1007,10 +1138,24 @@ Run a Python script against the last LLM reply. Useful for extracting filenames,
1007
1138
  /proc run <name> -f <file> # run against an external file instead of last reply
1008
1139
  /proc on grounding-check # persistent: run after every reply automatically
1009
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
1010
1146
  /proc new my-proc # create a new processor from template
1011
1147
  ```
1012
1148
 
1013
- **Processor protocol:** `stdin` = last LLM reply · `stdout` = result · `key=value` lines = extracted params · `ACTION: /command` = confirmed and executed (run mode only) · `ALERT: message` = warning printed, continues · `BLOCK: reason` = cancels the triggering command (hook 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.)
1014
1159
 
1015
1160
  Built-in processors in `~/.1bcoder/proc/`:
1016
1161
 
@@ -1019,7 +1164,7 @@ Built-in processors in `~/.1bcoder/proc/`:
1019
1164
  | `extract-files` | Extract filenames, `ACTION: /read` if one found | one-shot |
1020
1165
  | `extract-code` | Extract code blocks; `ACTION: /save <file>` if one block + filename detected | one-shot |
1021
1166
  | `extract-list` | Convert first bullet/numbered list in reply to comma-separated line | one-shot |
1022
- | `grounding-check` | Score identifiers against `map.txt`, warn if <50% | persistent |
1167
+ | `grounding-check` | Score identifiers against `map.txt`, warn if <50% | persistent / gate |
1023
1168
  | `collect-files` | Accumulate filenames to `.1bcoder/collected-files.txt` | persistent |
1024
1169
  | `md` | Render last reply as formatted Markdown in terminal | one-shot |
1025
1170
  | `mdx` | Render last reply as Markdown + LaTeX (KaTeX) + Mermaid diagrams in browser | one-shot |
@@ -1027,6 +1172,9 @@ Built-in processors in `~/.1bcoder/proc/`:
1027
1172
  | `rude_words` | Alert if reply contains profanity (`ua` arg adds Ukrainian list) | persistent |
1028
1173
  | `secret_check` | Alert if reply contains sensitive names (google, anthropic…) | persistent |
1029
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 |
1030
1178
 
1031
1179
  **Guard usage examples:**
1032
1180
  ```
@@ -1104,11 +1252,16 @@ Built-in team scripts in `<install>/.1bcoder/scripts/`:
1104
1252
  | `/ctx cut` | Remove oldest messages until context fits |
1105
1253
  | `/ctx compact` | Ask AI to summarize the conversation, replace context with summary |
1106
1254
  | `/ctx save <file>` | Save full conversation to file |
1107
- | `/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 |
1108
1257
  | `/ctx savepoint set` | Mark current position as a savepoint |
1109
1258
  | `/ctx savepoint rollback` | Remove all messages added since the savepoint |
1110
1259
  | `/ctx savepoint compact` | Summarize messages since savepoint, replace with summary |
1111
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 |
1112
1265
  | `/think exclude` | Strip `<think>` blocks from context (default) |
1113
1266
  | `/think include` | Keep `<think>` blocks in context (pass model reasoning to next turn) |
1114
1267
  | `/think show` | Show `<think>` blocks in terminal (default) |
@@ -17,13 +17,18 @@ _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
28
33
  _bcoder_data/proc/ctx_cut.py
29
34
  _bcoder_data/proc/extract-code.py
@@ -32,10 +37,13 @@ _bcoder_data/proc/extract-list.py
32
37
  _bcoder_data/proc/grounding-check.py
33
38
  _bcoder_data/proc/md.py
34
39
  _bcoder_data/proc/mdx.py
40
+ _bcoder_data/proc/pattern-gate.py
35
41
  _bcoder_data/proc/regexp-extract.py
36
42
  _bcoder_data/proc/rude_words.py
43
+ _bcoder_data/proc/scan-save.py
37
44
  _bcoder_data/proc/secret_check.py
38
45
  _bcoder_data/proc/sql_readonly_guard.py
46
+ _bcoder_data/proc/tempctx-cut.py
39
47
  _bcoder_data/prompts/analysis.txt
40
48
  _bcoder_data/prompts/sumarise.txt
41
49
  _bcoder_data/scripts/AddFunction.txt
@@ -59,6 +67,8 @@ _bcoder_data/scripts/RunAndFix.txt
59
67
  _bcoder_data/scripts/SQLiteSchema.txt
60
68
  _bcoder_data/scripts/WikiPage.txt
61
69
  _bcoder_data/scripts/WikiSearch.txt
70
+ _bcoder_data/scripts/auto-bkup.txt
71
+ _bcoder_data/scripts/edit-control.txt
62
72
  _bcoder_data/scripts/parallel_call.txt
63
73
  _bcoder_data/scripts/plan.txt
64
74
  _bcoder_data/scripts/set_ctx.txt