turnloop 0.1.6__tar.gz → 0.1.7__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 (160) hide show
  1. {turnloop-0.1.6 → turnloop-0.1.7}/PKG-INFO +40 -7
  2. {turnloop-0.1.6 → turnloop-0.1.7}/README.md +39 -6
  3. {turnloop-0.1.6 → turnloop-0.1.7}/pyproject.toml +1 -1
  4. turnloop-0.1.7/tests/test_skills_install.py +334 -0
  5. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_tui.py +30 -0
  6. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/__init__.py +1 -1
  7. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/cli.py +215 -0
  8. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/config.py +29 -0
  9. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/configio.py +16 -1
  10. turnloop-0.1.7/turnloop/skills_install.py +284 -0
  11. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/app.py +32 -0
  12. {turnloop-0.1.6 → turnloop-0.1.7}/.github/workflows/ci.yml +0 -0
  13. {turnloop-0.1.6 → turnloop-0.1.7}/.gitignore +0 -0
  14. {turnloop-0.1.6 → turnloop-0.1.7}/.turnloop/.gitignore +0 -0
  15. {turnloop-0.1.6 → turnloop-0.1.7}/.turnloop/settings.local.json +0 -0
  16. {turnloop-0.1.6 → turnloop-0.1.7}/tests/conftest.py +0 -0
  17. {turnloop-0.1.6 → turnloop-0.1.7}/tests/fixtures/anthropic_tool_call.sse +0 -0
  18. {turnloop-0.1.6 → turnloop-0.1.7}/tests/fixtures/glm_tool_call.sse +0 -0
  19. {turnloop-0.1.6 → turnloop-0.1.7}/tests/fixtures/mcp_echo_server.py +0 -0
  20. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_bash.py +0 -0
  21. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_compaction.py +0 -0
  22. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_config.py +0 -0
  23. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_config_screen.py +0 -0
  24. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_configio.py +0 -0
  25. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_experiments.py +0 -0
  26. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_hooks_mcp_commands.py +0 -0
  27. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_loop.py +0 -0
  28. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_permissions.py +0 -0
  29. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_providers.py +0 -0
  30. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_system_prompt_layout.py +0 -0
  31. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_tools_files.py +0 -0
  32. {turnloop-0.1.6 → turnloop-0.1.7}/tests/test_websearch.py +0 -0
  33. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/__main__.py +0 -0
  34. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/agent/__init__.py +0 -0
  35. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/agent/factory.py +0 -0
  36. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/agent/headless.py +0 -0
  37. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/agent/loop.py +0 -0
  38. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/agent/subagent.py +0 -0
  39. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/agent/system_prompt.py +0 -0
  40. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/commands/__init__.py +0 -0
  41. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/commands/dispatch.py +0 -0
  42. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/commands/loader.py +0 -0
  43. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/context/__init__.py +0 -0
  44. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/context/budget.py +0 -0
  45. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/context/compaction.py +0 -0
  46. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/context/memory.py +0 -0
  47. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/core/__init__.py +0 -0
  48. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/core/events.py +0 -0
  49. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/core/ids.py +0 -0
  50. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/core/messages.py +0 -0
  51. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/core/tokens.py +0 -0
  52. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/diagnostics.py +0 -0
  53. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/errors.py +0 -0
  54. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/__init__.py +0 -0
  55. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/bakeoff.yaml +0 -0
  56. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/ceiling-check.yaml +0 -0
  57. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/context-glm.yaml +0 -0
  58. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/context.yaml +0 -0
  59. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/glm-selfhosted.yaml +0 -0
  60. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/groq-free.yaml +0 -0
  61. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/hard-calibration.yaml +0 -0
  62. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/hard-glm.yaml +0 -0
  63. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/loop.yaml +0 -0
  64. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/nvidia-smoke.yaml +0 -0
  65. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/reliability.yaml +0 -0
  66. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/rewrite-calibration.yaml +0 -0
  67. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/configs/smoke.yaml +0 -0
  68. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/graders.py +0 -0
  69. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/report.py +0 -0
  70. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/runner.py +0 -0
  71. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/default.yaml +0 -0
  72. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/bulky/module_1.py +0 -0
  73. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/bulky/module_2.py +0 -0
  74. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/bulky/module_3.py +0 -0
  75. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/bulky/module_4.py +0 -0
  76. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/bulky/module_5.py +0 -0
  77. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/bulky/module_6.py +0 -0
  78. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/bulky/module_7.py +0 -0
  79. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/bulky/module_8.py +0 -0
  80. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/circular_import/models.py +0 -0
  81. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/circular_import/services.py +0 -0
  82. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/circular_import/test_cancel.py +0 -0
  83. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/cli_flag/app.py +0 -0
  84. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/cross_file_contract/decode.py +0 -0
  85. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/cross_file_contract/encode.py +0 -0
  86. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/cross_file_contract/test_roundtrip.py +0 -0
  87. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/cross_file_contract/test_wire_format.py +0 -0
  88. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/empty/.keep +0 -0
  89. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/failing_test/calc.py +0 -0
  90. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/failing_test/test_calc.py +0 -0
  91. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/generate_bulky.py +0 -0
  92. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/grep_edit/ingest.py +0 -0
  93. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/grep_edit/load.py +0 -0
  94. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/grep_edit/transform.py +0 -0
  95. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/misleading_traceback/checkout.py +0 -0
  96. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/misleading_traceback/invoice.py +0 -0
  97. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/misleading_traceback/pricing.py +0 -0
  98. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/misleading_traceback/test_checkout.py +0 -0
  99. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/misleading_traceback/test_invoice.py +0 -0
  100. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/needle/inventory.py +0 -0
  101. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/needle/pricing.py +0 -0
  102. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/needle/shipping.py +0 -0
  103. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/regression_trap/test_validators.py +0 -0
  104. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/regression_trap/validators.py +0 -0
  105. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/rename/billing.py +0 -0
  106. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/rename/report.py +0 -0
  107. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/rename/test_billing.py +0 -0
  108. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/spec/parser.py +0 -0
  109. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/spec/test_parser.py +0 -0
  110. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/subtle_spec_edge/leaderboard.py +0 -0
  111. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/subtle_spec_edge/test_leaderboard.py +0 -0
  112. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/experiments/suite/fixtures/util/util.py +0 -0
  113. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/hooks/__init__.py +0 -0
  114. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/hooks/runner.py +0 -0
  115. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/mcp/__init__.py +0 -0
  116. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/mcp/adapter.py +0 -0
  117. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/mcp/client.py +0 -0
  118. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/permissions/__init__.py +0 -0
  119. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/permissions/engine.py +0 -0
  120. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/permissions/rules.py +0 -0
  121. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/providers/__init__.py +0 -0
  122. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/providers/anthropic.py +0 -0
  123. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/providers/base.py +0 -0
  124. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/providers/gemini.py +0 -0
  125. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/providers/mock.py +0 -0
  126. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/providers/openai_compat.py +0 -0
  127. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/providers/pricing.py +0 -0
  128. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/providers/registry.py +0 -0
  129. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/providers/sse.py +0 -0
  130. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/sessions/__init__.py +0 -0
  131. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/sessions/models.py +0 -0
  132. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/sessions/store.py +0 -0
  133. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/__init__.py +0 -0
  134. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/ask.py +0 -0
  135. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/base.py +0 -0
  136. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/bash.py +0 -0
  137. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/builtin.py +0 -0
  138. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/edit.py +0 -0
  139. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/glob.py +0 -0
  140. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/grep.py +0 -0
  141. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/read.py +0 -0
  142. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/runner.py +0 -0
  143. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/shell.py +0 -0
  144. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/skill.py +0 -0
  145. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/task.py +0 -0
  146. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/textio.py +0 -0
  147. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/todo.py +0 -0
  148. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/webfetch.py +0 -0
  149. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/websearch.py +0 -0
  150. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tools/write.py +0 -0
  151. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/__init__.py +0 -0
  152. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/app.tcss +0 -0
  153. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/bridge.py +0 -0
  154. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/config_screen.py +0 -0
  155. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/mcp_screen.py +0 -0
  156. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/session_screen.py +0 -0
  157. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/widgets/__init__.py +0 -0
  158. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/widgets/permission.py +0 -0
  159. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/widgets/status.py +0 -0
  160. {turnloop-0.1.6 → turnloop-0.1.7}/turnloop/tui/widgets/transcript.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: turnloop
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: A local-first agentic coding harness: streaming tool loop, permission gating, context compaction, subagents, and any LLM provider.
5
5
  Project-URL: Homepage, https://github.com/Pranesh-2005/turnloop
6
6
  Author: Pranesh
@@ -49,7 +49,7 @@ tl experiment run smoke # a measurement run, offline and free
49
49
 
50
50
  Four runtime dependencies: `textual`, `pydantic`, `httpx`, `pyyaml`. No vendor
51
51
  SDKs, no agent framework — the loop is the point, so the loop is written here.
52
- ~20,000 lines of Python, 318 tests, no network in the default test run.
52
+ ~20,000 lines of Python, 338 tests, no network in the default test run.
53
53
 
54
54
  ---
55
55
 
@@ -117,7 +117,7 @@ point.
117
117
  Verify:
118
118
 
119
119
  ```bash
120
- tl --version # turnloop 0.1.6
120
+ tl --version # turnloop 0.1.7
121
121
  tl doctor # every provider, key presence, shell, context budget
122
122
  ```
123
123
 
@@ -1023,7 +1023,7 @@ one-line edit in a CRLF checkout does not produce a whole-file diff.
1023
1023
  ## Testing
1024
1024
 
1025
1025
  ```bash
1026
- pytest # 318 tests, no network
1026
+ pytest # 338 tests, no network
1027
1027
  ruff check turnloop
1028
1028
  mypy turnloop
1029
1029
  ```
@@ -1035,8 +1035,9 @@ mypy turnloop
1035
1035
  | `test_providers.py` | 35 | adapters vs recorded `.sse`, image blocks, thought signatures |
1036
1036
  | `test_tools_files.py` | 28 | Read/Write/Edit/Glob/Grep, encodings, newlines, image detection |
1037
1037
  | `test_hooks_mcp_commands.py` | 28 | lifecycle hooks, MCP client, slash commands |
1038
- | `test_tui.py` | 24 | Textual snapshots, `/config` and `/mcp add` driven through a real app |
1038
+ | `test_tui.py` | 25 | Textual snapshots, `/config` and `/mcp add` driven through a real app |
1039
1039
  | `test_config.py` | 23 | layering, env overrides, presets, narrow-console guard |
1040
+ | `test_skills_install.py` | 19 | frontmatter validation, GitHub resolution, import subsets, drive-root refusal |
1040
1041
  | `test_loop.py` | 23 | streaming, truncation, iteration cap |
1041
1042
  | `test_compaction.py` | 16 | three tiers, tool_use/tool_result invariant |
1042
1043
  | `test_configio.py` | 15 | minimal-diff writes, atomic save, secret-bearing MCP targets, the settings deny rules |
@@ -1107,8 +1108,9 @@ just because it is on disk.
1107
1108
  ### Editing configuration
1108
1109
 
1109
1110
  `tl config --edit` edits the provider table, permission mode, tool verbosity, iteration
1110
- cap, search backend, memory, and the three rule lists. `tl mcp` manages MCP servers. The
1111
- same screens open inside a running session as `/config` and `/mcp add`.
1111
+ cap, search backend, memory, and the three rule lists. `tl mcp` manages MCP servers.
1112
+ `tl skills add/list/remove` manages skills. The config and MCP screens open inside a
1113
+ running session as `/config` and `/mcp add`.
1112
1114
 
1113
1115
  **Adding a provider** is a form for `kind`, `model`, `base_url`, and `api_key_env`, with
1114
1116
  a live ✓/✗ showing whether that environment variable is currently set. Capabilities are
@@ -1185,6 +1187,37 @@ unavailable" and never blocks the loop. Connections are lazy and every call is b
1185
1187
  None of that helps if you install a server that does exactly what it says. Read what you
1186
1188
  add.
1187
1189
 
1190
+ ### Skills are a trust decision too
1191
+
1192
+ `tl skills add <owner/repo>` resolves a GitHub repo shorthand, a repo URL, or a direct
1193
+ raw URL to a `SKILL.md`, and installs it to `.turnloop/skills/<name>/` (or
1194
+ `~/.turnloop/skills/` with `--user`). The same reasoning as the MCP section above
1195
+ applies without modification: a skill's body is not metadata, it is text that gets
1196
+ loaded straight into the model's context the moment the model decides the skill
1197
+ applies (`commands/loader.py`). A hostile `SKILL.md` can instruct the model exactly
1198
+ like a hostile MCP tool description can. `add` prints the source URL and the
1199
+ description and asks for confirmation before writing anything; `--yes` skips waiting
1200
+ for that confirmation but never skips printing it, and never skips printing what got
1201
+ installed and from where.
1202
+
1203
+ Before writing, `add` parses the frontmatter with the same `parse_frontmatter` the
1204
+ loader uses and requires a non-empty `description` — the exact rule `load_skills`
1205
+ enforces when deciding what to advertise (see "A skill that failed to parse vanished
1206
+ with no error" below). A `SKILL.md` that would silently vanish once installed is
1207
+ refused before it is ever written, rather than discovered later as "the skill isn't
1208
+ there."
1209
+
1210
+ **Importing from Claude Code.** If `~/.claude/skills/*/SKILL.md` exist and turnloop
1211
+ has never asked about them, one line appears once, in the TUI, pointing at
1212
+ `tl skills import` — not a prompt that blocks startup, and not a silent copy.
1213
+ Importing computes the token cost of each candidate with `rough_tokens` before you
1214
+ choose (34 skills advertise for about 2,961 tokens of permanent system-prompt
1215
+ overhead — most of a session's `CONFIG_LAYOUT` segment on its own), lets you import
1216
+ any subset, and copies the chosen files into turnloop's own skills directory rather
1217
+ than reading `~/.claude/skills` at runtime — turnloop stays uncoupled from another
1218
+ tool's directory layout. Whether you say yes or no, the question is recorded in the
1219
+ user-level settings file so it is never asked again.
1220
+
1188
1221
  ---
1189
1222
 
1190
1223
  ## Limitations
@@ -20,7 +20,7 @@ tl experiment run smoke # a measurement run, offline and free
20
20
 
21
21
  Four runtime dependencies: `textual`, `pydantic`, `httpx`, `pyyaml`. No vendor
22
22
  SDKs, no agent framework — the loop is the point, so the loop is written here.
23
- ~20,000 lines of Python, 318 tests, no network in the default test run.
23
+ ~20,000 lines of Python, 338 tests, no network in the default test run.
24
24
 
25
25
  ---
26
26
 
@@ -88,7 +88,7 @@ point.
88
88
  Verify:
89
89
 
90
90
  ```bash
91
- tl --version # turnloop 0.1.6
91
+ tl --version # turnloop 0.1.7
92
92
  tl doctor # every provider, key presence, shell, context budget
93
93
  ```
94
94
 
@@ -994,7 +994,7 @@ one-line edit in a CRLF checkout does not produce a whole-file diff.
994
994
  ## Testing
995
995
 
996
996
  ```bash
997
- pytest # 318 tests, no network
997
+ pytest # 338 tests, no network
998
998
  ruff check turnloop
999
999
  mypy turnloop
1000
1000
  ```
@@ -1006,8 +1006,9 @@ mypy turnloop
1006
1006
  | `test_providers.py` | 35 | adapters vs recorded `.sse`, image blocks, thought signatures |
1007
1007
  | `test_tools_files.py` | 28 | Read/Write/Edit/Glob/Grep, encodings, newlines, image detection |
1008
1008
  | `test_hooks_mcp_commands.py` | 28 | lifecycle hooks, MCP client, slash commands |
1009
- | `test_tui.py` | 24 | Textual snapshots, `/config` and `/mcp add` driven through a real app |
1009
+ | `test_tui.py` | 25 | Textual snapshots, `/config` and `/mcp add` driven through a real app |
1010
1010
  | `test_config.py` | 23 | layering, env overrides, presets, narrow-console guard |
1011
+ | `test_skills_install.py` | 19 | frontmatter validation, GitHub resolution, import subsets, drive-root refusal |
1011
1012
  | `test_loop.py` | 23 | streaming, truncation, iteration cap |
1012
1013
  | `test_compaction.py` | 16 | three tiers, tool_use/tool_result invariant |
1013
1014
  | `test_configio.py` | 15 | minimal-diff writes, atomic save, secret-bearing MCP targets, the settings deny rules |
@@ -1078,8 +1079,9 @@ just because it is on disk.
1078
1079
  ### Editing configuration
1079
1080
 
1080
1081
  `tl config --edit` edits the provider table, permission mode, tool verbosity, iteration
1081
- cap, search backend, memory, and the three rule lists. `tl mcp` manages MCP servers. The
1082
- same screens open inside a running session as `/config` and `/mcp add`.
1082
+ cap, search backend, memory, and the three rule lists. `tl mcp` manages MCP servers.
1083
+ `tl skills add/list/remove` manages skills. The config and MCP screens open inside a
1084
+ running session as `/config` and `/mcp add`.
1083
1085
 
1084
1086
  **Adding a provider** is a form for `kind`, `model`, `base_url`, and `api_key_env`, with
1085
1087
  a live ✓/✗ showing whether that environment variable is currently set. Capabilities are
@@ -1156,6 +1158,37 @@ unavailable" and never blocks the loop. Connections are lazy and every call is b
1156
1158
  None of that helps if you install a server that does exactly what it says. Read what you
1157
1159
  add.
1158
1160
 
1161
+ ### Skills are a trust decision too
1162
+
1163
+ `tl skills add <owner/repo>` resolves a GitHub repo shorthand, a repo URL, or a direct
1164
+ raw URL to a `SKILL.md`, and installs it to `.turnloop/skills/<name>/` (or
1165
+ `~/.turnloop/skills/` with `--user`). The same reasoning as the MCP section above
1166
+ applies without modification: a skill's body is not metadata, it is text that gets
1167
+ loaded straight into the model's context the moment the model decides the skill
1168
+ applies (`commands/loader.py`). A hostile `SKILL.md` can instruct the model exactly
1169
+ like a hostile MCP tool description can. `add` prints the source URL and the
1170
+ description and asks for confirmation before writing anything; `--yes` skips waiting
1171
+ for that confirmation but never skips printing it, and never skips printing what got
1172
+ installed and from where.
1173
+
1174
+ Before writing, `add` parses the frontmatter with the same `parse_frontmatter` the
1175
+ loader uses and requires a non-empty `description` — the exact rule `load_skills`
1176
+ enforces when deciding what to advertise (see "A skill that failed to parse vanished
1177
+ with no error" below). A `SKILL.md` that would silently vanish once installed is
1178
+ refused before it is ever written, rather than discovered later as "the skill isn't
1179
+ there."
1180
+
1181
+ **Importing from Claude Code.** If `~/.claude/skills/*/SKILL.md` exist and turnloop
1182
+ has never asked about them, one line appears once, in the TUI, pointing at
1183
+ `tl skills import` — not a prompt that blocks startup, and not a silent copy.
1184
+ Importing computes the token cost of each candidate with `rough_tokens` before you
1185
+ choose (34 skills advertise for about 2,961 tokens of permanent system-prompt
1186
+ overhead — most of a session's `CONFIG_LAYOUT` segment on its own), lets you import
1187
+ any subset, and copies the chosen files into turnloop's own skills directory rather
1188
+ than reading `~/.claude/skills` at runtime — turnloop stays uncoupled from another
1189
+ tool's directory layout. Whether you say yes or no, the question is recorded in the
1190
+ user-level settings file so it is never asked again.
1191
+
1159
1192
  ---
1160
1193
 
1161
1194
  ## Limitations
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "turnloop"
7
- version = "0.1.6"
7
+ version = "0.1.7"
8
8
  description = "A local-first agentic coding harness: streaming tool loop, permission gating, context compaction, subagents, and any LLM provider."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -0,0 +1,334 @@
1
+ """`tl skills add`/`list`/`remove`, and the one-time import from Claude Code.
2
+
3
+ Network is off at the transport layer (see conftest.py's `no_network`), so every
4
+ fetch here goes through an `httpx.MockTransport` handed to the client explicitly —
5
+ that bypasses the patched `AsyncHTTPTransport`/`HTTPTransport` classes entirely,
6
+ the same technique httpx's own docs recommend for offline tests.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import json
12
+ from pathlib import Path
13
+
14
+ import httpx
15
+ import pytest
16
+
17
+ from turnloop.commands.loader import load_skills
18
+ from turnloop.config import default_settings, load_settings
19
+ from turnloop.errors import ConfigError
20
+ from turnloop.skills_install import (
21
+ SkillInstallError,
22
+ fetch_skill_sources,
23
+ find_claude_code_candidates,
24
+ import_selected,
25
+ install_skill,
26
+ mark_import_asked,
27
+ remove_skill,
28
+ validate_skill_content,
29
+ )
30
+
31
+ VALID_SKILL = """---
32
+ name: demo
33
+ description: does the demo thing
34
+ ---
35
+ Body of the demo skill.
36
+ """
37
+
38
+ NO_DESCRIPTION_SKILL = """---
39
+ name: demo
40
+ ---
41
+ Body with no description.
42
+ """
43
+
44
+ # The exact failure mode from the README's "bugs worth reading about" section:
45
+ # a markdown-bold header instead of YAML frontmatter parses to no keys at all.
46
+ PSEUDO_FRONTMATTER_SKILL = """**name**: demo
47
+ **description**: looks like frontmatter but isn't
48
+
49
+ Body.
50
+ """
51
+
52
+
53
+ def mock_client(handler) -> httpx.AsyncClient:
54
+ return httpx.AsyncClient(transport=httpx.MockTransport(handler))
55
+
56
+
57
+ # --------------------------------------------------------------------------
58
+ # validation refuses before any write
59
+ # --------------------------------------------------------------------------
60
+
61
+
62
+ def test_validate_rejects_a_skill_with_no_description():
63
+ with pytest.raises(SkillInstallError, match="description"):
64
+ validate_skill_content(NO_DESCRIPTION_SKILL, "demo")
65
+
66
+
67
+ def test_validate_rejects_markdown_bold_pseudo_frontmatter():
68
+ """`**name**:` is not YAML frontmatter -- parse_frontmatter returns no keys at all."""
69
+ with pytest.raises(SkillInstallError, match="description"):
70
+ validate_skill_content(PSEUDO_FRONTMATTER_SKILL, "demo")
71
+
72
+
73
+ def test_install_skill_refuses_and_writes_nothing_for_a_missing_description(project):
74
+ with pytest.raises(SkillInstallError):
75
+ install_skill(NO_DESCRIPTION_SKILL, False, project, name_hint="demo")
76
+ assert not (project / ".turnloop" / "skills").exists()
77
+
78
+
79
+ def test_install_skill_refuses_and_writes_nothing_for_pseudo_frontmatter(project):
80
+ with pytest.raises(SkillInstallError):
81
+ install_skill(PSEUDO_FRONTMATTER_SKILL, False, project, name_hint="demo")
82
+ assert not (project / ".turnloop" / "skills").exists()
83
+
84
+
85
+ # --------------------------------------------------------------------------
86
+ # a bogus project root (filesystem/drive root) must never be written to
87
+ # --------------------------------------------------------------------------
88
+
89
+
90
+ def test_install_skill_refuses_a_filesystem_root(tmp_path):
91
+ """The reported bug: `find_project_root` can fall back to a drive/filesystem
92
+ root (`F:\\`, `/`) when nothing declares a project -- e.g. because the drive
93
+ itself happens to be a git repo. Writing `skills/` there would satisfy
94
+ `_is_declared` (config.py) forever after, annexing every other project on
95
+ the drive. `tmp_path.anchor` is a real filesystem root on whatever drive the
96
+ test runs on (its own `.parent` is itself), so this needs no faked path and
97
+ touches nothing on disk -- `install_skill` must refuse before any write.
98
+ """
99
+ root = Path(tmp_path.anchor)
100
+
101
+ with pytest.raises(ConfigError, match="filesystem root"):
102
+ install_skill(VALID_SKILL, False, root, name_hint="demo")
103
+
104
+ assert not (root / ".turnloop" / "skills").exists()
105
+
106
+
107
+ def test_skills_import_refuses_when_cwd_and_resolved_root_diverge_to_a_drive_root(
108
+ tmp_path, monkeypatch
109
+ ):
110
+ """End-to-end reproduction of the bug report: the user stands in a fresh
111
+ scratch directory with an empty (undeclared) `.turnloop/`, but the project
112
+ resolver walks up to a filesystem root -- on the reporter's machine, `F:\\`
113
+ itself is a git repo. `settings.project_root` then differs from `cwd`, and
114
+ the old behavior silently installed skills at the wrong, dangerous place.
115
+ `load_skills(cwd)` -- what the user's own `cwd` actually sees -- must find
116
+ nothing, and the install itself must refuse rather than write there.
117
+ """
118
+ cwd = tmp_path / "scratch"
119
+ (cwd / ".turnloop").mkdir(parents=True) # exists but undeclared, like the report
120
+ fake_drive_root = Path(tmp_path.anchor)
121
+ monkeypatch.setattr("turnloop.config.find_project_root", lambda start: fake_drive_root)
122
+
123
+ settings = load_settings(cwd)
124
+
125
+ assert settings.project_root != cwd # the exact divergence that caused the bug
126
+
127
+ with pytest.raises(ConfigError, match="filesystem root"):
128
+ install_skill(VALID_SKILL, False, settings.project_root, name_hint="demo")
129
+
130
+ assert not (fake_drive_root / ".turnloop" / "skills").exists()
131
+ assert "demo" not in load_skills(cwd)
132
+
133
+
134
+ # --------------------------------------------------------------------------
135
+ # a successful install is actually visible to the real loader
136
+ # --------------------------------------------------------------------------
137
+
138
+
139
+ def test_a_successfully_added_skill_is_returned_by_load_skills(project):
140
+ skill = install_skill(VALID_SKILL, False, project, name_hint="demo")
141
+
142
+ loaded = load_skills(project)
143
+
144
+ assert "demo" in loaded
145
+ assert loaded["demo"].description == "does the demo thing"
146
+ assert loaded["demo"].path == skill.path
147
+
148
+
149
+ def test_install_to_user_scope_writes_under_home(project, monkeypatch, tmp_path):
150
+ fake_home = tmp_path / "fake-home"
151
+ monkeypatch.setattr("turnloop.skills_install.Path.home", staticmethod(lambda: fake_home))
152
+
153
+ skill = install_skill(VALID_SKILL, True, project, name_hint="demo")
154
+
155
+ assert fake_home in skill.path.parents
156
+
157
+
158
+ def test_remove_skill_deletes_the_directory_and_reports_presence(project):
159
+ install_skill(VALID_SKILL, False, project, name_hint="demo")
160
+
161
+ assert remove_skill("demo", False, project) is True
162
+ assert remove_skill("demo", False, project) is False
163
+ assert "demo" not in load_skills(project)
164
+
165
+
166
+ # --------------------------------------------------------------------------
167
+ # fetching from GitHub, with the transport mocked
168
+ # --------------------------------------------------------------------------
169
+
170
+
171
+ async def test_fetch_direct_raw_url():
172
+ async def handler(request: httpx.Request) -> httpx.Response:
173
+ assert request.url == httpx.URL("https://raw.githubusercontent.com/o/r/main/SKILL.md")
174
+ return httpx.Response(200, text=VALID_SKILL)
175
+
176
+ async with mock_client(handler) as client:
177
+ sources = await fetch_skill_sources(
178
+ "https://raw.githubusercontent.com/o/r/main/SKILL.md", client
179
+ )
180
+
181
+ assert len(sources) == 1
182
+ assert sources[0].content == VALID_SKILL
183
+ # `name` here is only a display fallback used before frontmatter is parsed
184
+ # (see `install_skill`, which prefers the real `name:` field every time) --
185
+ # for a direct URL it is just the URL's last path segment before the file.
186
+
187
+
188
+ async def test_fetch_repo_shorthand_with_a_single_root_skill():
189
+ async def handler(request: httpx.Request) -> httpx.Response:
190
+ url = str(request.url)
191
+ if "git/trees/main" in url:
192
+ return httpx.Response(200, json={"tree": [
193
+ {"path": "SKILL.md", "type": "blob"},
194
+ {"path": "README.md", "type": "blob"},
195
+ ]})
196
+ if url.startswith("https://api.github.com/repos/o/r"):
197
+ return httpx.Response(200, json={"default_branch": "main"})
198
+ if url == "https://raw.githubusercontent.com/o/r/main/SKILL.md":
199
+ return httpx.Response(200, text=VALID_SKILL)
200
+ raise AssertionError(f"unexpected request: {request.url}")
201
+
202
+ async with mock_client(handler) as client:
203
+ sources = await fetch_skill_sources("o/r", client)
204
+
205
+ assert len(sources) == 1
206
+ assert sources[0].content == VALID_SKILL
207
+
208
+
209
+ async def test_fetch_repo_collection_lets_multiple_skills_come_back():
210
+ tree = {"tree": [
211
+ {"path": "skills/one/SKILL.md", "type": "blob"},
212
+ {"path": "skills/two/SKILL.md", "type": "blob"},
213
+ {"path": "skills/two/reference.md", "type": "blob"},
214
+ ]}
215
+
216
+ async def handler(request: httpx.Request) -> httpx.Response:
217
+ url = str(request.url)
218
+ if url.startswith("https://api.github.com/repos/o/r") and "git/trees" not in url:
219
+ return httpx.Response(200, json={"default_branch": "main"})
220
+ if "git/trees/main" in url:
221
+ return httpx.Response(200, json=tree)
222
+ return httpx.Response(200, text=VALID_SKILL)
223
+
224
+ async with mock_client(handler) as client:
225
+ sources = await fetch_skill_sources("https://github.com/o/r", client)
226
+
227
+ assert {s.name for s in sources} == {"one", "two"}
228
+
229
+
230
+ async def test_fetch_repo_with_no_skill_md_raises():
231
+ async def handler(request: httpx.Request) -> httpx.Response:
232
+ url = str(request.url)
233
+ if "git/trees" not in url:
234
+ return httpx.Response(200, json={"default_branch": "main"})
235
+ return httpx.Response(200, json={"tree": [{"path": "README.md", "type": "blob"}]})
236
+
237
+ async with mock_client(handler) as client:
238
+ with pytest.raises(SkillInstallError, match=r"no SKILL\.md"):
239
+ await fetch_skill_sources("o/empty", client)
240
+
241
+
242
+ async def test_fetch_reports_a_bad_status_instead_of_raising_httpx_directly():
243
+ async def handler(request: httpx.Request) -> httpx.Response:
244
+ return httpx.Response(404, text="not found")
245
+
246
+ async with mock_client(handler) as client:
247
+ with pytest.raises(SkillInstallError, match="404"):
248
+ await fetch_skill_sources("https://raw.githubusercontent.com/o/r/main/SKILL.md", client)
249
+
250
+
251
+ # --------------------------------------------------------------------------
252
+ # import from ~/.claude/skills
253
+ # --------------------------------------------------------------------------
254
+
255
+
256
+ def _write_claude_skill(root, name, description="a claude code skill"):
257
+ d = root / name
258
+ d.mkdir(parents=True)
259
+ (d / "SKILL.md").write_text(
260
+ f"---\nname: {name}\ndescription: {description}\n---\nbody\n", encoding="utf-8"
261
+ )
262
+
263
+
264
+ def test_find_candidates_skips_already_installed(project, monkeypatch, tmp_path):
265
+ claude_dir = tmp_path / "claude-skills"
266
+ _write_claude_skill(claude_dir, "already-here")
267
+ _write_claude_skill(claude_dir, "not-yet")
268
+ monkeypatch.setattr("turnloop.skills_install.CLAUDE_CODE_SKILLS_DIR", claude_dir)
269
+
270
+ install_skill(
271
+ "---\nname: already-here\ndescription: installed already\n---\nbody\n",
272
+ False, project, name_hint="already-here",
273
+ )
274
+
275
+ candidates = find_claude_code_candidates(project)
276
+
277
+ assert {c.name for c in candidates} == {"not-yet"}
278
+ assert candidates[0].tokens > 0
279
+
280
+
281
+ def test_find_candidates_with_no_claude_dir_is_empty(project, monkeypatch, tmp_path):
282
+ monkeypatch.setattr("turnloop.skills_install.CLAUDE_CODE_SKILLS_DIR", tmp_path / "nope")
283
+ assert find_claude_code_candidates(project) == []
284
+
285
+
286
+ def test_import_selected_only_copies_the_chosen_subset(project, monkeypatch, tmp_path):
287
+ claude_dir = tmp_path / "claude-skills"
288
+ _write_claude_skill(claude_dir, "alpha")
289
+ _write_claude_skill(claude_dir, "beta")
290
+ _write_claude_skill(claude_dir, "gamma")
291
+ monkeypatch.setattr("turnloop.skills_install.CLAUDE_CODE_SKILLS_DIR", claude_dir)
292
+
293
+ candidates = find_claude_code_candidates(project)
294
+ imported = import_selected(candidates, {"alpha", "gamma"}, False, project)
295
+
296
+ assert set(imported) == {"alpha", "gamma"}
297
+ loaded = load_skills(project)
298
+ assert "alpha" in loaded and "gamma" in loaded
299
+ assert "beta" not in loaded
300
+
301
+
302
+ # --------------------------------------------------------------------------
303
+ # the "already asked" flag suppresses a second prompt
304
+ # --------------------------------------------------------------------------
305
+
306
+
307
+ def test_mark_import_asked_persists_and_is_not_re_asked(project, monkeypatch, tmp_path):
308
+ fake_user_path = tmp_path / "home" / ".turnloop" / "settings.json"
309
+ monkeypatch.setattr("turnloop.configio.user_settings_path", lambda: fake_user_path)
310
+
311
+ assert not fake_user_path.exists()
312
+ mark_import_asked(project)
313
+
314
+ on_disk = json.loads(fake_user_path.read_text(encoding="utf-8"))
315
+ assert on_disk == {"skills_import_asked": True}
316
+
317
+ # A fresh Settings load must see the flag, which is what a real second
318
+ # launch of turnloop checks before deciding whether to show the notice.
319
+ settings = default_settings()
320
+ from turnloop.config import deep_merge
321
+
322
+ merged = deep_merge(settings.model_dump(mode="json"), on_disk)
323
+ assert merged["skills_import_asked"] is True
324
+
325
+
326
+ def test_mark_import_asked_is_idempotent(tmp_path, monkeypatch, project):
327
+ fake_user_path = tmp_path / "home" / ".turnloop" / "settings.json"
328
+ monkeypatch.setattr("turnloop.configio.user_settings_path", lambda: fake_user_path)
329
+
330
+ mark_import_asked(project)
331
+ mark_import_asked(project) # must not raise, must not duplicate anything odd
332
+
333
+ on_disk = json.loads(fake_user_path.read_text(encoding="utf-8"))
334
+ assert on_disk == {"skills_import_asked": True}
@@ -8,6 +8,8 @@ rather than being dropped.
8
8
 
9
9
  from __future__ import annotations
10
10
 
11
+ import json
12
+
11
13
  import anyio
12
14
 
13
15
  from turnloop.providers.mock import MockProvider, ScriptTurn
@@ -606,6 +608,34 @@ async def test_continue_flag_resolves_to_the_last_session_sentinel():
606
608
  assert args.resume == "ses_123"
607
609
 
608
610
 
611
+ async def test_claude_code_skills_notice_shows_once_then_not_again(
612
+ settings, project, monkeypatch, tmp_path
613
+ ):
614
+ """The one-time import notice (see `skills_install.find_claude_code_candidates`)
615
+ fires when there is something to import and the user has never been asked, and
616
+ persists the "asked" flag so a second launch stays quiet."""
617
+ claude_dir = tmp_path / "claude-skills"
618
+ (claude_dir / "demo").mkdir(parents=True)
619
+ (claude_dir / "demo" / "SKILL.md").write_text(
620
+ "---\nname: demo\ndescription: a demo\n---\nbody\n", encoding="utf-8"
621
+ )
622
+ monkeypatch.setattr("turnloop.skills_install.CLAUDE_CODE_SKILLS_DIR", claude_dir)
623
+ fake_user_path = tmp_path / "home" / ".turnloop" / "settings.json"
624
+ monkeypatch.setattr("turnloop.configio.user_settings_path", lambda: fake_user_path)
625
+
626
+ app = app_with(settings, project, [ScriptTurn(text="hi")])
627
+ async with app.run_test() as pilot:
628
+ await pilot.pause()
629
+ assert "tl skills import" in _transcript_text(app)
630
+ assert settings.skills_import_asked is True
631
+ assert json.loads(fake_user_path.read_text(encoding="utf-8")) == {"skills_import_asked": True}
632
+
633
+ app2 = app_with(settings, project, [ScriptTurn(text="hi")])
634
+ async with app2.run_test() as pilot:
635
+ await pilot.pause()
636
+ assert "tl skills import" not in _transcript_text(app2)
637
+
638
+
609
639
  def _transcript_text(app: TurnloopApp) -> str:
610
640
  transcript = app.query_one(Transcript)
611
641
  from textual.widgets import Static
@@ -1,3 +1,3 @@
1
1
  """turnloop — a local-first agentic coding harness."""
2
2
 
3
- __version__ = "0.1.6"
3
+ __version__ = "0.1.7"