Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
5b5f153
Work out once whether a person, a coding agent or CI runs string
asavor Nov 20, 2026
f1aa517
Show update notices only to a person at a terminal
asavor Nov 20, 2026
2965b31
Say in the help and README how string finds a coding agent
asavor Nov 20, 2026
0a7ced0
Say in each request to String how string runs and which agent runs it
asavor Nov 20, 2026
5821244
Say in the help and README what each request tells String
asavor Nov 20, 2026
c43831d
Send the download host the same User-Agent as requests to String
asavor Nov 20, 2026
a6e36d4
Open a sign-in link in the browser only for a person at a terminal
asavor Nov 20, 2026
bd8003c
Wait for a person only when one is at the terminal
asavor Nov 20, 2026
744b748
Test that switches before update start no update check
asavor Nov 20, 2026
30068ae
Give each request to String a time limit
asavor Nov 20, 2026
6dd38e5
Bound sitemap --wait and say how to resume it
asavor Nov 20, 2026
4800d6b
Keep a sign-in's code when its server doesn't answer in time
asavor Nov 20, 2026
7c7b02c
Merge branch 'request-time-limits' into bounded-sitemap-wait
asavor Nov 20, 2026
e80c467
Bound login --poll and trial claim --poll and say how to resume them
asavor Nov 20, 2026
0c5815a
Say in the help and README how --poll waits and resumes
asavor Nov 20, 2026
60bea10
Say what Ctrl-C leaves behind, then end as an interrupted program
asavor Nov 20, 2026
b47aa9a
Say in the help and README what Ctrl-C does
asavor Nov 20, 2026
87502af
Give every command its own help, and take -h anywhere
asavor Nov 20, 2026
c13eb52
Say in the help and README how to get a command's help and the version
asavor Nov 20, 2026
5389a48
Suggest the command or flag meant, and take every spelling of a flag
asavor Nov 20, 2026
5ee2bc3
Say in the help and README which spellings work and what a typo gets
asavor Nov 20, 2026
534cf9b
Fetch a bare domain over https, and say when https:// was added
asavor Nov 20, 2026
aa7a92c
Say in the help and README that a bare domain works
asavor Nov 20, 2026
c147556
Add help topics, and start the help for all of string with lines for …
asavor Nov 20, 2026
f63fcff
Say in the help and README which help topics there are
asavor Nov 20, 2026
20d9042
Say in every JSON error its exit code, whether to retry, and the step…
asavor Nov 20, 2026
9798023
Say in the help and README what each JSON error field means
asavor Nov 20, 2026
7e0bb83
Write each error as error: and a sentence, without raw bodies
asavor Nov 20, 2026
5231315
Say in the help and README how an error reads
asavor Nov 20, 2026
952b5fb
Add --errors json, and say ahead what changes for fetch in 0.4
asavor Nov 20, 2026
7ceeaaa
Say in the help and README what --errors json does and what changes i…
asavor Nov 20, 2026
755cda4
Say a large page's size first, and what -o saved, with an outline
asavor Nov 20, 2026
e65ca51
Say in the help and README what -o says, what a large page says, and -q
asavor Nov 20, 2026
767931a
Read a long page in parts with --max-tokens, from one fetch
asavor Nov 20, 2026
69d23c2
Say in the help and README how to read a page in parts
asavor Nov 20, 2026
35d20ad
Check the key with String in whoami, and keep --offline local
asavor Nov 20, 2026
ef1f7a7
Say in the help and README that whoami checks the key
asavor Nov 20, 2026
8050af1
Refuse a JSON-only field with another format, and read --body-file - …
asavor Nov 20, 2026
2d88cfe
Say in the help and README how --body-file - and JSON-only fields work
asavor Nov 20, 2026
05e44f6
Keep a page from taking over a person's terminal, and refuse binary t…
asavor Nov 20, 2026
96cae2f
Say in the help and README what a person's terminal is spared
asavor Nov 20, 2026
9d0af97
Put the skill where agents read it, and add string skill
asavor Nov 20, 2026
dbdeb69
Rewrite the string-cli skill for 0.3, in 149 lines
asavor Nov 20, 2026
260e033
Say in the help and README where init puts the skill, and what string…
asavor Nov 20, 2026
72f00be
Merge main into skill-dirs
asavor Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,28 @@ String uses them to tell people, scripts, CI and each agent apart in its own req

## Agent skills

`skills/string-cli` is an [Agent Skills](https://agentskills.io) skill that teaches a coding agent the `string` commands. The native binary carries it, and `string init` installs it into `~/.agents/skills` (read by Codex and others) and into every agent it finds on the machine: Claude Code, Cursor, Gemini CLI, OpenCode, GitHub Copilot, Windsurf, Goose, Droid, Kiro CLI, Qwen Code, Grok Build, OpenClaw and Hermes Agent. Run it again after an upgrade to update the skill.
`skills/string-cli` is an [Agent Skills](https://agentskills.io) skill that teaches a coding agent the `string` commands: keyless first, big pages to a file or in parts, exit codes and `next_commands`, and what never to spend without asking. The native binary carries it, and `string skill` prints it, so an agent can read it without installing anything.

The first command of a new release also rewrites the skill wherever it is already installed, however `string` was installed, and never installs it anywhere new.
`string init` installs it in two places that between them reach almost every coding agent:

- `~/.agents/skills`, which Codex, Cursor, Gemini CLI, OpenCode, GitHub Copilot, Goose, Droid and others read;
- `~/.claude/skills`, for Claude Code, when it is on the machine (under `$CLAUDE_CONFIG_DIR` when that is set).

An agent found on the machine that reads neither, such as Windsurf, Kiro CLI, Qwen Code, Grok Build, OpenClaw or Hermes Agent, also gets a copy in its own directory. Releases before 0.3 put a copy in each agent's directory. Gemini CLI reads both `~/.gemini/skills` and `~/.agents/skills` and warns of a skill conflict when it finds the skill twice, so `string init` removes its copy in `~/.gemini/skills` and says so. It removes only a plain copy as `string init` wrote it: a directory, not a link, with just the skill's `SKILL.md`. Anything else there stays, and init says why. The older copies for other agents stay where they are.

`--agent NAME` installs in exactly the agents it names, each in its own directory, and touches nothing else. That covers an agent version too old to read `~/.agents/skills`.

```bash
string init # the shared directory and every agent found
string init --agent claude-code,codex # only these
string init # ~/.agents/skills, ~/.claude/skills, and agents that read neither
string init --agent claude-code,codex # only these, each in its own directory
string init --no-login # without signing in, even at a terminal
string skill # print the skill
string skill --path # list the installed copies
npx skills add usestring/cli # the same skill through the skills installer
```

The first command of a new release also rewrites the skill wherever it is already installed, however `string` was installed, and never installs it anywhere new. To move it where this release puts it, run `string init` again.

`string init` also adds String's [hosted MCP server](https://docs.usestring.ai/mcp/remote) to Claude Code and Codex as `string`, unless the server is already there or another server has that name. An entry for it under another name, such as `string-web-access`, stays as it is, and init prints that name for you to use in place of `string`. Both sign in to it with String, so no key goes into their settings: run `claude mcp login string` or `codex mcp login string` and choose the key each may use. For the other agents it found, init prints the setup page instead: most connect with an API key, which init never copies into another program's settings, and OpenCode signs in only from v2. `--no-mcp` skips this step.

## Project and releases
Expand Down
24 changes: 22 additions & 2 deletions cmd/string/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,30 @@ var commandDocs = map[string]commandDoc{
"exit 0 ok, whether or not the sign-in finishes · 2 bad input",
},
cost: "Free.",
flags: ` --agent NAME[,NAME...] only these agents: claude-code, codex, cursor,
gemini-cli or opencode
flags: ` --agent NAME[,NAME...] only these agents, each in its own skills directory,
such as claude-code, codex, cursor or gemini-cli
--no-mcp don't add String's MCP server to Claude Code and Codex
--no-login skip the sign-in
--browser sign in as string login --browser does
--device-name NAME the machine's name in the new key's name
`,
more: "https://github.com/usestring/cli#agent-skills",
},
"skill": {
summary: "print the string-cli skill, the guide for coding agents",
usage: []string{"string skill [--path]"},
examples: []string{
"string skill the guide, to read or to save anywhere",
"string skill --path where it is installed",
},
returns: []string{
"stdout the skill's SKILL.md, the one this release carries; with --path,",
" the SKILL.md of each copy in an agent's skills directory, one a line",
"exit 0 ok · 2 bad input",
},
cost: "Free, and it sends no request.",
flags: ` --path list the installed copies instead: the SKILL.md in
each agent's skills directory that has the skill
`,
more: "https://github.com/usestring/cli#agent-skills",
},
Expand Down Expand Up @@ -606,6 +624,8 @@ Ways that work well:
--json errors as one JSON object
string COMMAND --help one command's examples, output, exit
codes, cost and flags
string skill the whole guide for agents, the skill
string init installs

Learn more: https://github.com/usestring/cli#coding-agents
`,
Expand Down
154 changes: 134 additions & 20 deletions cmd/string/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ const (
)

// agent is a coding agent that loads skills from a directory under the
// user's home. The skill goes to an agent only when its config directory
// exists, unless --agent names it.
// user's home. An agent counts as found on this machine when its config
// directory exists.
type agent struct {
name string
label string
config func(home string, env func(string) (string, bool)) string
// shared is true for an agent that also reads ~/.agents/skills. string
// init puts the skill there for all of them, and in such an agent's own
// directory only when --agent names it, since an agent that reads both
// may see two copies: Gemini CLI then warns of a skill conflict.
shared bool
}

func under(parts ...string) func(string, func(string) (string, bool)) string {
Expand All @@ -63,29 +68,55 @@ func underConfig(name string) func(string, func(string) (string, bool)) string {
}
}

// sharedAgent is ~/.agents/skills, which Codex and several other agents
// read. It is always installed, so every agent that reads it has the skill.
var sharedAgent = agent{"codex", "Codex and agents that read ~/.agents/skills", under(".agents")}
// sharedAgent is ~/.agents/skills, which Codex and most other agents read.
// It is always installed, so every agent that reads it has the skill.
var sharedAgent = agent{"codex", "Codex and agents that read ~/.agents/skills", under(".agents"), true}

// agents are the agents init knows besides Codex. Claude Code reads only
// ~/.claude/skills. For each other agent that isn't shared, nothing shows it
// reads ~/.agents/skills, so it gets a copy of its own.
var agents = []agent{
{"claude-code", "Claude Code", func(home string, env func(string) (string, bool)) string {
if dir, ok := env("CLAUDE_CONFIG_DIR"); ok && dir != "" {
return dir
}
return filepath.Join(home, ".claude")
}},
{"cursor", "Cursor", under(".cursor")},
{"gemini-cli", "Gemini CLI", under(".gemini")},
{"opencode", "OpenCode", underConfig("opencode")},
{"github-copilot", "GitHub Copilot", under(".copilot")},
{"windsurf", "Windsurf", under(".codeium", "windsurf")},
{"goose", "Goose", underConfig("goose")},
{"droid", "Droid", under(".factory")},
{"kiro-cli", "Kiro CLI", under(".kiro")},
{"qwen-code", "Qwen Code", under(".qwen")},
{"grok", "Grok Build", under(".grok")},
{"openclaw", "OpenClaw", under(".openclaw")},
{"hermes-agent", "Hermes Agent", under(".hermes")},
}, false},
{"cursor", "Cursor", under(".cursor"), true},
{"gemini-cli", "Gemini CLI", under(".gemini"), true},
{"opencode", "OpenCode", underConfig("opencode"), true},
{"github-copilot", "GitHub Copilot", under(".copilot"), true},
{"windsurf", "Windsurf", under(".codeium", "windsurf"), false},
{"goose", "Goose", underConfig("goose"), true},
{"droid", "Droid", under(".factory"), true},
{"kiro-cli", "Kiro CLI", under(".kiro"), false},
{"qwen-code", "Qwen Code", under(".qwen"), false},
{"grok", "Grok Build", under(".grok"), false},
{"openclaw", "OpenClaw", under(".openclaw"), false},
{"hermes-agent", "Hermes Agent", under(".hermes"), false},
}

// skillName is the skill's directory in skills.FS and in each agent's skills
// directory.
const skillName = "string-cli"

// skillsDir is where agent a reads skills from.
func skillsDir(a agent, home string, env func(string) (string, bool)) string {
return filepath.Join(a.config(home, env), "skills")
}

// skillCopies lists the directories under the agents' skills directories that
// hold the skill, the shared one first. Two agents that read one directory
// give it once.
func skillCopies(home string, env func(string) (string, bool)) []string {
var dirs []string
for _, a := range append([]agent{sharedAgent}, agents...) {
dir := filepath.Join(skillsDir(a, home, env), skillName)
if info, err := os.Stat(dir); err == nil && info.IsDir() && !slices.Contains(dirs, dir) {
dirs = append(dirs, dir)
}
}
return dirs
}

func homeDir(env func(string) (string, bool)) (string, error) {
Expand Down Expand Up @@ -157,13 +188,34 @@ func initCommand(list []string, rt runtime) error {
if err != nil {
return usage(err)
}
// Without --agent, an agent found here that reads ~/.agents/skills takes
// the skill from there.
var sharing []string
for _, a := range chosen {
if names == "" && a.shared && a.name != sharedAgent.name {
sharing = append(sharing, a.label)
}
}
var report strings.Builder
for _, a := range chosen {
dir := filepath.Join(a.config(home, rt.env), "skills")
if slices.Contains(sharing, a.label) {
continue
}
dir := skillsDir(a, home, rt.env)
if err := installSkills(dir); err != nil {
return err
}
fmt.Fprintf(&report, "Installed the string-cli skill for %s in %s\n", a.label, filepath.Join(dir, "string-cli"))
fmt.Fprintf(&report, "Installed the string-cli skill for %s in %s\n", a.label, filepath.Join(dir, skillName))
if a.name == sharedAgent.name && len(sharing) > 0 {
verb := "reads"
if len(sharing) > 1 {
verb = "read"
}
fmt.Fprintf(&report, "%s %s it there too.\n", joinAnd(sharing), verb)
}
}
if names == "" {
removeGeminiCopy(&report, home, rt.env)
}
if !parsed.switches["no-mcp"] {
addMCP(&report, chosen, home, rt)
Expand Down Expand Up @@ -246,6 +298,68 @@ func pathHint(rt runtime) string {
return "This copy is at:\n " + path + "\nAdd its directory to your PATH, or move the binary into a directory that is already on it."
}

// joinAnd lists words as a sentence does: a, b and c.
func joinAnd(words []string) string {
if len(words) < 2 {
return strings.Join(words, "")
}
return strings.Join(words[:len(words)-1], ", ") + " and " + words[len(words)-1]
}

// removeGeminiCopy removes the skill from Gemini CLI's own skills directory,
// where releases before 0.3 put it. Gemini CLI reads ~/.agents/skills too,
// and warns of a skill conflict at every start while both copies are there.
// Only a copy as string init writes it goes. Anything else there stays, and
// init says why.
func removeGeminiCopy(report *strings.Builder, home string, env func(string) (string, bool)) {
gemini := agents[slices.IndexFunc(agents, func(a agent) bool { return a.name == "gemini-cli" })]
dir := filepath.Join(skillsDir(gemini, home, env), skillName)
info, err := os.Lstat(dir)
if err != nil {
return
}
if _, err := os.Stat(filepath.Join(dir, "SKILL.md")); err != nil {
// No skill, so nothing for Gemini CLI to warn about.
return
}
if !initWrote(dir, info) {
fmt.Fprintf(report, "Left %s as it is: it isn't a plain copy from string init, so it may be yours. Gemini CLI warns of a skill conflict while it and ~/.agents/skills/%s are both there.\n", dir, skillName)
return
}
if err := os.RemoveAll(dir); err != nil {
fmt.Fprintf(report, "Could not remove the older copy in %s, which makes Gemini CLI warn of a skill conflict: %v\n", dir, err)
return
}
fmt.Fprintf(report, "Removed the older copy in %s, since Gemini CLI reads ~/.agents/skills and warns of a skill conflict when it finds two. For a Gemini CLI too old to read ~/.agents/skills, string init --agent gemini-cli puts it back.\n", dir)
}

// initWrote reports whether dir, which info describes without following a
// link, holds a copy of the skill as string init writes one: a directory,
// not a link to one, with no file but the skill's own, and a SKILL.md that
// names the skill.
func initWrote(dir string, info fs.FileInfo) bool {
if !info.IsDir() {
return false
}
entries, err := os.ReadDir(dir)
if err != nil {
return false
}
for _, entry := range entries {
embedded, err := fs.Stat(skills.FS, skillName+"/"+entry.Name())
if !entry.Type().IsRegular() || err != nil || embedded.IsDir() {
return false
}
}
data, err := os.ReadFile(filepath.Join(dir, "SKILL.md"))
if err != nil {
return false
}
front, ok := strings.CutPrefix(strings.ReplaceAll(string(data), "\r\n", "\n"), "---\n")
front, _, closed := strings.Cut(front, "\n---\n")
return ok && closed && slices.Contains(strings.Split(front, "\n"), "name: "+skillName)
}

// installSkills copies every embedded skill into dir, replacing an older copy.
func installSkills(dir string) error {
return fs.WalkDir(skills.FS, ".", func(path string, entry fs.DirEntry, err error) error {
Expand Down
17 changes: 14 additions & 3 deletions cmd/string/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Usage:
[--device-name NAME]
string logout
string whoami
string skill [--path]
string trial
string trial claim (--email ADDRESS [--no-wait] | --poll)
string status
Expand Down Expand Up @@ -180,9 +181,14 @@ Without a key, fetch takes --format and --executeJS, and search takes
--language, --dateRange, --sortBy, --safeSearch, --autocorrect and --verbatim.
Other fields, request and sitemap need a key. What is left of the allowance is
printed to stderr after each keyless call.
init installs the string-cli skill for the coding agents found on this machine,
adds String's MCP server to Claude Code and Codex unless --no-mcp is given,
then signs in when no key is set; --browser picks login --browser's sign-in.
init installs the string-cli skill in ~/.agents/skills, which Codex, Cursor,
Gemini CLI and most other coding agents read, and in ~/.claude/skills when
Claude Code is on this machine. An agent found here that reads neither gets a
copy of its own, and --agent NAME puts it in NAME's own directory instead.
init removes the copy releases before 0.3 put in ~/.gemini/skills, which made
Gemini CLI warn of a skill conflict, and says so. init then adds String's MCP
server to Claude Code and Codex unless --no-mcp is given, and signs in when no
key is set; --browser picks login --browser's sign-in.
A person at a terminal waits for the approval there. Under an agent, with
--no-input, or when its output is captured outside CI, it prints the link and
code as login does. --no-login skips the sign-in, and init exits 0 whether or
Expand All @@ -207,6 +213,9 @@ the new key's name, which your organization sees on its API keys page.
--with-token send no name.
STRING_API_KEY wins over a saved key. whoami says which one is in use and
checks it with String, which costs nothing; whoami --offline doesn't check.
skill prints the string-cli skill this release carries, the guide for coding
agents, so an agent can read it without installing it; skill --path lists the
copies installed in the agents' skills directories.
trial registers an agent for a trial key with no account: after a few seconds'
proof of work, it saves a key with a small balance that doesn't expire, and a
claim token a person can use to adopt the agent onto their account.
Expand Down Expand Up @@ -1235,6 +1244,8 @@ func execute(list []string, rt runtime) error {
return logoutCommand(list[1:], rt)
case "whoami":
return whoamiCommand(list[1:], rt)
case "skill":
return skillCommand(list[1:], rt)
case "integrations":
return integrationsCommand(list[1:], rt)
case "trial":
Expand Down
53 changes: 53 additions & 0 deletions cmd/string/skill.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package main

import (
"errors"
"fmt"
"io/fs"
"os"
"path/filepath"
"strings"

"github.com/usestring/cli/skills"
)

// skillCommand prints the string-cli skill that this release carries, so an
// agent can read it without installing it, or with --path, the SKILL.md of
// each copy installed in an agent's skills directory.
func skillCommand(list []string, rt runtime) error {
parsed, err := parse(list, spec{switches: []string{"path"}})
if err != nil {
return usage(err)
}
if parsed.help {
return write(rt.stdout, []byte(helpFor("skill")))
}
if err := expectPositionals(parsed.positionals, 0, "string skill [--path]"); err != nil {
return usage(err)
}
if _, ok := parsed.value("input"); ok {
return usage(errors.New("--input does not apply to skill"))
}
if !parsed.switches["path"] {
data, err := fs.ReadFile(skills.FS, skillName+"/SKILL.md")
if err != nil {
return err
}
return write(rt.stdout, data)
}
home, err := homeDir(rt.env)
if err != nil {
return err
}
var paths strings.Builder
for _, dir := range skillCopies(home, rt.env) {
path := filepath.Join(dir, "SKILL.md")
if info, err := os.Stat(path); err == nil && info.Mode().IsRegular() {
paths.WriteString(path + "\n")
}
}
if paths.Len() == 0 && !rt.quiet {
fmt.Fprintln(rt.stderr, "The string-cli skill isn't installed for any agent. string init installs it, and string skill prints it.")
}
return write(rt.stdout, []byte(paths.String()))
}
Loading
Loading