@glyphs-ai/glyph 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lang Cheng
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.
package/README.md ADDED
@@ -0,0 +1,245 @@
1
+ # Glyph
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@glyphs-ai/glyph.svg)](https://www.npmjs.com/package/@glyphs-ai/glyph)
4
+ [![CI](https://github.com/glyphs-ai/glyph/actions/workflows/ci.yml/badge.svg)](https://github.com/glyphs-ai/glyph/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
6
+
7
+ A glyph is the visible form of an idea. In typography, the *character* is
8
+ abstract; the *glyph* is how that character is rendered in a particular
9
+ font, weight, and context. The character is the meaning; glyphs are the
10
+ forms it takes.
11
+
12
+ We believe intelligence works the same way. Intent, reasoning, memory,
13
+ and collaboration are the abstractions. What we actually touch — models,
14
+ prompts, agents, tools, workflows — are their current glyphs. Those
15
+ forms will keep changing. The abstractions beneath them won't.
16
+
17
+ Glyph the project is a workbench for exploring, composing, and evolving
18
+ those forms, while staying independent of any particular implementation
19
+ or era of AI. The future of intelligence is unlikely to be written in
20
+ today's language — we're still learning its alphabet.
21
+
22
+ > **Pre-1.0 — APIs may change.** Targeted at solo developers and small teams
23
+ > running glyph against their own machine; multi-user deployment is not yet
24
+ > a goal.
25
+
26
+ ## Quickstart
27
+
28
+ ```sh
29
+ npm install -g @glyphs-ai/glyph
30
+ glyph start
31
+ ```
32
+
33
+ Then open <http://127.0.0.1:8787> in your browser. `glyph start` runs the
34
+ server as a detached background process so the terminal is free; the rest
35
+ of the lifecycle is `glyph stop`, `glyph restart`, `glyph status`,
36
+ and `glyph logs -f`. Run `glyph help` (or just `glyph`) for the full
37
+ command tree, or `glyph serve` to keep it in the foreground (the legacy
38
+ behaviour, useful for `tmux` panes or `systemd` units).
39
+
40
+ The first time you run `glyph`, the dashboard's landing page is empty.
41
+ Walk through:
42
+
43
+ 1. **Add a workspace** — give it a display name. Optionally pick a directory
44
+ on disk; if you don't, glyph creates one under
45
+ `$GLYPH_HOME/workspaces/<uuid>/` so the workspace id and the on-disk
46
+ directory share the same name. Either way glyph writes
47
+ a `workspace.db` SQLite file plus `sessions/` and `tasks/` subdirs
48
+ inside; existing files in a user-supplied directory are left alone.
49
+ 2. **Install an agent** in the Catalog tab — point at any directory containing
50
+ an `AGENTS.md` (a [Claude-style agent](https://www.claude.com/news/agent-skills);
51
+ any directory with valid frontmatter works). Skills + MCPs the agent
52
+ depends on go in the same way.
53
+ 3. **Dispatch a task** in the Tasks tab — pick the agent, write a brief
54
+ (one-line goal) and optional details, click *Dispatch*. The agent runs
55
+ unattended in a new sandbox under
56
+ `tasks/<id>/`; the dashboard shows the live event stream and folds the
57
+ exit into a final `succeeded` / `failed` / `cancelled` status.
58
+ 4. **Or open a session** in the Sessions tab — interactive workdir; glyph
59
+ bakes the agent into it and gives you the exact `copilot` invocation to
60
+ run yourself.
61
+
62
+ ## Configuration
63
+
64
+ All configuration is via environment variables; no config file. Defaults
65
+ work for single-machine use; only set what you need to override.
66
+
67
+ | Env var | Default | Purpose |
68
+ | -------------------- | -------------- | -------------------------------------------------------------------------------------------------------- |
69
+ | `PORT` | `8787` | HTTP listen port. |
70
+ | `GLYPH_HOST` | `127.0.0.1` | Bind address. glyph is **loopback-only** — non-loopback values are refused at startup. For remote access, expose the loopback socket through SSH port-forward, a reverse proxy (mTLS / OIDC), or a mesh VPN (Tailscale, …). |
71
+ | `GLYPH_HOME` | `~/.glyph` | Where the global SQLite registry (`global.db`) lives. |
72
+ | `GLYPH_LOG_LEVEL` | `info` | `debug` / `info` / `warn` / `error`. |
73
+ | `GLYPH_LOG_FORMAT` | `pretty` | `pretty` (dev terminal) or `json` (log aggregators). |
74
+ | `GLYPH_STATIC_DIR` | next to bundle | Override the dashboard SPA location. Useful when running from a non-bundle layout. |
75
+
76
+ Pass `--no-serve-static` to run API-only (the dashboard SPA is bundled in
77
+ the npm package by default; serving it from the same port is the only
78
+ deployment mode that makes sense for the local-first model).
79
+
80
+ ## Filesystem contract
81
+
82
+ Everything glyph writes under `<GLYPH_HOME>` (default `~/.glyph`)
83
+ and per-workspace internals is **server-internal state**. The layout —
84
+ file names, JSON shapes, SQLite schemas, sidecar files — is implementation
85
+ detail and may change between versions. Reading these files for inspection
86
+ is fine; **anything else (writes, hand-edits, `rm`) is unsupported and
87
+ may be detected as corruption.**
88
+
89
+ For the path-by-path layout (what glyph owns vs the agent vs the
90
+ runtime adapter) and the rationale for keeping clients out of
91
+ `<GLYPH_HOME>/`, see [`docs/architecture.md` →
92
+ Filesystem contract](./docs/architecture.md#filesystem-contract).
93
+
94
+ ## CLI
95
+
96
+ After `npm install -g @glyphs-ai/glyph` the `glyph` binary exposes
97
+ two layers of commands:
98
+
99
+ ### Lifecycle (talk to the local process)
100
+
101
+ | Command | Behaviour |
102
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
103
+ | `glyph` | Print top-level help (alias for `glyph help`). |
104
+ | `glyph help [c]` | Top-level help, or per-subcommand help when `c` is given. |
105
+ | `glyph serve` | Run the server in the foreground — current dev behaviour. Honours every env var in the *Configuration* table; flags override env. |
106
+ | `glyph start` | Spawn the server as a detached background process. Records pid + port in `<GLYPH_HOME>/runtime.json`. Idempotent. |
107
+ | `glyph stop` | SIGTERM the recorded pid, wait for graceful shutdown (escalates to SIGKILL after 30 s), then delete `runtime.json`. Idempotent. *Windows note:* `process.kill` maps to `TerminateProcess` — there is no graceful equivalent on Windows; the server's atomic-write persistence keeps state consistent regardless. |
108
+ | `glyph restart` | `stop` then `start` with the same flags. |
109
+ | `glyph status` | Print one-line health summary. Exit codes: `0` running + healthy, `3` not running, `4` running but `/api/health` not responding. `--json` for scripts. |
110
+ | `glyph logs` | Cat the rolling server log under `<GLYPH_HOME>/logs/`. `-f` follows the file as it grows (Ctrl-C to stop). |
111
+
112
+ ### API client (talk to a running server)
113
+
114
+ 65 typed routes — wrapped 1:1 by the CLI's `client.call(...)` surface;
115
+ the typed manifest in `packages/contracts/src/routes.ts` is the single
116
+ source of truth that both the server registers handlers against and
117
+ the CLI builds typed calls from. Adding a route on either side
118
+ without updating the other fails CI.
119
+
120
+ ```sh
121
+ # server connection (default: http://127.0.0.1:8787, picked up from
122
+ # `runtime.json` when `glyph start` has run)
123
+ glyph health
124
+ glyph config --json
125
+ glyph runtime list
126
+
127
+ # workspaces
128
+ glyph workspace list
129
+ glyph workspace add --name "Sandbox" --workdir ~/code/sandbox
130
+ export GLYPH_WORKSPACE=<id> # required for workspace-scoped commands
131
+ glyph workspace show <id>
132
+ glyph workspace rm <id> --purge
133
+
134
+ # sessions and tasks (workspace-scoped; pass --workspace <id> to override the env above)
135
+ glyph session new --agent writer
136
+ glyph session list --agent writer --json
137
+ glyph task dispatch --agent triage --brief "Scan recent issues"
138
+ glyph task list --status running,succeeded
139
+ glyph task events <tid> # one-shot dump of the runtime's NDJSON log
140
+ glyph task activity <tid> # runtime-parsed activity timeline (JSON)
141
+
142
+ # catalog
143
+ glyph catalog overview
144
+ glyph catalog skill list
145
+ glyph catalog skill install --file /abs/path/to/skill
146
+ glyph catalog agent install --url https://github.com/glyphs-ai/glyph/tree/main/first-party/agents/engineer
147
+ glyph catalog mcp install --url https://github.com/glyphs-ai/glyph/tree/main/first-party/mcps/example.json
148
+ ```
149
+
150
+ Common flags on every API command:
151
+
152
+ - `--server <url>` — overrides `GLYPH_SERVER` and `runtime.json`. Defaults to `http://127.0.0.1:8787`.
153
+ - `--workspace <id>` — workspace-scoped commands. Overrides `GLYPH_WORKSPACE` and the server's `currentWorkspace`.
154
+ - `--output <fmt>` / `--json` — `table` (human-friendly default) or `json` (for scripting).
155
+
156
+ Exit codes: `0` success, `1` generic error, `2` usage error, `3` server unreachable, `4` server returned a 4xx/5xx.
157
+
158
+ ## Where this sits
159
+
160
+ Glyph does not invent a new agent format — it adopts the
161
+ [MetaAgents](https://github.com/metaagents-ai/metaagents) Layer-0 spec where
162
+ agents are markdown files (`AGENTS.md`) with YAML frontmatter, skills are
163
+ markdown files (`SKILL.md`) with YAML frontmatter, and MCPs are JSON config
164
+ blobs. What glyph adds:
165
+
166
+ - **A dependency-aware catalog** — agents declare which skills + MCPs they
167
+ need; glyph topologically resolves them, blocks cycles, and refuses to
168
+ uninstall something another entry depends on.
169
+ - **A workspace abstraction** — multiple isolated projects on one machine;
170
+ each picks its own agent set without polluting the others.
171
+ - **Runtime adapters** — first-class support for the
172
+ [GitHub Copilot CLI](https://github.com/github/gh-copilot) today; the same
173
+ surface lets future runtimes (Gemini, Claude Code, …) drop in.
174
+ - **Three execution modes** — interactive `session`, one-shot `task`, and
175
+ multi-task `workflow` (a DAG of sessions and tasks coordinated by a
176
+ long-running coordinator agent). All three persist across server
177
+ restarts and share a structured `running → succeeded/failed/cancelled`
178
+ lifecycle.
179
+
180
+ ## Architecture
181
+
182
+ The repo is a [pnpm](https://pnpm.io/workspaces) monorepo of 14 small
183
+ TypeScript packages with a strict layering: pure value types at the bottom,
184
+ file-system primitives next, entity managers above (workspace / catalog /
185
+ session / task / workflow), then the runtime adapter, then the HTTP server,
186
+ then the React dashboard. See [`docs/architecture.md`](./docs/architecture.md)
187
+ for the design contract — repository pattern, atomic-write seam, REST URL
188
+ scheme, and the rationale behind the package boundaries.
189
+
190
+ The conceptual model — how we think about agentic systems and why
191
+ glyph is shaped the way it is — lives in the **paper
192
+ [*What we believe about agentic systems*](https://glyphs-ai.github.io/glyph/)**.
193
+ It's a short read; if its premises resonate with you, the rest of the
194
+ codebase will make sense more quickly.
195
+
196
+ Each package's own README documents its public API surface; the most
197
+ important ones for downstream consumers are
198
+ [`@glyphs-ai/catalog`](./packages/catalog),
199
+ [`@glyphs-ai/workspace`](./packages/workspace),
200
+ [`@glyphs-ai/task`](./packages/task),
201
+ [`@glyphs-ai/session`](./packages/session),
202
+ [`@glyphs-ai/workflow`](./packages/workflow),
203
+ [`@glyphs-ai/runtime`](./packages/runtime), and
204
+ [`@glyphs-ai/server`](./packages/server).
205
+
206
+ ## First-party catalog
207
+
208
+ The repo ships a [`first-party/`](./first-party/) subtree of agents and
209
+ skills (scope `official`) that the project maintains in lock-step with the
210
+ code — they depend on internals (catalog schema, CLI surface) tightly
211
+ enough to version-bump and PR together with the packages that define
212
+ those internals. See [`first-party/README.md`](./first-party/README.md)
213
+ for the full list and install URLs. Third-party catalogs can be installed
214
+ the same way as first-party entries (any reachable GitHub URL).
215
+
216
+ ## Development
217
+
218
+ Requires Node ≥ 22, pnpm ≥ 10.
219
+
220
+ ```sh
221
+ git clone https://github.com/glyphs-ai/glyph.git
222
+ cd glyph
223
+ pnpm install
224
+ pnpm build # tsc emit (run first; downstream packages import upstream .d.ts)
225
+ pnpm typecheck # tsc --noEmit across all packages
226
+ pnpm test # vitest across all packages
227
+ pnpm lint # biome check
228
+ ```
229
+
230
+ Run the dev server (hot-reloading API + Vite-served dashboard):
231
+
232
+ ```sh
233
+ pnpm dev
234
+ # API on http://127.0.0.1:8787
235
+ # Dashboard dev server on http://127.0.0.1:41817 (proxies /api → 8787)
236
+ ```
237
+
238
+ For everything beyond the basics — repository pattern, atomic-write
239
+ guarantees, how to add a new runtime adapter — see
240
+ [`docs/architecture.md`](./docs/architecture.md). Release procedure
241
+ lives in [`docs/RELEASING.md`](./docs/RELEASING.md).
242
+
243
+ ## License
244
+
245
+ MIT — see [LICENSE](./LICENSE).