Skip to content

Commit ebd4956

Browse files
authored
rust(feature): agent skills, prompts, and documentation (#600)
1 parent 2d07ea6 commit ebd4956

42 files changed

Lines changed: 1982 additions & 28 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-setup.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Extra steps injected by cargo-dist into the build job (see
2+
# `github-build-setup` in dist-workspace.toml). sift_cli's build.rs runs
3+
# `mdbook build`, so mdbook must be on PATH before `dist build`.
4+
- name: Install mdbook
5+
uses: peaceiris/actions-mdbook@v2
6+
with:
7+
mdbook-version: '0.4.40'

.github/workflows/rust_ci.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ jobs:
6060
with:
6161
components: clippy, rustfmt
6262

63+
- name: Install mdbook
64+
uses: peaceiris/actions-mdbook@v2
65+
with:
66+
mdbook-version: "0.4.40"
67+
6368
- name: Run cargo check
6469
run: cargo check --all-features
6570

.github/workflows/sift_cli-v-release.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ jobs:
5656
env:
5757
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858
steps:
59-
- uses: actions/checkout@v4
59+
- uses: actions/checkout@v6
6060
with:
6161
persist-credentials: false
6262
submodules: recursive
6363
- name: Install dist
6464
# we specify bash to get pipefail; it guards against the `curl` command
6565
# failing. otherwise `sh` won't catch that `curl` returned non-0
6666
shell: bash
67-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.3/cargo-dist-installer.sh | sh"
67+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.31.0/cargo-dist-installer.sh | sh"
6868
- name: Cache dist
69-
uses: actions/upload-artifact@v4
69+
uses: actions/upload-artifact@v6
7070
with:
7171
name: cargo-dist-cache
7272
path: ~/.cargo/bin/dist
@@ -82,7 +82,7 @@ jobs:
8282
cat plan-dist-manifest.json
8383
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8484
- name: "Upload dist-manifest.json"
85-
uses: actions/upload-artifact@v4
85+
uses: actions/upload-artifact@v6
8686
with:
8787
name: artifacts-plan-dist-manifest
8888
path: plan-dist-manifest.json
@@ -116,7 +116,7 @@ jobs:
116116
- name: enable windows longpaths
117117
run: |
118118
git config --global core.longpaths true
119-
- uses: actions/checkout@v4
119+
- uses: actions/checkout@v6
120120
with:
121121
persist-credentials: false
122122
submodules: recursive
@@ -127,11 +127,15 @@ jobs:
127127
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
128128
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
129129
fi
130+
- name: "Install mdbook"
131+
uses: "peaceiris/actions-mdbook@v2"
132+
with:
133+
"mdbook-version": "0.4.40"
130134
- name: Install dist
131135
run: ${{ matrix.install_dist.run }}
132136
# Get the dist-manifest
133137
- name: Fetch local artifacts
134-
uses: actions/download-artifact@v4
138+
uses: actions/download-artifact@v7
135139
with:
136140
pattern: artifacts-*
137141
path: target/distrib/
@@ -158,7 +162,7 @@ jobs:
158162
159163
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
160164
- name: "Upload artifacts"
161-
uses: actions/upload-artifact@v4
165+
uses: actions/upload-artifact@v6
162166
with:
163167
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
164168
path: |
@@ -175,19 +179,19 @@ jobs:
175179
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
176180
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
177181
steps:
178-
- uses: actions/checkout@v4
182+
- uses: actions/checkout@v6
179183
with:
180184
persist-credentials: false
181185
submodules: recursive
182186
- name: Install cached dist
183-
uses: actions/download-artifact@v4
187+
uses: actions/download-artifact@v7
184188
with:
185189
name: cargo-dist-cache
186190
path: ~/.cargo/bin/
187191
- run: chmod +x ~/.cargo/bin/dist
188192
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
189193
- name: Fetch local artifacts
190-
uses: actions/download-artifact@v4
194+
uses: actions/download-artifact@v7
191195
with:
192196
pattern: artifacts-*
193197
path: target/distrib/
@@ -205,7 +209,7 @@ jobs:
205209
206210
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
207211
- name: "Upload artifacts"
208-
uses: actions/upload-artifact@v4
212+
uses: actions/upload-artifact@v6
209213
with:
210214
name: artifacts-build-global
211215
path: |
@@ -225,19 +229,19 @@ jobs:
225229
outputs:
226230
val: ${{ steps.host.outputs.manifest }}
227231
steps:
228-
- uses: actions/checkout@v4
232+
- uses: actions/checkout@v6
229233
with:
230234
persist-credentials: false
231235
submodules: recursive
232236
- name: Install cached dist
233-
uses: actions/download-artifact@v4
237+
uses: actions/download-artifact@v7
234238
with:
235239
name: cargo-dist-cache
236240
path: ~/.cargo/bin/
237241
- run: chmod +x ~/.cargo/bin/dist
238242
# Fetch artifacts from scratch-storage
239243
- name: Fetch artifacts
240-
uses: actions/download-artifact@v4
244+
uses: actions/download-artifact@v7
241245
with:
242246
pattern: artifacts-*
243247
path: target/distrib/
@@ -250,14 +254,14 @@ jobs:
250254
cat dist-manifest.json
251255
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
252256
- name: "Upload dist-manifest.json"
253-
uses: actions/upload-artifact@v4
257+
uses: actions/upload-artifact@v6
254258
with:
255259
# Overwrite the previous copy
256260
name: artifacts-dist-manifest
257261
path: dist-manifest.json
258262
# Create a GitHub Release while uploading all files to it
259263
- name: "Download GitHub Artifacts"
260-
uses: actions/download-artifact@v4
264+
uses: actions/download-artifact@v7
261265
with:
262266
pattern: artifacts-*
263267
path: artifacts
@@ -290,7 +294,7 @@ jobs:
290294
env:
291295
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
292296
steps:
293-
- uses: actions/checkout@v4
297+
- uses: actions/checkout@v6
294298
with:
295299
persist-credentials: false
296300
submodules: recursive

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,5 @@ cython_debug/
366366

367367

368368
rust/crates/**/target/
369+
rust/crates/sift_cli/assets/docs/book/**
370+
rust/crates/sift_cli/assets/docs/book-dev/**

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ arrow-array = "58.3.0"
3131
arrow-schema = "58.3.0"
3232
async-channel = "2.2"
3333
async-trait = "^0.1"
34+
axum = "0.8"
3435
mockall = "0.14.0"
3536
bytes = "1.11.1"
3637
bytesize = "2"
@@ -48,6 +49,7 @@ futures = { version = "0.3", default-features = false, features = ["alloc"] }
4849
futures-core = "0.3"
4950
hyper = { version = "1.8", features = ["server", "http1"] }
5051
hyper-util = { version = "0.1.20", features = ["service", "server", "tokio"] }
52+
include_dir = "0.7"
5153
indicatif = "0.18"
5254
indoc = "2.0"
5355
parquet = "58.3.0"
@@ -73,6 +75,7 @@ toml = "0.9"
7375
tonic = { version = "^0.14", features = ["gzip"] }
7476
tonic-prost = "^0.14"
7577
tower = "^0.5"
78+
tower-serve-static = "0.1"
7679
tracing = "0.1"
7780
tracing-appender = "0.2"
7881
tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }

dist-workspace.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ members = ["cargo:"]
44
# Config for 'dist'
55
[dist]
66
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
7-
cargo-dist-version = "0.30.3"
7+
cargo-dist-version = "0.31.0"
88
# CI backends to support
99
ci = "github"
1010
# A prefix git tags must include for dist to care about them
@@ -17,3 +17,6 @@ targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-
1717
install-path = "CARGO_HOME"
1818
# Whether to install an updater program
1919
install-updater = false
20+
# Extra CI steps injected into the build job before `dist build`.
21+
# sift_cli's build.rs invokes `mdbook build`, so mdbook must be on PATH.
22+
github-build-setup = "build-setup.yml"

makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
SHELL := /bin/zsh
22

3+
.PHONY: gen
34
gen:
45
bash scripts/gen.sh
56

7+
.PHONY: gen-go
68
gen-go:
79
bash scripts/gen.sh go
810

11+
.PHONY: gen-python
912
gen-python:
1013
bash scripts/gen.sh python
1114

15+
.PHONY: gen-rust
1216
gen-rust:
1317
bash scripts/gen.sh rust
1418

19+
.PHONY: sanitize
1520
sanitize:
1621
echo "Error: sanitize has been removed from this repo. Please see Confluence on proto updating."
1722
exit 1
1823

24+
.PHONY: git-hooks
1925
git-hooks:
2026
git config core.hooksPath .githooks
27+
28+
.PHONY: serve-cli-docs
29+
serve-cli-docs:
30+
mdbook serve ./rust/crates/sift_cli/assets/docs -d ./rust/crates/sift_cli/assets/docs/book-dev
31+
32+
.PHONY: build-cli-docs
33+
build-cli-docs:
34+
mdbook build ./rust/crates/sift_cli/assets/docs -d ./rust/crates/sift_cli/assets/docs/book-dev

rust/crates/sift_cli/CLAUDE.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# sift_cli — guidance for Claude
2+
3+
## Agent skill files
4+
5+
`sift-cli` ships two agent-facing instruction files and installs them with
6+
`sift-cli install agent-skills <agent>`:
7+
8+
- `assets/skills/claude-code/SKILL.md` — Claude Code skill. Has YAML
9+
frontmatter (`name`, `description`) and installs to the user's Claude skills
10+
directory.
11+
- `assets/skills/agents-md/AGENTS.md` — the open AGENTS.md standard (Codex,
12+
Cursor, Aider, Zed, Windsurf, Amp, Jules, Factory, RooCode). No frontmatter;
13+
installs at the project root.
14+
15+
Both are embedded into the binary at build time via `include_str!` in
16+
`src/cmd/install/agent.rs`. Editing the files changes what the CLI installs, so
17+
rebuild after any change.
18+
19+
## Keeping the two files in lockstep
20+
21+
The two files exist because Claude Code and the AGENTS.md ecosystem expect
22+
different on-disk formats. Their **content is the same** and must not drift.
23+
24+
The contract:
25+
26+
1. **The body is shared.** Everything from the `# Sift toolbox` heading to the
27+
end of file must be byte-for-byte identical between `SKILL.md` and
28+
`AGENTS.md`.
29+
2. **Only the headers differ.** `SKILL.md` carries YAML frontmatter above the
30+
body. `AGENTS.md` has no frontmatter. Both carry the lockstep HTML comment
31+
at the top.
32+
3. **Edit both in the same change.** When you add, remove, or reword anything
33+
in the body, apply the identical edit to the other file in the same commit.
34+
Never update one alone.
35+
4. **The frontmatter `description` tracks the body.** When you change which
36+
tasks or tools the skill covers, update the `description` in `SKILL.md` so
37+
its trigger phrases still match the body.
38+
39+
Verify the bodies match before committing:
40+
41+
```sh
42+
cd rust/crates/sift_cli/assets/skills
43+
diff <(awk '/^# Sift toolbox/{f=1} f' claude-code/SKILL.md) \
44+
<(awk '/^# Sift toolbox/{f=1} f' agents-md/AGENTS.md)
45+
```
46+
47+
No output means they are in sync. Any diff must be reconciled before the change
48+
is done.
49+
50+
## Updating the skill content
51+
52+
Keep the body accurate to the actual tooling. When you change the CLI's
53+
commands, the MCP server's tools, or the recommended workflow, update the skill
54+
body to match. In particular:
55+
56+
- The MCP tool list (`list_assets`, `list_runs`, `list_channels`, `get_data`,
57+
`sql`, `upload_dataset`) must mirror the tools in the `sift_mcp` crate. If a
58+
tool is added or removed there, update both skill files here.
59+
- The `sift-cli` subcommand list must mirror `src/cli/mod.rs`. If you add an
60+
import format or a new subcommand, reflect it in the body.
61+
- Keep the tool preference order (MCP → `sift-cli` → REST/cURL → Python)
62+
intact unless the product guidance itself changes.
63+
- Keep `sift_client` as the recommended Python module; `sift_py` is deprecated
64+
and stays a last resort.
65+
66+
Write in direct voice and keep it concise. The body is read by other agents
67+
under context pressure, so every line should change what the agent does.

rust/crates/sift_cli/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ tokio = { workspace = true, features = ["full", "net", "time"] }
4040
tokio-stream = { workspace = true }
4141
toml = { workspace = true }
4242
zip = { workspace = true }
43+
axum.workspace = true
44+
tower-serve-static.workspace = true
45+
include_dir.workspace = true
4346

4447
[dev-dependencies]
4548
indoc = { workspace = true }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[book]
2+
title = "Sift CLI"
3+
authors = ["solidiquis"]
4+
language = "en"
5+
description = "Guide to installing, configuring, and using the Sift CLI."
6+
7+
[output.html]
8+
default-theme = "navy"
9+
preferred-dark-theme = "navy"
10+
git-repository-url = "https://github.com/sift-stack/sift"
11+
edit-url-template = "https://github.com/sift-stack/sift/edit/main/rust/crates/sift_cli/assets/docs/{path}"
12+
13+
[output.html.fold]
14+
enable = true
15+
level = 1
16+
17+
[output.html.search]
18+
enable = true

0 commit comments

Comments
 (0)