sliceagent 0.1.0__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 (201) hide show
  1. sliceagent-0.1.0/.dockerignore +20 -0
  2. sliceagent-0.1.0/.env.example +21 -0
  3. sliceagent-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +21 -0
  4. sliceagent-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
  5. sliceagent-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +16 -0
  6. sliceagent-0.1.0/.github/dependabot.yml +10 -0
  7. sliceagent-0.1.0/.github/workflows/ci.yml +44 -0
  8. sliceagent-0.1.0/.github/workflows/publish.yml +36 -0
  9. sliceagent-0.1.0/.gitignore +58 -0
  10. sliceagent-0.1.0/CHANGELOG.md +65 -0
  11. sliceagent-0.1.0/CODE_OF_CONDUCT.md +12 -0
  12. sliceagent-0.1.0/CONTRIBUTING.md +56 -0
  13. sliceagent-0.1.0/Dockerfile +21 -0
  14. sliceagent-0.1.0/LICENSE +21 -0
  15. sliceagent-0.1.0/NOTICE +61 -0
  16. sliceagent-0.1.0/PKG-INFO +262 -0
  17. sliceagent-0.1.0/QUICKSTART.md +61 -0
  18. sliceagent-0.1.0/README.md +229 -0
  19. sliceagent-0.1.0/SECURITY.md +37 -0
  20. sliceagent-0.1.0/examples/plugins/hello/__init__.py +29 -0
  21. sliceagent-0.1.0/examples/plugins/hello/plugin.toml +5 -0
  22. sliceagent-0.1.0/install.sh +69 -0
  23. sliceagent-0.1.0/pyproject.toml +97 -0
  24. sliceagent-0.1.0/scripts/gen_config_reference.py +62 -0
  25. sliceagent-0.1.0/scripts/run_tests.sh +27 -0
  26. sliceagent-0.1.0/sliceagent.toml.example +35 -0
  27. sliceagent-0.1.0/src/sliceagent/__init__.py +3 -0
  28. sliceagent-0.1.0/src/sliceagent/__main__.py +6 -0
  29. sliceagent-0.1.0/src/sliceagent/access.py +93 -0
  30. sliceagent-0.1.0/src/sliceagent/agents.py +173 -0
  31. sliceagent-0.1.0/src/sliceagent/background_review.py +146 -0
  32. sliceagent-0.1.0/src/sliceagent/binsniff.py +89 -0
  33. sliceagent-0.1.0/src/sliceagent/cli.py +890 -0
  34. sliceagent-0.1.0/src/sliceagent/clock.py +32 -0
  35. sliceagent-0.1.0/src/sliceagent/code_grep.py +329 -0
  36. sliceagent-0.1.0/src/sliceagent/code_index.py +417 -0
  37. sliceagent-0.1.0/src/sliceagent/config.py +240 -0
  38. sliceagent-0.1.0/src/sliceagent/context_overflow.py +227 -0
  39. sliceagent-0.1.0/src/sliceagent/envspec.py +129 -0
  40. sliceagent-0.1.0/src/sliceagent/errors.py +167 -0
  41. sliceagent-0.1.0/src/sliceagent/events.py +96 -0
  42. sliceagent-0.1.0/src/sliceagent/finding_types.py +70 -0
  43. sliceagent-0.1.0/src/sliceagent/flags.py +63 -0
  44. sliceagent-0.1.0/src/sliceagent/fuzzy.py +135 -0
  45. sliceagent-0.1.0/src/sliceagent/guardrails.py +438 -0
  46. sliceagent-0.1.0/src/sliceagent/guidance.py +69 -0
  47. sliceagent-0.1.0/src/sliceagent/hippocampus.py +581 -0
  48. sliceagent-0.1.0/src/sliceagent/hooks.py +334 -0
  49. sliceagent-0.1.0/src/sliceagent/interfaces.py +144 -0
  50. sliceagent-0.1.0/src/sliceagent/llm.py +695 -0
  51. sliceagent-0.1.0/src/sliceagent/loop.py +548 -0
  52. sliceagent-0.1.0/src/sliceagent/mcp_client.py +255 -0
  53. sliceagent-0.1.0/src/sliceagent/mcp_security.py +77 -0
  54. sliceagent-0.1.0/src/sliceagent/memory.py +428 -0
  55. sliceagent-0.1.0/src/sliceagent/metrics.py +103 -0
  56. sliceagent-0.1.0/src/sliceagent/model_catalog.py +124 -0
  57. sliceagent-0.1.0/src/sliceagent/monitor.py +615 -0
  58. sliceagent-0.1.0/src/sliceagent/neocortex.py +436 -0
  59. sliceagent-0.1.0/src/sliceagent/onboarding.py +323 -0
  60. sliceagent-0.1.0/src/sliceagent/oracle.py +36 -0
  61. sliceagent-0.1.0/src/sliceagent/pagetable.py +255 -0
  62. sliceagent-0.1.0/src/sliceagent/pfc.py +449 -0
  63. sliceagent-0.1.0/src/sliceagent/plugins.py +127 -0
  64. sliceagent-0.1.0/src/sliceagent/policy.py +234 -0
  65. sliceagent-0.1.0/src/sliceagent/procman.py +187 -0
  66. sliceagent-0.1.0/src/sliceagent/prompt.py +239 -0
  67. sliceagent-0.1.0/src/sliceagent/records.py +108 -0
  68. sliceagent-0.1.0/src/sliceagent/recovery.py +119 -0
  69. sliceagent-0.1.0/src/sliceagent/regions.py +678 -0
  70. sliceagent-0.1.0/src/sliceagent/registry.py +128 -0
  71. sliceagent-0.1.0/src/sliceagent/retriever.py +19 -0
  72. sliceagent-0.1.0/src/sliceagent/safety.py +332 -0
  73. sliceagent-0.1.0/src/sliceagent/sandbox.py +143 -0
  74. sliceagent-0.1.0/src/sliceagent/scheduler.py +92 -0
  75. sliceagent-0.1.0/src/sliceagent/search_index.py +289 -0
  76. sliceagent-0.1.0/src/sliceagent/seed.py +465 -0
  77. sliceagent-0.1.0/src/sliceagent/sensory_cortex.py +500 -0
  78. sliceagent-0.1.0/src/sliceagent/session.py +222 -0
  79. sliceagent-0.1.0/src/sliceagent/skill_provenance.py +71 -0
  80. sliceagent-0.1.0/src/sliceagent/skill_usage.py +123 -0
  81. sliceagent-0.1.0/src/sliceagent/skills.py +209 -0
  82. sliceagent-0.1.0/src/sliceagent/subagent.py +332 -0
  83. sliceagent-0.1.0/src/sliceagent/subdir_hints.py +222 -0
  84. sliceagent-0.1.0/src/sliceagent/swap.py +182 -0
  85. sliceagent-0.1.0/src/sliceagent/taskstate.py +57 -0
  86. sliceagent-0.1.0/src/sliceagent/telemetry.py +59 -0
  87. sliceagent-0.1.0/src/sliceagent/terminal.py +240 -0
  88. sliceagent-0.1.0/src/sliceagent/text_utils.py +56 -0
  89. sliceagent-0.1.0/src/sliceagent/tool_summary.py +93 -0
  90. sliceagent-0.1.0/src/sliceagent/tools.py +1194 -0
  91. sliceagent-0.1.0/src/sliceagent/tui.py +1377 -0
  92. sliceagent-0.1.0/src/sliceagent/web.py +354 -0
  93. sliceagent-0.1.0/tests/README.md +25 -0
  94. sliceagent-0.1.0/tests/test_active_focus.py +150 -0
  95. sliceagent-0.1.0/tests/test_agents.py +139 -0
  96. sliceagent-0.1.0/tests/test_ask_echo.py +65 -0
  97. sliceagent-0.1.0/tests/test_ask_user.py +159 -0
  98. sliceagent-0.1.0/tests/test_background_review.py +123 -0
  99. sliceagent-0.1.0/tests/test_binary_view.py +72 -0
  100. sliceagent-0.1.0/tests/test_bound_is_relevance.py +69 -0
  101. sliceagent-0.1.0/tests/test_breadth_e2e.py +145 -0
  102. sliceagent-0.1.0/tests/test_bugfix_2b.py +103 -0
  103. sliceagent-0.1.0/tests/test_bugfix_breadth_wave.py +73 -0
  104. sliceagent-0.1.0/tests/test_bugfix_current_request.py +86 -0
  105. sliceagent-0.1.0/tests/test_bugfix_linenum.py +83 -0
  106. sliceagent-0.1.0/tests/test_bugfix_loop_wave.py +99 -0
  107. sliceagent-0.1.0/tests/test_bugfix_memory_wave.py +105 -0
  108. sliceagent-0.1.0/tests/test_bugfix_p0a.py +84 -0
  109. sliceagent-0.1.0/tests/test_bugfix_p0b.py +66 -0
  110. sliceagent-0.1.0/tests/test_bugfix_p0c.py +85 -0
  111. sliceagent-0.1.0/tests/test_bugfix_selfreview.py +86 -0
  112. sliceagent-0.1.0/tests/test_bugfix_selfreview_siblings.py +83 -0
  113. sliceagent-0.1.0/tests/test_bugfix_skills_h1.py +89 -0
  114. sliceagent-0.1.0/tests/test_bugfix_slice_wave.py +75 -0
  115. sliceagent-0.1.0/tests/test_bugfix_subagent_wave.py +97 -0
  116. sliceagent-0.1.0/tests/test_bugfix_tools_wave.py +99 -0
  117. sliceagent-0.1.0/tests/test_bughunt_fixes.py +1359 -0
  118. sliceagent-0.1.0/tests/test_cache_manifest.py +290 -0
  119. sliceagent-0.1.0/tests/test_checkpoint.py +77 -0
  120. sliceagent-0.1.0/tests/test_cli_smoke.py +41 -0
  121. sliceagent-0.1.0/tests/test_closure.py +118 -0
  122. sliceagent-0.1.0/tests/test_code_grep.py +186 -0
  123. sliceagent-0.1.0/tests/test_code_index.py +228 -0
  124. sliceagent-0.1.0/tests/test_consolidate.py +318 -0
  125. sliceagent-0.1.0/tests/test_context_overflow.py +147 -0
  126. sliceagent-0.1.0/tests/test_conversation.py +85 -0
  127. sliceagent-0.1.0/tests/test_coresidency.py +109 -0
  128. sliceagent-0.1.0/tests/test_echo_before_blocking.py +77 -0
  129. sliceagent-0.1.0/tests/test_episode.py +134 -0
  130. sliceagent-0.1.0/tests/test_errors_backoff.py +107 -0
  131. sliceagent-0.1.0/tests/test_esc_sentinel.py +262 -0
  132. sliceagent-0.1.0/tests/test_exec_env.py +81 -0
  133. sliceagent-0.1.0/tests/test_finding_types.py +102 -0
  134. sliceagent-0.1.0/tests/test_flags.py +87 -0
  135. sliceagent-0.1.0/tests/test_fuzzy.py +142 -0
  136. sliceagent-0.1.0/tests/test_ghost_index.py +70 -0
  137. sliceagent-0.1.0/tests/test_guardrails.py +283 -0
  138. sliceagent-0.1.0/tests/test_guidance.py +99 -0
  139. sliceagent-0.1.0/tests/test_history.py +195 -0
  140. sliceagent-0.1.0/tests/test_invariant_fixes.py +155 -0
  141. sliceagent-0.1.0/tests/test_live_composer.py +183 -0
  142. sliceagent-0.1.0/tests/test_llm_streaming.py +320 -0
  143. sliceagent-0.1.0/tests/test_llm_usage_cache.py +281 -0
  144. sliceagent-0.1.0/tests/test_llm_watchdog.py +99 -0
  145. sliceagent-0.1.0/tests/test_log_redaction.py +66 -0
  146. sliceagent-0.1.0/tests/test_loop_overflow.py +313 -0
  147. sliceagent-0.1.0/tests/test_mcp_output_cap.py +98 -0
  148. sliceagent-0.1.0/tests/test_mcp_runtime.py +75 -0
  149. sliceagent-0.1.0/tests/test_memory.py +97 -0
  150. sliceagent-0.1.0/tests/test_memory_persist.py +239 -0
  151. sliceagent-0.1.0/tests/test_metrics.py +85 -0
  152. sliceagent-0.1.0/tests/test_mining.py +68 -0
  153. sliceagent-0.1.0/tests/test_mission_tier.py +80 -0
  154. sliceagent-0.1.0/tests/test_model_catalog.py +110 -0
  155. sliceagent-0.1.0/tests/test_monitor.py +353 -0
  156. sliceagent-0.1.0/tests/test_onboarding.py +284 -0
  157. sliceagent-0.1.0/tests/test_pageout_compaction.py +125 -0
  158. sliceagent-0.1.0/tests/test_permission_patterns.py +78 -0
  159. sliceagent-0.1.0/tests/test_pinned_composer.py +106 -0
  160. sliceagent-0.1.0/tests/test_plan_tier.py +95 -0
  161. sliceagent-0.1.0/tests/test_procman.py +143 -0
  162. sliceagent-0.1.0/tests/test_product_features.py +357 -0
  163. sliceagent-0.1.0/tests/test_progress_status.py +96 -0
  164. sliceagent-0.1.0/tests/test_prompt_ab.py +75 -0
  165. sliceagent-0.1.0/tests/test_provenance.py +151 -0
  166. sliceagent-0.1.0/tests/test_proxy_interrupt.py +77 -0
  167. sliceagent-0.1.0/tests/test_reach.py +273 -0
  168. sliceagent-0.1.0/tests/test_readonly_subagent.py +277 -0
  169. sliceagent-0.1.0/tests/test_recall_search.py +172 -0
  170. sliceagent-0.1.0/tests/test_records.py +80 -0
  171. sliceagent-0.1.0/tests/test_refault.py +95 -0
  172. sliceagent-0.1.0/tests/test_registry_validation.py +69 -0
  173. sliceagent-0.1.0/tests/test_reliability.py +373 -0
  174. sliceagent-0.1.0/tests/test_requirements.py +156 -0
  175. sliceagent-0.1.0/tests/test_review_fixes.py +72 -0
  176. sliceagent-0.1.0/tests/test_route_lexical.py +123 -0
  177. sliceagent-0.1.0/tests/test_safety.py +194 -0
  178. sliceagent-0.1.0/tests/test_seal_markdown.py +139 -0
  179. sliceagent-0.1.0/tests/test_search_index.py +163 -0
  180. sliceagent-0.1.0/tests/test_skill_meta.py +104 -0
  181. sliceagent-0.1.0/tests/test_skill_metadata.py +84 -0
  182. sliceagent-0.1.0/tests/test_subdir_hints.py +149 -0
  183. sliceagent-0.1.0/tests/test_task_agnostic.py +68 -0
  184. sliceagent-0.1.0/tests/test_task_state_roundtrip.py +137 -0
  185. sliceagent-0.1.0/tests/test_telemetry_convergence.py +75 -0
  186. sliceagent-0.1.0/tests/test_terminal.py +108 -0
  187. sliceagent-0.1.0/tests/test_tool_dedup.py +144 -0
  188. sliceagent-0.1.0/tests/test_tool_result_ok.py +117 -0
  189. sliceagent-0.1.0/tests/test_tools_robust.py +221 -0
  190. sliceagent-0.1.0/tests/test_topic_switch.py +199 -0
  191. sliceagent-0.1.0/tests/test_trajectory.py +287 -0
  192. sliceagent-0.1.0/tests/test_tui.py +133 -0
  193. sliceagent-0.1.0/tests/test_tui_menus.py +83 -0
  194. sliceagent-0.1.0/tests/test_tui_render.py +122 -0
  195. sliceagent-0.1.0/tests/test_tui_widgets.py +123 -0
  196. sliceagent-0.1.0/tests/test_turn_budget.py +125 -0
  197. sliceagent-0.1.0/tests/test_verification_agent.py +65 -0
  198. sliceagent-0.1.0/tests/test_web.py +113 -0
  199. sliceagent-0.1.0/tests/test_workspace.py +209 -0
  200. sliceagent-0.1.0/tests/test_world_region.py +113 -0
  201. sliceagent-0.1.0/tests/test_world_state.py +150 -0
@@ -0,0 +1,20 @@
1
+ # keep the build context (and image) lean — only src + packaging are needed to install
2
+ .git
3
+ .venv
4
+ **/__pycache__
5
+ *.pyc
6
+ *.whl
7
+ brain/
8
+ .mindmux/
9
+ scratch/
10
+ runs/
11
+ evals/
12
+ tests/
13
+ docs/
14
+ prototype/
15
+ examples/
16
+ .claude/
17
+ .coverage
18
+ .pytest_cache
19
+ .ruff_cache
20
+ *.pdf
@@ -0,0 +1,21 @@
1
+ # copy to .env and fill in. .env is gitignored.
2
+ # (For persistent settings beyond secrets, prefer sliceagent.toml — see sliceagent.toml.example.
3
+ # Precedence: these env vars override sliceagent.toml, which overrides defaults.)
4
+ LLM_API_KEY=sk-... # REQUIRED — any OpenAI-compatible provider (OpenAI/DeepSeek/Moonshot/…)
5
+ AGENT_MODEL=gpt-5.5 # REQUIRED — model id (no default; pick your provider's model)
6
+ # LLM_BASE_URL=https://api.deepseek.com # provider endpoint; omit for OpenAI
7
+ # AGENT_PROXY=http://127.0.0.1:7890 # optional proxy URL (default: direct connection)
8
+ # SHOW_SLICE=1 # print the slice each turn
9
+ # back-compat: OPENAI_API_KEY / OPENAI_BASE_URL / MOONSHOT_API_KEY are still accepted as fallbacks
10
+
11
+ # --- memory tier (ON by default — memem ships as a dependency; these just relocate the stores) ---
12
+ # SLICEAGENT_VAULT=~/.sliceagent/vault # sliceagent's STATE vault (episodic cache + task-state records)
13
+ # MEMEM_VAULT=~/obsidian-brain # memem's lesson vault (markdown long-term memories)
14
+ # MEMEM_DIR=~/.memem # memem's index/state dir
15
+
16
+ # --- safety / hooks (optional) ---
17
+ # AGENT_POLICY=teenager # teenager (default: auto edits, ask on commands) | baby-sitter (ask on all) | let-it-go (auto) — all block catastrophic
18
+ # AGENT_MINE=deterministic # write side of memory loop: deterministic (default) | llm | off
19
+ # AGENT_SUBAGENT_DEPTH=1 # max delegation depth (0 disables spawn_subagent)
20
+ # AGENT_VERIFY_CMD=python3 -m pytest -q # Oracle: run before "done"; failures force another turn
21
+ # AGENT_MAX_TOKENS=200000 # budget ceiling
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: Bug report
3
+ about: Something doesn't work as expected
4
+ labels: bug
5
+ ---
6
+
7
+ **What happened**
8
+ <!-- The behavior you saw, with the error message / traceback verbatim if any. -->
9
+
10
+ **Expected**
11
+ <!-- What you expected instead. -->
12
+
13
+ **Repro**
14
+ 1.
15
+ 2.
16
+
17
+ **Environment**
18
+ - sliceagent version: <!-- `sliceagent version` -->
19
+ - OS / Python:
20
+ - Model / provider:
21
+ - Install method: <!-- install.sh · uv · pipx · docker · pip -e -->
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea or improvement
4
+ labels: enhancement
5
+ ---
6
+
7
+ **The problem**
8
+ <!-- What are you trying to do that's hard or impossible today? -->
9
+
10
+ **Proposed solution**
11
+ <!-- What you'd like to happen. -->
12
+
13
+ **Moat note (if relevant)**
14
+ <!-- sliceagent's moat is the bounded, reconstructed per-turn slice (no transcript accumulation). If your
15
+ idea touches context/memory, note how it stays moat-safe — see CONTRIBUTING.md / ARCHITECTURE.md. -->
@@ -0,0 +1,16 @@
1
+ <!-- Thanks for contributing to sliceagent! Keep PRs focused and small where possible. -->
2
+
3
+ ## What & why
4
+ <!-- One or two sentences: what does this change and why? Link any issue (#123). -->
5
+
6
+ ## Changes
7
+ -
8
+
9
+ ## Checklist
10
+ - [ ] `bash scripts/run_tests.sh` passes locally
11
+ - [ ] `ruff check src/sliceagent tests evals` is clean
12
+ - [ ] Added/updated a regression test for the change
13
+ - [ ] No edits to verifiers/tests purely to make them pass (reward-hacking)
14
+ - [ ] **Moat respected:** no transcript accumulation / LLM-summarization in the loop; provider quirks stay
15
+ behind the `LLMClient` contract in `llm.py`; changes are task- and provider-agnostic
16
+ (see [CONTRIBUTING.md](../CONTRIBUTING.md))
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
@@ -0,0 +1,44 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ['**'] # every branch (pre-1.0): CI runs on each push, not just main
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ name: ${{ matrix.os }} · py${{ matrix.python }}
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ os: [ubuntu-latest, macos-latest]
16
+ python: ["3.11", "3.12"]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python }}
23
+
24
+ - name: Install ripgrep (powers grep / glob / the code-index tier)
25
+ run: |
26
+ if [ "$RUNNER_OS" = "Linux" ]; then
27
+ sudo apt-get update && sudo apt-get install -y ripgrep
28
+ else
29
+ brew install ripgrep
30
+ fi
31
+
32
+ - name: Install sliceagent + dev/tui extras
33
+ run: |
34
+ python -m pip install --upgrade pip
35
+ pip install -e ".[dev,tui]"
36
+
37
+ - name: Smoke — the installed console script runs
38
+ run: sliceagent version
39
+
40
+ - name: Lint (ruff)
41
+ run: ruff check src/sliceagent tests
42
+
43
+ - name: Tests
44
+ run: bash scripts/run_tests.sh
@@ -0,0 +1,36 @@
1
+ name: publish
2
+
3
+ # Publish to PyPI via trusted publishing (OIDC — no tokens).
4
+ # Triggers: a published GitHub release, or a manual dispatch from the Actions tab.
5
+ on:
6
+ release:
7
+ types: [published]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+ - run: python -m pip install build
19
+ - run: python -m build
20
+ - uses: actions/upload-artifact@v4
21
+ with:
22
+ name: dist
23
+ path: dist/
24
+
25
+ publish:
26
+ needs: build
27
+ runs-on: ubuntu-latest
28
+ environment: pypi
29
+ permissions:
30
+ id-token: write # OIDC token for PyPI trusted publishing
31
+ steps:
32
+ - uses: actions/download-artifact@v4
33
+ with:
34
+ name: dist
35
+ path: dist/
36
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,58 @@
1
+ # secrets
2
+ .env
3
+ .env.*
4
+ !.env.example
5
+
6
+ # node (prototype)
7
+ node_modules/
8
+ prototype/node_modules/
9
+
10
+ # python (core)
11
+ __pycache__/
12
+ *.pyc
13
+ .venv/
14
+ venv/
15
+ *.egg-info/
16
+ .pytest_cache/
17
+ *.whl
18
+ /dist/
19
+ /build/
20
+
21
+ # agent scratch / runtime
22
+ scratch/
23
+ *.jsonl
24
+ .DS_Store
25
+
26
+ # prompt A/B generated artifacts (variant .txt are regenerated from slice.py by variants.build_all)
27
+ evals/prompt_ab/variants/
28
+ evals/prompt_ab/runs/
29
+
30
+ # local memagent state / monitor runtime (personal; not part of the repo)
31
+ .memagent/
32
+ monitor/
33
+ brain/
34
+ .mindmux/
35
+
36
+ # local tooling artifacts (not part of the repo).
37
+ # NOTE: gitignore has no inline comments — keep each pattern on its own line.
38
+ # .claude/ = local session dir · .coverage = coverage.py data · runs/ = eval outputs ·
39
+ # *.pdf = decks/local docs (force-add if a real doc PDF is ever needed).
40
+ .claude/
41
+ .coverage
42
+ runs/
43
+ *.pdf
44
+
45
+ # ── internal-only: untracked 2026-07-02 for the public launch (files stay on disk locally) ──
46
+ # evals/ = internal benchmark harness + ~127 MB of captured tbench/job run artifacts (deb/lz4/pt/logs)
47
+ # prototype/ = superseded ~250-line JS proof-of-concept (its own README: "not the production codebase")
48
+ # docs/STEP3-PLAN.md, docs/MEMEM-DIAGNOSIS.md = internal R&D planning notes, not user docs
49
+ evals/
50
+ prototype/
51
+ docs/STEP3-PLAN.md
52
+ docs/MEMEM-DIAGNOSIS.md
53
+
54
+ # internal engineering roadmap (wave planning), not product docs — untracked 2026-07-02
55
+ ROADMAP.md
56
+
57
+ # all of docs/ is internal (architecture/spec/brand assets) — not published; untracked 2026-07-02
58
+ docs/
@@ -0,0 +1,65 @@
1
+ # Changelog
2
+
3
+ All notable changes to sliceagent. Format follows [Keep a Changelog](https://keepachangelog.com/);
4
+ this project aims for [Semantic Versioning](https://semver.org/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.1.0] — 2026-07-02
9
+
10
+ First public release.
11
+
12
+ ### Added
13
+ - **`sliceagent init`** — guided first-run setup (provider, API key, model); tests the key and writes
14
+ `~/.sliceagent/config.toml` (0600). Config-persisted keys mean the next run needs no env vars.
15
+ - **`sliceagent config` / `config --list` / `config --path`** — discover every setting, its default, and
16
+ current value. New central env-var registry (`envspec.py`) is the single source of truth.
17
+ - **`sliceagent help` / `version`** subcommands.
18
+ - **Startup config validation** — a typo'd enum (e.g. `AGENT_POLICY`) now warns instead of silently
19
+ defaulting.
20
+ - **Always-pinned live UI** (`AGENT_TUI=live`) — a bordered input box stays at the bottom while output
21
+ streams above it, in the normal buffer (native copy/paste).
22
+ - **Lexical topic router** (default) — routing no longer costs an LLM round-trip per follow-up;
23
+ `AGENT_ROUTER=llm` restores the classifier. Measured identical to the LLM router on continue/resume.
24
+ - **Per-tool wall-clock timeout** (`AGENT_TOOL_TIMEOUT`, opt-in) — a stuck tool no longer hangs the turn.
25
+ - Docs: `QUICKSTART.md`, `CONTRIBUTING.md`.
26
+ - **One-command install** — `install.sh` (bootstraps `uv` → isolated tool install), a `Dockerfile`, and a
27
+ README `## Install` (uv / pipx / docker). MIT `LICENSE` declared in metadata; `NOTICE` records
28
+ third-party attributions; `SECURITY.md` documents the threat model + a disclosure path.
29
+ - **Three permission modes** — `baby-sitter` / `teenager` (default) / `let-it-go`, all sharing a
30
+ catastrophic-command floor; `/mode` + `/model` two-tier selector menus; **Esc = undo**.
31
+ - **MCP spawn-security screen** (`mcp_security.py`) — refuses a shell-interpreter MCP entry that does network
32
+ egress or writes OS-persistence surfaces, before it is spawned.
33
+ - **`read_file` window** — `offset`/`limit` + a default view cap + a `<system>` footer (a large file no
34
+ longer floods the slice); a `glob` file-finder; `grep` `output_mode`/`--type`/context; `str_replace`
35
+ `replace_all`; model pricing single-sourced in `model_catalog`; `with_retry` honors `Retry-After`.
36
+ - **"$ saved" cost meter** — shows dollars saved vs a full-transcript agent, re-priced live on `/model`.
37
+ - **CI** (`.github/workflows/ci.yml`, ubuntu+macOS × py3.11/3.12: install + lint + tests),
38
+ `scripts/run_tests.sh`, a `ruff` config + `[dev]` extra, single-sourced version, and contribution
39
+ scaffolding (`CODE_OF_CONDUCT.md`, issue/PR templates).
40
+
41
+ ### Removed
42
+ - The full-screen Textual UI (`AGENT_TUI=textual`) and its `textual` dependency. The inline `rich` REPL is
43
+ the proven default (native copy/paste/scrollback on any terminal); `AGENT_TUI=live` remains for the
44
+ always-pinned composer, `off` for plain stdout.
45
+
46
+ ### Changed
47
+ - Default UI is the inline `rich` REPL (native copy/paste on any terminal). The composer is a bordered,
48
+ bottom-pinned box.
49
+ - Permission confirms are arrow-key selectable (Yes / No / Always) instead of typed.
50
+ - The user's message is echoed the instant Enter is pressed — before any routing/LLM work (no input lag).
51
+ - `AGENT_PROXY=off` now forces a direct connection (previously misread as a proxy URL); the network route
52
+ is shown on startup (`net=…`).
53
+ - Read/list tool cards show the action header only (no content dump); commands and failures show output.
54
+
55
+ ### Reliability
56
+ - Hook callbacks are guarded: advisory hooks (budget/oracle/plugin) degrade gracefully on error; the
57
+ permission hook fails **closed** (denies) on error.
58
+ - Streaming assembly survives a malformed chunk (skipped) and a mid-stream drop (salvages the partial, or
59
+ re-rolls via retry when nothing was assembled).
60
+ - Session teardown is guarded and bounded — a stuck MCP server / index write can't freeze exit.
61
+
62
+ ### Core
63
+ - Initial Python core: the slice/cache-not-log loop, typed memory tiers, reconstruction seam,
64
+ event-sink host. Tools, skills, subagents, MCP, plugins, sandbox, permission policy,
65
+ session/topic resume, durable cross-session memory (memem).
@@ -0,0 +1,12 @@
1
+ # Code of Conduct
2
+
3
+ This project follows the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/)
4
+ (v2.1). In short: be respectful, assume good faith, and keep discussion constructive and on-topic.
5
+
6
+ Harassment, discrimination, personal attacks, and other unacceptable behavior are not tolerated.
7
+
8
+ **Reporting:** to report a concern, email **tongtao.wang@gmail.com**. Reports are handled confidentially.
9
+ Maintainers may remove, edit, or reject contributions and comments that violate this Code of Conduct, and
10
+ may ban (temporarily or permanently) any contributor for behavior they deem inappropriate.
11
+
12
+ The full text and enforcement guidelines are at the Contributor Covenant link above.
@@ -0,0 +1,56 @@
1
+ # Contributing
2
+
3
+ ## Dev setup
4
+
5
+ ```bash
6
+ uv sync # or: pip install -e ".[dev,tui,treesitter]" # [dev] = pytest + ruff
7
+ ```
8
+
9
+ Python ≥ 3.11. The core is `openai`-free — only `llm.py`/`cli.py` import the SDK — so the whole loop is
10
+ testable offline with a fake LLM.
11
+
12
+ ## Running the tests
13
+
14
+ sliceagent uses a **dependency-free custom test runner** (no pytest): each `tests/test_*.py` is a standalone
15
+ script with a tiny `@check` harness that exits non-zero on failure. Run the whole offline suite:
16
+
17
+ ```bash
18
+ bash scripts/run_tests.sh # runs every tests/test_*.py, tallies, exits non-zero on any failure
19
+ ruff check src/sliceagent tests evals # lint (real-bug rules; house style configured in pyproject)
20
+ ```
21
+
22
+ or a single file:
23
+
24
+ ```bash
25
+ PYTHONPATH=src .venv/bin/python tests/test_reliability.py
26
+ ```
27
+
28
+ The offline suite must stay green on every change. **No live API calls in the offline suite** — stub the
29
+ LLM (see `tests/test_reliability.py` / `tests/test_live_composer.py` for the patterns: fake `complete()`,
30
+ pipe-driven prompt_toolkit apps, recording Rich consoles). Eval tooling that needs a key lives in `evals/`
31
+ and is run manually.
32
+
33
+ ### Testing interactive UI offline
34
+ Drive prompt_toolkit Applications with a pipe input + `DummyOutput`, and Rich sinks with a
35
+ `Console(file=StringIO())` — see `tests/test_live_composer.py`. This catches layout/keybinding/logic
36
+ regressions without a tty.
37
+
38
+ ## Architecture in one breath
39
+
40
+ The loop (`loop.py`) is the moat: one `while(true)` per turn over a **bounded slice** that is the SEED
41
+ (built once by `make_build_slice`), then working memory **accumulates** as native messages within the turn
42
+ and is sealed to the durable cache at the turn boundary. The core depends only on contracts
43
+ (`interfaces.py`): `LLMClient`, `ToolHost`, `Retriever`, `Oracle`, plus an event `dispatch` and `hooks`. It
44
+ never imports implementations.
45
+
46
+ **Layering rule:** `loop.py`/`pfc.py`/`seed.py` are the moat — keep them stateless and contract-only. UI
47
+ (`tui.py`, `cli.py`), tools, providers, and extensions are periphery: use well-known building blocks and
48
+ keep them behind seams (event sinks, the tool registry, the `LLMClient`/`Memory` interfaces).
49
+
50
+ ## Conventions
51
+
52
+ - Match the surrounding code's comment density and idiom. Comments explain *why*, not *what*.
53
+ - Every behavior change ships a test in the same PR.
54
+ - Keep the agent **task-agnostic** and **LLM/provider-agnostic**: no task-type-specific heuristics in the
55
+ core; provider quirks stay isolated in `llm.py`.
56
+ - New environment variables go in `envspec.py` (a coverage test enforces this).
@@ -0,0 +1,21 @@
1
+ # sliceagent — runnable container image.
2
+ # docker build -t sliceagent .
3
+ # docker run -it -e LLM_API_KEY=$LLM_API_KEY -v "$PWD:/work" -w /work sliceagent
4
+ # The agent edits files in the mounted workspace (/work); pass your key via -e (never bake it in).
5
+ FROM python:3.12-slim
6
+
7
+ # git: memem is a git dependency · ripgrep: powers the code-index / search tier
8
+ RUN apt-get update \
9
+ && apt-get install -y --no-install-recommends git ripgrep ca-certificates \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ WORKDIR /app
13
+ COPY . /app
14
+ RUN pip install --no-cache-dir ".[tui]"
15
+
16
+ # Drop privileges; the workspace is bind-mounted at runtime.
17
+ RUN useradd -m agent
18
+ USER agent
19
+ WORKDIR /work
20
+
21
+ ENTRYPOINT ["sliceagent"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TT-Wang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,61 @@
1
+ sliceagent
2
+ Copyright (c) 2026 TT-Wang
3
+ Licensed under the MIT License — see LICENSE.
4
+
5
+ This product includes code ported from, and architecture reimplemented after, the
6
+ open-source projects below. We are grateful to their authors.
7
+
8
+ ────────────────────────────────────────────────────────────────────────────
9
+ Hermes — https://github.com/NousResearch/hermes (MIT License)
10
+ Copyright (c) 2025 Nous Research
11
+
12
+ Verbatim / closely-ported source:
13
+ src/sliceagent/binsniff.py ← tools/binary_extensions.py
14
+ src/sliceagent/fuzzy.py ← fuzzy_match.py (_calculate_line_positions)
15
+ src/sliceagent/context_overflow.py ← overflow-pattern matcher
16
+ src/sliceagent/mcp_security.py ← hermes_cli/mcp_security.py
17
+ Pattern / structure adapted:
18
+ src/sliceagent/errors.py (classify + retry/backoff), src/sliceagent/sandbox.py
19
+ (execution backend), src/sliceagent/subdir_hints.py, and the execute_code
20
+ (code-as-action) pattern.
21
+
22
+ The MIT License text for Hermes is reproduced under THIRD-PARTY-LICENSES below
23
+ (its notice clause requires carrying the copyright + permission notice).
24
+
25
+ ────────────────────────────────────────────────────────────────────────────
26
+ Kimi-Code — https://github.com/MoonshotAI/kimi-code (Moonshot AI)
27
+
28
+ ARCHITECTURE AND PATTERNS reimplemented in Python (no source copied — ideas,
29
+ not code):
30
+ access.py + scheduler.py (resource-access model for safe tool parallelism),
31
+ policy.py (permission chain), config.py (layered config), clock.py, cron.py,
32
+ flags.py, model_catalog.py, mcp_client.py (the mcp__server__tool namespacing),
33
+ loop.py (micro-compaction), tui.py (selector menus + footer/streaming),
34
+ code_grep.py (ripgrep pagination), agents.py (named-agent registry).
35
+ See the upstream repository for its license terms.
36
+
37
+ ────────────────────────────────────────────────────────────────────────────
38
+ Also gratefully acknowledged for ideas and conventions: Aider, OpenHands.
39
+
40
+ ════════════════════════════ THIRD-PARTY-LICENSES ═══════════════════════════
41
+
42
+ Hermes — MIT License
43
+ Copyright (c) 2025 Nous Research
44
+
45
+ Permission is hereby granted, free of charge, to any person obtaining a copy
46
+ of this software and associated documentation files (the "Software"), to deal
47
+ in the Software without restriction, including without limitation the rights
48
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
49
+ copies of the Software, and to permit persons to whom the Software is
50
+ furnished to do so, subject to the following conditions:
51
+
52
+ The above copyright notice and this permission notice shall be included in all
53
+ copies or substantial portions of the Software.
54
+
55
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
58
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
59
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
60
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
61
+ SOFTWARE.