skillstate-kit 0.1.1__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.
- skillstate_kit-0.1.1/.gitignore +21 -0
- skillstate_kit-0.1.1/CHANGELOG.md +21 -0
- skillstate_kit-0.1.1/CITATION.cff +21 -0
- skillstate_kit-0.1.1/CONTRIBUTING.md +29 -0
- skillstate_kit-0.1.1/LICENSE +21 -0
- skillstate_kit-0.1.1/PKG-INFO +157 -0
- skillstate_kit-0.1.1/README.md +167 -0
- skillstate_kit-0.1.1/SECURITY.md +25 -0
- skillstate_kit-0.1.1/docs/PYPI_README.md +118 -0
- skillstate_kit-0.1.1/docs/README_TR.md +43 -0
- skillstate_kit-0.1.1/docs/architecture.md +63 -0
- skillstate_kit-0.1.1/docs/cli.md +121 -0
- skillstate_kit-0.1.1/docs/compatibility.md +37 -0
- skillstate_kit-0.1.1/docs/releasing.md +39 -0
- skillstate_kit-0.1.1/docs/research/DESIGN_TR.md +128 -0
- skillstate_kit-0.1.1/docs/research/REPO_INCELEME_TR.md +101 -0
- skillstate_kit-0.1.1/docs/research/URUN_MIMARI_V2_TR.md +366 -0
- skillstate_kit-0.1.1/docs/validation.md +53 -0
- skillstate_kit-0.1.1/examples/managed_runtime.py +42 -0
- skillstate_kit-0.1.1/examples/qa/SKILL.md +14 -0
- skillstate_kit-0.1.1/pyproject.toml +61 -0
- skillstate_kit-0.1.1/scripts/check_wheel.py +59 -0
- skillstate_kit-0.1.1/scripts/verify_index.py +68 -0
- skillstate_kit-0.1.1/src/skillstate/__init__.py +35 -0
- skillstate_kit-0.1.1/src/skillstate/__main__.py +3 -0
- skillstate_kit-0.1.1/src/skillstate/artifacts.py +55 -0
- skillstate_kit-0.1.1/src/skillstate/cli.py +256 -0
- skillstate_kit-0.1.1/src/skillstate/compiler.py +367 -0
- skillstate_kit-0.1.1/src/skillstate/demo.py +74 -0
- skillstate_kit-0.1.1/src/skillstate/errors.py +33 -0
- skillstate_kit-0.1.1/src/skillstate/hosts.py +322 -0
- skillstate_kit-0.1.1/src/skillstate/jsonio.py +143 -0
- skillstate_kit-0.1.1/src/skillstate/mcp_server.py +142 -0
- skillstate_kit-0.1.1/src/skillstate/models.py +88 -0
- skillstate_kit-0.1.1/src/skillstate/providers.py +89 -0
- skillstate_kit-0.1.1/src/skillstate/py.typed +0 -0
- skillstate_kit-0.1.1/src/skillstate/runtime.py +179 -0
- skillstate_kit-0.1.1/src/skillstate/schema.py +91 -0
- skillstate_kit-0.1.1/src/skillstate/service.py +59 -0
- skillstate_kit-0.1.1/src/skillstate/store.py +332 -0
- skillstate_kit-0.1.1/tests/conftest.py +46 -0
- skillstate_kit-0.1.1/tests/test_cli_mcp_provider.py +287 -0
- skillstate_kit-0.1.1/tests/test_compiler_hosts.py +235 -0
- skillstate_kit-0.1.1/tests/test_json_schema.py +120 -0
- skillstate_kit-0.1.1/tests/test_publish_verification.py +59 -0
- skillstate_kit-0.1.1/tests/test_runtime.py +193 -0
- skillstate_kit-0.1.1/tests/test_store.py +145 -0
- skillstate_kit-0.1.1/uv.lock +1659 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
.venv-*/
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*.egg-info/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.hypothesis/
|
|
10
|
+
.ruff_cache/
|
|
11
|
+
.mypy_cache/
|
|
12
|
+
.coverage*
|
|
13
|
+
htmlcov/
|
|
14
|
+
.skillstate/local/
|
|
15
|
+
.env
|
|
16
|
+
.env.*
|
|
17
|
+
research/skill-state-minimal/
|
|
18
|
+
research/probe_results.json
|
|
19
|
+
*.sqlite3*
|
|
20
|
+
.test-workspaces/
|
|
21
|
+
.artifacts/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1 — public distribution
|
|
4
|
+
|
|
5
|
+
- Self-contained PyPI package description with installation and SDK examples.
|
|
6
|
+
- GitHub OIDC publishing workflow: full test matrix, clean installation, optional TestPyPI rehearsal, PyPI and downloaded package verification.
|
|
7
|
+
- Verify registry file hashes against the tested artifacts before installation.
|
|
8
|
+
- No changes to the runtime or storage contract from 0.1.0.
|
|
9
|
+
|
|
10
|
+
## 0.1.0 — initial alpha
|
|
11
|
+
|
|
12
|
+
- Source-preserving SKILL.md conversion and Python test tracking profile.
|
|
13
|
+
- Source-bound semantic proposal preparation/validation and optional stateless JSON model adapter.
|
|
14
|
+
- Immutable skill definitions and source drift detection.
|
|
15
|
+
- SQLite revisions, ownership handoff, operation intents and explicit reconciliation.
|
|
16
|
+
- Managed async runtime with bounded context and tool argument validation.
|
|
17
|
+
- Project-scoped Codex, Claude Code and Antigravity skill/MCP installers.
|
|
18
|
+
- STDIO MCP server, protocol smoke test, CLI and text artifact store.
|
|
19
|
+
- Offline examples, cross-platform CI and package checks.
|
|
20
|
+
|
|
21
|
+
Not included: native transcript replacement, arbitrary code rewriting, live certification of every host version, distributed multi-tenant storage, automatic external-effect rollback or reproduced paper benchmarks.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "Cite this repository and the SKILL.state paper that inspired its explicit-state execution pattern."
|
|
3
|
+
title: "skillstate-kit"
|
|
4
|
+
type: software
|
|
5
|
+
version: 0.1.1
|
|
6
|
+
license: MIT
|
|
7
|
+
authors:
|
|
8
|
+
- name: "Atakan Emre"
|
|
9
|
+
repository-code: "https://github.com/Atakan-Emre/skillstate-kit"
|
|
10
|
+
references:
|
|
11
|
+
- type: article
|
|
12
|
+
title: "SKILL.state: Scalable Long-Horizon Agent Skills"
|
|
13
|
+
authors:
|
|
14
|
+
- family-names: Badhe
|
|
15
|
+
given-names: Sanket
|
|
16
|
+
- family-names: Tiwari
|
|
17
|
+
given-names: Priyanka
|
|
18
|
+
- family-names: Chung
|
|
19
|
+
given-names: Jonghyun
|
|
20
|
+
year: 2026
|
|
21
|
+
url: "https://arxiv.org/abs/2608.26263"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Keep public contracts small, explicit and testable. New behavior should include a realistic failure case as well as a successful example. Do not add compatibility or benchmark claims that have not been measured.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m pip install uv
|
|
9
|
+
uv sync --locked --extra dev
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Run `uv run ruff check src tests examples`, `uv run ruff format --check src tests examples`, and `uv run pytest --cov=skillstate --cov-fail-under=85`. For packaging changes, also run `uv run python -m build` and `uv run twine check dist/*`.
|
|
13
|
+
|
|
14
|
+
## Invariants
|
|
15
|
+
|
|
16
|
+
- Validate candidate state before committing it.
|
|
17
|
+
- Reserve external operations before execution; never retry uncertain effects automatically.
|
|
18
|
+
- Keep SQLite transactions outside model/tool calls.
|
|
19
|
+
- Preserve the original observation during rejected-decision retries.
|
|
20
|
+
- Keep definitions immutable for existing runs.
|
|
21
|
+
- Preserve user-authored source and host configuration.
|
|
22
|
+
- Distinguish agent-reported evidence from observed tool results and business truth.
|
|
23
|
+
- Keep audit records outside context and enforce explicit budgets.
|
|
24
|
+
|
|
25
|
+
Describe the concrete problem, resulting behavior and validation in changes. Document protocol/schema migrations. Examples should run without credentials unless labeled otherwise. Keep optional integrations optional.
|
|
26
|
+
|
|
27
|
+
For host integrations, distinguish file generation, configuration validation, live MCP transport, live host discovery and actual agent behavior. Passing one level does not prove the others.
|
|
28
|
+
|
|
29
|
+
Do not commit credentials, real task data, machine-specific interpreter paths or research checkouts. Report security concerns through SECURITY.md.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Atakan Emre
|
|
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,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: skillstate-kit
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Compile existing agent skills into portable, validated execution state.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Atakan-Emre/skillstate-kit
|
|
6
|
+
Project-URL: Repository, https://github.com/Atakan-Emre/skillstate-kit
|
|
7
|
+
Project-URL: Documentation, https://github.com/Atakan-Emre/skillstate-kit/tree/main/docs
|
|
8
|
+
Project-URL: Issues, https://github.com/Atakan-Emre/skillstate-kit/issues
|
|
9
|
+
Author: Atakan Emre
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agents,claude,codex,mcp,skills,state
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: jsonschema<5,>=4.23
|
|
22
|
+
Requires-Dist: pathspec<1,>=0.12
|
|
23
|
+
Requires-Dist: pyyaml<7,>=6.0.2
|
|
24
|
+
Requires-Dist: tomlkit<1,>=0.13
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: build<2,>=1.2; extra == 'dev'
|
|
27
|
+
Requires-Dist: httpx<1,>=0.28; extra == 'dev'
|
|
28
|
+
Requires-Dist: hypothesis<7,>=6.120; extra == 'dev'
|
|
29
|
+
Requires-Dist: mcp<2,>=1.20; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-cov<7,>=6; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest<9,>=8; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff<1,>=0.11; extra == 'dev'
|
|
33
|
+
Requires-Dist: twine<7,>=6; extra == 'dev'
|
|
34
|
+
Provides-Extra: http
|
|
35
|
+
Requires-Dist: httpx<1,>=0.28; extra == 'http'
|
|
36
|
+
Provides-Extra: mcp
|
|
37
|
+
Requires-Dist: mcp<2,>=1.20; extra == 'mcp'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# skillstate-kit
|
|
41
|
+
|
|
42
|
+
**Portable, validated execution state for agent skills.**
|
|
43
|
+
|
|
44
|
+
Convert an existing `SKILL.md` into a state-backed skill, retain durable checkpoints, and integrate the same execution engine into a Python application.
|
|
45
|
+
|
|
46
|
+
Python 3.11+ · MIT license · Initial alpha
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m pip install "skillstate-kit[mcp,http]"
|
|
52
|
+
skillstate demo
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The core package requires no model account. The demo uses an explicitly scripted model and local tools; it is not a benchmark of real-model performance.
|
|
56
|
+
|
|
57
|
+
Optional extras:
|
|
58
|
+
|
|
59
|
+
- `mcp`: a project-scoped STDIO MCP server and connection diagnostics.
|
|
60
|
+
- `http`: a stateless adapter for a configured JSON-compatible chat-completions endpoint.
|
|
61
|
+
|
|
62
|
+
## Use an existing skill
|
|
63
|
+
|
|
64
|
+
Run these commands in your target project. Replace `skills/qa/SKILL.md` with your existing skill file:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
skillstate init --host codex --host claude-code --host antigravity --mcp
|
|
68
|
+
skillstate generate skills/qa/SKILL.md --name qa-state --install
|
|
69
|
+
skillstate validate qa-state
|
|
70
|
+
skillstate doctor --mcp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
After your host discovers the installed `generate-skill-state` skill, ask it to generate state from an existing skill and install the result. Invoke the generated `qa-state` skill to run the procedure with checkpoints. Generating a definition does not execute the task.
|
|
74
|
+
|
|
75
|
+
`generate` preserves the source procedure and adds bounded progress fields. Domain-specific generation uses the active agent's proposal:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
skillstate generate skills/qa/SKILL.md --prepare
|
|
79
|
+
skillstate generate skills/qa/SKILL.md --proposal proposal.json --source-hash HASH_FROM_PREPARE --install
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The preparation response contains source text, its fingerprint and the proposal schema. The agent writes `proposal.json`; the library validates it and refuses stale source fingerprints. Structural validation is not proof that every business rule is correct.
|
|
83
|
+
|
|
84
|
+
You can also supply an explicitly configured endpoint with `--base-url` and `--model`. Terminal commands do not borrow your IDE's model credentials.
|
|
85
|
+
|
|
86
|
+
## Python integration
|
|
87
|
+
|
|
88
|
+
This complete example uses a scripted model. Replace `model` and `record` with your own model and service functions:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import asyncio
|
|
92
|
+
from skillstate import Skill, SkillRuntime, SQLiteStore, Tool, ToolResult
|
|
93
|
+
|
|
94
|
+
skill = Skill(
|
|
95
|
+
name="record-job",
|
|
96
|
+
instructions="Record the job, then finish after its result is confirmed.",
|
|
97
|
+
state_schema={
|
|
98
|
+
"type": "object",
|
|
99
|
+
"properties": {"recorded": {"type": "boolean"}},
|
|
100
|
+
"required": ["recorded"],
|
|
101
|
+
"additionalProperties": False,
|
|
102
|
+
},
|
|
103
|
+
initial_state={"recorded": False},
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
def model(context):
|
|
107
|
+
if context["state"]["recorded"]:
|
|
108
|
+
return {"patch": [], "action": None, "done": True}
|
|
109
|
+
return {
|
|
110
|
+
"patch": [{"op": "set", "path": "/recorded", "value": True}],
|
|
111
|
+
"action": {"name": "record", "arguments": {}},
|
|
112
|
+
"done": False,
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
def record(arguments, operation_id):
|
|
116
|
+
# For a real API, forward operation_id to its idempotency facility when
|
|
117
|
+
# supported and inspect the actual response before reporting success.
|
|
118
|
+
return ToolResult(True, {"recorded": True})
|
|
119
|
+
|
|
120
|
+
async def main():
|
|
121
|
+
with SQLiteStore() as store: # Pass a local file path for durable storage.
|
|
122
|
+
store.create("job-001", skill, "worker")
|
|
123
|
+
tool = Tool("record", "Record a job",
|
|
124
|
+
{"type": "object", "additionalProperties": False}, record)
|
|
125
|
+
runtime = SkillRuntime(store, model, [tool],
|
|
126
|
+
completion_check=lambda state: state["recorded"])
|
|
127
|
+
result = await runtime.run("job-001", "worker", max_steps=10)
|
|
128
|
+
print(result["status"], result["state"])
|
|
129
|
+
|
|
130
|
+
asyncio.run(main())
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
For persistent storage, pass a database path to `SQLiteStore`. Reopen the same database and run ID to resume; creating a duplicate run is rejected.
|
|
134
|
+
|
|
135
|
+
## Execution contract
|
|
136
|
+
|
|
137
|
+
- Explicit `set`/`delete` patches with JSON Pointer paths, inline JSON Schema and UTF-8 size limits.
|
|
138
|
+
- State and tool arguments validated before a managed tool executes.
|
|
139
|
+
- Persistent operation intent before tool execution; atomic state, result and event commit afterward.
|
|
140
|
+
- Failed tools retain the prior state. Exceptions, timeouts and ambiguous results block replay until reconciliation.
|
|
141
|
+
- Revision checks prevent competing clients from silently overwriting each other.
|
|
142
|
+
- Immutable skill definitions, source drift detection and sequential owner handoff.
|
|
143
|
+
- Large text artifacts kept outside the active context.
|
|
144
|
+
|
|
145
|
+
Native host skills provide state and checkpoints. They do **not** replace host conversation history or intercept every native tool. Use the managed Python runtime with a stateless model for history-free model inputs.
|
|
146
|
+
|
|
147
|
+
SQLite does not make external APIs transactional. Owner names coordinate local clients; they are not authentication. The library validates reported results but cannot independently prove external business truth. Keep local state private and test recovery behavior for your application.
|
|
148
|
+
|
|
149
|
+
## Compatibility and documentation
|
|
150
|
+
|
|
151
|
+
Adapters generate project skill files and optional MCP configuration for Codex, Claude Code and Antigravity. They target documented integration surfaces. MCP protocol tests and configuration discovery do not certify every IDE version or live task.
|
|
152
|
+
|
|
153
|
+
The source distribution includes `docs/cli.md`, `docs/architecture.md`, `docs/compatibility.md`, `docs/validation.md`, `docs/README_TR.md` and runnable examples. Download the source archive from this package's files to read them offline. The development repository currently requires collaborator access.
|
|
154
|
+
|
|
155
|
+
## Research
|
|
156
|
+
|
|
157
|
+
An independent implementation inspired by [SKILL.state: Scalable Long-Horizon Agent Skills](https://arxiv.org/abs/2608.26263). Not affiliated with the paper's authors. The compiler, host adapters and operation journal are engineering extensions; no reproduction of the paper's benchmark scores or token savings is claimed.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# skillstate-kit
|
|
2
|
+
|
|
3
|
+
**Portable, validated execution state for agent skills.**
|
|
4
|
+
|
|
5
|
+
Turn an existing `SKILL.md` into a state-backed skill, use it from Codex, Claude Code or Antigravity, and resume work from a durable checkpoint. Embed the same runtime in Python when you need to control every model input and tool operation.
|
|
6
|
+
|
|
7
|
+
[](https://github.com/Atakan-Emre/skillstate-kit/actions/workflows/ci.yml)
|
|
8
|
+

|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
**Release status:** `0.1.1` is an initial alpha. The development repository is private; public package installation uses PyPI. Tested local adapters are not live certification of every host application.
|
|
12
|
+
|
|
13
|
+
[Türkçe başlangıç](docs/README_TR.md) · [CLI](docs/cli.md) · [Architecture](docs/architecture.md) · [Compatibility](docs/compatibility.md) · [Validation](docs/validation.md)
|
|
14
|
+
|
|
15
|
+
## What you get
|
|
16
|
+
|
|
17
|
+
- **Source-preserving conversion.** Generate bounded tracking state without changing the original procedure.
|
|
18
|
+
- **Semantic generation.** Use your coding agent or a configured JSON-capable model endpoint to propose domain-specific state. Validate proposals against source fingerprints before applying them.
|
|
19
|
+
- **Durable state.** SQLite transactions, revision checks, ownership handoff and a persistent operation journal.
|
|
20
|
+
- **Controlled execution.** Validate state and tool arguments, retain observations during retries, and stop ambiguous operations from being replayed automatically.
|
|
21
|
+
- **Three host adapters.** Project-scoped skills and optional STDIO MCP configuration for Codex, Claude Code and Antigravity.
|
|
22
|
+
- **A Python SDK.** Bring your own model and tool functions. The core package requires no API key.
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python -m pip install "skillstate-kit[mcp,http]"
|
|
28
|
+
skillstate demo
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then, inside your target project (replace `skills/qa/SKILL.md` with your skill):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
|
|
35
|
+
skillstate init --host codex --host claude-code --host antigravity --mcp
|
|
36
|
+
skillstate generate skills/qa/SKILL.md --name qa-state --install
|
|
37
|
+
skillstate validate qa-state
|
|
38
|
+
skillstate doctor --mcp
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
After installing the package, run `init` and `generate` in your target project. `--project PATH` can also be placed **before** a subcommand. Generated MCP configurations use this machine's Python/project paths; keep them local. See [installation and compatibility](docs/compatibility.md).
|
|
42
|
+
|
|
43
|
+
After the host discovers `generate-skill-state`, ask:
|
|
44
|
+
|
|
45
|
+
> Generate skill state from my existing QA skill and install it in this project.
|
|
46
|
+
|
|
47
|
+
The generator skill can prepare a source inventory, propose domain-specific state, then submit the proposal for deterministic validation. A standalone terminal process cannot silently borrow the host's model session or subscription.
|
|
48
|
+
|
|
49
|
+
### Try it without a model account
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
skillstate demo
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The demo explicitly uses a **scripted model** and local tools. It completes five operations and reports prompt sizes in UTF-8 **bytes**, not tokens. It is an executable example, not a reproduction of the paper's benchmarks.
|
|
56
|
+
|
|
57
|
+
## Two execution modes
|
|
58
|
+
|
|
59
|
+
| Mode | Model and tools run in | What the package controls |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| Native skill | Your coding agent | Validated state, checkpoints, explicit operation records, bounded returned context |
|
|
62
|
+
| Managed runtime | Your Python application | Model context, decision validation, registered tools, retries and operation outcomes |
|
|
63
|
+
|
|
64
|
+
Native skills do **not** replace the host's conversation history or intercept every native tool. For the paper's history-free model-input structure, use the managed runtime with a stateless model adapter. Instructions, state, tool schemas and observations must fit their configured budgets.
|
|
65
|
+
|
|
66
|
+
## Python integration
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from skillstate import Skill, SkillRuntime, SQLiteStore, Tool, ToolResult
|
|
70
|
+
|
|
71
|
+
skill = Skill(
|
|
72
|
+
name="record-job",
|
|
73
|
+
instructions="Record the requested job. Finish after its result is confirmed.",
|
|
74
|
+
state_schema={
|
|
75
|
+
"type": "object",
|
|
76
|
+
"properties": {"recorded": {"type": "boolean"}},
|
|
77
|
+
"required": ["recorded"],
|
|
78
|
+
"additionalProperties": False,
|
|
79
|
+
},
|
|
80
|
+
initial_state={"recorded": False},
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
def record(arguments, operation_id):
|
|
84
|
+
# Replace with your service call. Forward operation_id to its idempotency
|
|
85
|
+
# facility if supported, and inspect the actual result before success.
|
|
86
|
+
return ToolResult(True, {"recorded": True})
|
|
87
|
+
|
|
88
|
+
tool = Tool("record", "Record a job",
|
|
89
|
+
{"type": "object", "additionalProperties": False}, record)
|
|
90
|
+
|
|
91
|
+
async def run(model):
|
|
92
|
+
with SQLiteStore("jobs.sqlite3") as store:
|
|
93
|
+
store.create("job-001", skill, "worker", {"job": "example"})
|
|
94
|
+
runtime = SkillRuntime(store, model, [tool],
|
|
95
|
+
completion_check=lambda s: s["recorded"] is True)
|
|
96
|
+
return await runtime.run("job-001", "worker", max_steps=10)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Pass your synchronous or asynchronous model callback to `run`. See [the complete runnable example](examples/managed_runtime.py). A repeated `create` rejects an existing run; resume by opening the same database and calling `runtime.run` on its existing ID.
|
|
100
|
+
|
|
101
|
+
### Decision contract
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"patch": [{"op": "set", "path": "/recorded", "value": true}],
|
|
106
|
+
"action": {"name": "record", "arguments": {}},
|
|
107
|
+
"done": false
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Use `{"patch": [], "action": null, "done": true}` to finish. Explicit `set`/`delete` operations use JSON Pointer paths. Setting `null` does not delete a key. No reasoning-trace field is accepted.
|
|
112
|
+
|
|
113
|
+
## How generation works
|
|
114
|
+
|
|
115
|
+
```mermaid
|
|
116
|
+
flowchart LR
|
|
117
|
+
Source[Existing skill or Python project] --> Scan[Bounded source inventory]
|
|
118
|
+
Scan --> IR[Tracking profile or semantic proposal]
|
|
119
|
+
IR --> Validate[Schema and source validation]
|
|
120
|
+
Validate --> Bundle[Immutable skill bundle]
|
|
121
|
+
Bundle --> Hosts[Codex / Claude Code / Antigravity]
|
|
122
|
+
Bundle --> SDK[Python runtime]
|
|
123
|
+
Hosts <--> State[SQLite state and operation journal]
|
|
124
|
+
SDK <--> State
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Default conversion preserves the procedure and adds generic bounded progress state. It does **not** infer every business invariant. Semantic proposals can supply domain-specific fields and steps; structural validation still needs to be followed by application tests.
|
|
128
|
+
|
|
129
|
+
Definitions live under `.skillstate/definitions/`. Run data and artifacts live under `.skillstate/local/`. Original files remain unchanged. Source changes are detected before new runs; existing runs retain their pinned definition and expose drift.
|
|
130
|
+
|
|
131
|
+
## Failure behavior
|
|
132
|
+
|
|
133
|
+
| Event | Behavior |
|
|
134
|
+
|---|---|
|
|
135
|
+
| Invalid JSON, state or tool arguments | Reject before tool execution |
|
|
136
|
+
| Stale revision or wrong owner | Reject; require a fresh read/handoff |
|
|
137
|
+
| Tool reports failure | Keep prior state and record its observation |
|
|
138
|
+
| Timeout, exception or invalid tool result | Mark `unknown`; require reconciliation |
|
|
139
|
+
| Process exits after reserving an operation | Retain the pending intent; do not replay automatically |
|
|
140
|
+
| Event write fails during result commit | Roll back state, operation outcome and event together |
|
|
141
|
+
| User edits installed files/configuration | Preserve changes and report a conflict |
|
|
142
|
+
|
|
143
|
+
SQLite does not create a distributed transaction with external APIs. A checkpoint cannot undo an external side effect. Owner IDs coordinate local clients; they are not an authentication boundary. Read [the execution contract](docs/architecture.md) before using mutating tools.
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
python -m pip install uv
|
|
149
|
+
uv sync --locked --extra dev
|
|
150
|
+
uv run ruff check src tests examples
|
|
151
|
+
uv run ruff format --check src tests examples
|
|
152
|
+
uv run pytest --cov=skillstate --cov-fail-under=85
|
|
153
|
+
uv run python -m build
|
|
154
|
+
uv run twine check dist/*
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
CI tests the Python/OS matrix, builds distributions and checks wheel installation. Tests include real MCP sessions, competing connections, crash recovery, configuration preservation, invalid schemas and source drift. Coverage is a regression signal, not proof of correctness.
|
|
158
|
+
|
|
159
|
+
## Research and attribution
|
|
160
|
+
|
|
161
|
+
An **independent implementation** inspired by [SKILL.state: Scalable Long-Horizon Agent Skills](https://arxiv.org/abs/2608.26263), by Sanket Badhe, Priyanka Tiwari and Jonghyun Chung. Not affiliated with or endorsed by the authors or their institutions.
|
|
162
|
+
|
|
163
|
+
The managed runtime follows the explicit-state input pattern. Our compiler, host adapters, explicit patch format and operation journal are engineering extensions. No paper benchmark scores are claimed. [skill-state-minimal](https://github.com/kissishka/skill-state-minimal) was inspected as a comparison; its source is not bundled here.
|
|
164
|
+
|
|
165
|
+
## License and contributing
|
|
166
|
+
|
|
167
|
+
[MIT](LICENSE). See [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md), [CHANGELOG.md](CHANGELOG.md) and [release guidance](docs/releasing.md).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Security and trust boundaries
|
|
2
|
+
|
|
3
|
+
## Reporting
|
|
4
|
+
|
|
5
|
+
Use GitHub private vulnerability reporting when available. While the repo is private, contact the maintainer through an existing private channel. Do not put credentials or exploitable production details in an issue or test another person's services.
|
|
6
|
+
|
|
7
|
+
## Scope
|
|
8
|
+
|
|
9
|
+
This library is not a sandbox. Python model/tool callbacks execute with the embedding application's permissions. Native tools remain subject to their host's permissions. Valid JSON is not business authorization.
|
|
10
|
+
|
|
11
|
+
- Owner IDs coordinate cooperating clients; they do not authenticate tenants.
|
|
12
|
+
- The MCP server is STDIO-only. Do not expose it through an unauthenticated network bridge.
|
|
13
|
+
- Scanner paths are confined to the selected project; symlinks/junctions, known secret filenames and ignored files are excluded/rejected. Redaction is best effort. Inspect prepared inventories before sending sensitive projects to a remote generator.
|
|
14
|
+
- Python scanning uses AST, not imports or execution.
|
|
15
|
+
- JSON inputs are bounded. Duplicate keys, non-finite values and unsupported objects are rejected. Schema references and unrestricted regex patterns are disabled.
|
|
16
|
+
- State/artifacts can contain sensitive data. Keep `.skillstate/local/` out of version control and use OS permissions and an appropriate retention policy.
|
|
17
|
+
- Generated MCP configuration contains local paths; keep it local and respect host trust policies.
|
|
18
|
+
|
|
19
|
+
## External effects
|
|
20
|
+
|
|
21
|
+
`pending` and `unknown` operations require inspection of the external system before reconciliation. They are not permission to repeat a deployment, payment, mutation or message.
|
|
22
|
+
|
|
23
|
+
Timeouts cancel waiting, not necessarily the external operation. A synchronous handler running in a thread can continue after timeout. Prefer cancellable asynchronous clients and service-level idempotency for production integrations.
|
|
24
|
+
|
|
25
|
+
Supply application-level authorization, argument constraints, result validation, completion checks and recovery procedures. A local transaction cannot guarantee exactly-once effects across arbitrary remote systems.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# skillstate-kit
|
|
2
|
+
|
|
3
|
+
**Portable, validated execution state for agent skills.**
|
|
4
|
+
|
|
5
|
+
Convert an existing `SKILL.md` into a state-backed skill, retain durable checkpoints, and integrate the same execution engine into a Python application.
|
|
6
|
+
|
|
7
|
+
Python 3.11+ · MIT license · Initial alpha
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
python -m pip install "skillstate-kit[mcp,http]"
|
|
13
|
+
skillstate demo
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The core package requires no model account. The demo uses an explicitly scripted model and local tools; it is not a benchmark of real-model performance.
|
|
17
|
+
|
|
18
|
+
Optional extras:
|
|
19
|
+
|
|
20
|
+
- `mcp`: a project-scoped STDIO MCP server and connection diagnostics.
|
|
21
|
+
- `http`: a stateless adapter for a configured JSON-compatible chat-completions endpoint.
|
|
22
|
+
|
|
23
|
+
## Use an existing skill
|
|
24
|
+
|
|
25
|
+
Run these commands in your target project. Replace `skills/qa/SKILL.md` with your existing skill file:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
skillstate init --host codex --host claude-code --host antigravity --mcp
|
|
29
|
+
skillstate generate skills/qa/SKILL.md --name qa-state --install
|
|
30
|
+
skillstate validate qa-state
|
|
31
|
+
skillstate doctor --mcp
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
After your host discovers the installed `generate-skill-state` skill, ask it to generate state from an existing skill and install the result. Invoke the generated `qa-state` skill to run the procedure with checkpoints. Generating a definition does not execute the task.
|
|
35
|
+
|
|
36
|
+
`generate` preserves the source procedure and adds bounded progress fields. Domain-specific generation uses the active agent's proposal:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
skillstate generate skills/qa/SKILL.md --prepare
|
|
40
|
+
skillstate generate skills/qa/SKILL.md --proposal proposal.json --source-hash HASH_FROM_PREPARE --install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The preparation response contains source text, its fingerprint and the proposal schema. The agent writes `proposal.json`; the library validates it and refuses stale source fingerprints. Structural validation is not proof that every business rule is correct.
|
|
44
|
+
|
|
45
|
+
You can also supply an explicitly configured endpoint with `--base-url` and `--model`. Terminal commands do not borrow your IDE's model credentials.
|
|
46
|
+
|
|
47
|
+
## Python integration
|
|
48
|
+
|
|
49
|
+
This complete example uses a scripted model. Replace `model` and `record` with your own model and service functions:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import asyncio
|
|
53
|
+
from skillstate import Skill, SkillRuntime, SQLiteStore, Tool, ToolResult
|
|
54
|
+
|
|
55
|
+
skill = Skill(
|
|
56
|
+
name="record-job",
|
|
57
|
+
instructions="Record the job, then finish after its result is confirmed.",
|
|
58
|
+
state_schema={
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {"recorded": {"type": "boolean"}},
|
|
61
|
+
"required": ["recorded"],
|
|
62
|
+
"additionalProperties": False,
|
|
63
|
+
},
|
|
64
|
+
initial_state={"recorded": False},
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
def model(context):
|
|
68
|
+
if context["state"]["recorded"]:
|
|
69
|
+
return {"patch": [], "action": None, "done": True}
|
|
70
|
+
return {
|
|
71
|
+
"patch": [{"op": "set", "path": "/recorded", "value": True}],
|
|
72
|
+
"action": {"name": "record", "arguments": {}},
|
|
73
|
+
"done": False,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
def record(arguments, operation_id):
|
|
77
|
+
# For a real API, forward operation_id to its idempotency facility when
|
|
78
|
+
# supported and inspect the actual response before reporting success.
|
|
79
|
+
return ToolResult(True, {"recorded": True})
|
|
80
|
+
|
|
81
|
+
async def main():
|
|
82
|
+
with SQLiteStore() as store: # Pass a local file path for durable storage.
|
|
83
|
+
store.create("job-001", skill, "worker")
|
|
84
|
+
tool = Tool("record", "Record a job",
|
|
85
|
+
{"type": "object", "additionalProperties": False}, record)
|
|
86
|
+
runtime = SkillRuntime(store, model, [tool],
|
|
87
|
+
completion_check=lambda state: state["recorded"])
|
|
88
|
+
result = await runtime.run("job-001", "worker", max_steps=10)
|
|
89
|
+
print(result["status"], result["state"])
|
|
90
|
+
|
|
91
|
+
asyncio.run(main())
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For persistent storage, pass a database path to `SQLiteStore`. Reopen the same database and run ID to resume; creating a duplicate run is rejected.
|
|
95
|
+
|
|
96
|
+
## Execution contract
|
|
97
|
+
|
|
98
|
+
- Explicit `set`/`delete` patches with JSON Pointer paths, inline JSON Schema and UTF-8 size limits.
|
|
99
|
+
- State and tool arguments validated before a managed tool executes.
|
|
100
|
+
- Persistent operation intent before tool execution; atomic state, result and event commit afterward.
|
|
101
|
+
- Failed tools retain the prior state. Exceptions, timeouts and ambiguous results block replay until reconciliation.
|
|
102
|
+
- Revision checks prevent competing clients from silently overwriting each other.
|
|
103
|
+
- Immutable skill definitions, source drift detection and sequential owner handoff.
|
|
104
|
+
- Large text artifacts kept outside the active context.
|
|
105
|
+
|
|
106
|
+
Native host skills provide state and checkpoints. They do **not** replace host conversation history or intercept every native tool. Use the managed Python runtime with a stateless model for history-free model inputs.
|
|
107
|
+
|
|
108
|
+
SQLite does not make external APIs transactional. Owner names coordinate local clients; they are not authentication. The library validates reported results but cannot independently prove external business truth. Keep local state private and test recovery behavior for your application.
|
|
109
|
+
|
|
110
|
+
## Compatibility and documentation
|
|
111
|
+
|
|
112
|
+
Adapters generate project skill files and optional MCP configuration for Codex, Claude Code and Antigravity. They target documented integration surfaces. MCP protocol tests and configuration discovery do not certify every IDE version or live task.
|
|
113
|
+
|
|
114
|
+
The source distribution includes `docs/cli.md`, `docs/architecture.md`, `docs/compatibility.md`, `docs/validation.md`, `docs/README_TR.md` and runnable examples. Download the source archive from this package's files to read them offline. The development repository currently requires collaborator access.
|
|
115
|
+
|
|
116
|
+
## Research
|
|
117
|
+
|
|
118
|
+
An independent implementation inspired by [SKILL.state: Scalable Long-Horizon Agent Skills](https://arxiv.org/abs/2608.26263). Not affiliated with the paper's authors. The compiler, host adapters and operation journal are engineering extensions; no reproduction of the paper's benchmark scores or token savings is claimed.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Türkçe başlangıç
|
|
2
|
+
|
|
3
|
+
skillstate-kit, mevcut agent skill'lerini kalıcı ve doğrulanan görev durumuyla kullanmanızı sağlar. Sürüm alpha durumundadır; geliştirme deposu private kalırken paket PyPI üzerinden dağıtılır.
|
|
4
|
+
|
|
5
|
+
## Kurulum
|
|
6
|
+
|
|
7
|
+
Python 3.11 veya üzeri bir ortamda:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
python -m pip install "skillstate-kit[mcp,http]"
|
|
11
|
+
skillstate demo
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Ardından kullanacağınız projenin klasöründe:
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
skillstate init --host codex --host claude-code --host antigravity --mcp
|
|
18
|
+
skillstate generate skills/qa/SKILL.md --install
|
|
19
|
+
skillstate validate qa-state
|
|
20
|
+
skillstate doctor --mcp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`skills/qa/SKILL.md` yerine kendi dosyanızı kullanın. Yalnızca kullandığınız host'ları seçebilirsiniz. `--mcp` opsiyoneldir; temel kullanım CLI üzerinden çalışır. MCP ayarları bu makineye ait Python/proje yollarını içerir.
|
|
24
|
+
|
|
25
|
+
## Otomatik üretim
|
|
26
|
+
|
|
27
|
+
Kurulumdan sonra agent'a “Generate skill state; bu skill'i durum yapısına dönüştür” diyebilirsiniz. Üretici kaynak envanterini hazırlayıp agent'ın önerdiği şemayı doğrular.
|
|
28
|
+
|
|
29
|
+
Doğrudan `generate`, yönergeleri koruyan sınırlı bir genel ilerleme şeması oluşturur. Alana özel dönüşüm için agent destekli `--prepare`/`--proposal` akışı veya yapılandırılmış `--base-url`/`--model` kullanılır. Terminal, IDE model hesabını otomatik kullanmaz.
|
|
30
|
+
|
|
31
|
+
## Çalıştırma ve devam
|
|
32
|
+
|
|
33
|
+
Üretilen skill, state açma, okuma, güncelleme, işlem sonucu kaydetme ve ortamlar arasında devretme adımlarını içerir. Python projeleri `SkillRuntime` ile bütün model/araç döngüsünü yönetebilir.
|
|
34
|
+
|
|
35
|
+
Native skill host'un konuşma geçmişini silmez. Makaledeki geçmiş taşımayan model girdisini kurmak için stateless adapter ile managed runtime kullanın.
|
|
36
|
+
|
|
37
|
+
`pending` veya `unknown` bir dış işlemin sonucunun belirsiz olduğunu gösterir. Tekrarlamadan önce dış sistemden sonucu kontrol edin ve açıkça uzlaştırın. Checkpoint dış dünyadaki işlemi geri almaz.
|
|
38
|
+
|
|
39
|
+
## Doğrulama
|
|
40
|
+
|
|
41
|
+
`skillstate demo` model hesabı gerektirmeyen kontrollü örnektir. `doctor --mcp` gerçek yerel MCP bağlantısı kurar. Bunlar bütün IDE sürümlerinin davranışını veya makalenin performans sonuçlarını doğrulamaz.
|
|
42
|
+
|
|
43
|
+
Ayrıntılar: [CLI](cli.md), [mimari](architecture.md), [ortam desteği](compatibility.md), [test matrisi](validation.md).
|