textus 0.53.0 → 0.54.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -0
- data/README.md +53 -73
- data/SPEC.md +2 -5
- data/docs/architecture/README.md +149 -159
- data/lib/textus/action/accept.rb +0 -9
- data/lib/textus/action/audit.rb +0 -2
- data/lib/textus/action/blame.rb +0 -2
- data/lib/textus/action/boot.rb +2 -11
- data/lib/textus/action/data_mv.rb +1 -3
- data/lib/textus/action/deps.rb +1 -15
- data/lib/textus/action/doctor.rb +0 -2
- data/lib/textus/action/drain.rb +4 -6
- data/lib/textus/action/enqueue.rb +3 -5
- data/lib/textus/action/get.rb +1 -3
- data/lib/textus/action/ingest.rb +135 -0
- data/lib/textus/action/jobs.rb +1 -3
- data/lib/textus/action/key_delete.rb +0 -10
- data/lib/textus/action/key_delete_prefix.rb +1 -3
- data/lib/textus/action/key_mv.rb +1 -15
- data/lib/textus/action/key_mv_prefix.rb +1 -3
- data/lib/textus/action/list.rb +0 -2
- data/lib/textus/action/propose.rb +0 -2
- data/lib/textus/action/published.rb +0 -2
- data/lib/textus/action/pulse.rb +7 -38
- data/lib/textus/action/put.rb +1 -12
- data/lib/textus/action/rdeps.rb +2 -12
- data/lib/textus/action/reject.rb +0 -12
- data/lib/textus/action/rule_explain.rb +0 -4
- data/lib/textus/action/rule_lint.rb +1 -3
- data/lib/textus/action/rule_list.rb +0 -4
- data/lib/textus/action/schema_envelope.rb +0 -2
- data/lib/textus/action/uid.rb +0 -2
- data/lib/textus/action/where.rb +0 -2
- data/lib/textus/action/write_verb.rb +4 -18
- data/lib/textus/boot.rb +40 -109
- data/lib/textus/command.rb +6 -1
- data/lib/textus/container.rb +21 -5
- data/lib/textus/core/freshness/evaluator.rb +18 -34
- data/lib/textus/core/freshness/verdict.rb +1 -1
- data/lib/textus/doctor/check/notebook_sources.rb +50 -0
- data/lib/textus/doctor/check/protocol_version.rb +6 -6
- data/lib/textus/doctor/check/raw_asset_paths.rb +50 -0
- data/lib/textus/doctor/check/stale_reviewed_stamp.rb +54 -0
- data/lib/textus/doctor/check.rb +0 -1
- data/lib/textus/doctor.rb +3 -42
- data/lib/textus/envelope/reader.rb +46 -0
- data/lib/textus/envelope/writer.rb +209 -0
- data/lib/textus/envelope.rb +19 -6
- data/lib/textus/errors.rb +9 -5
- data/lib/textus/{entry → format}/base.rb +1 -6
- data/lib/textus/{entry → format}/json.rb +1 -4
- data/lib/textus/{entry → format}/markdown.rb +2 -6
- data/lib/textus/{entry → format}/text.rb +2 -6
- data/lib/textus/{entry → format}/yaml.rb +1 -4
- data/lib/textus/{entry.rb → format.rb} +9 -10
- data/lib/textus/gate/auth.rb +58 -12
- data/lib/textus/gate.rb +2 -0
- data/lib/textus/init.rb +16 -79
- data/lib/textus/jobs/base.rb +23 -0
- data/lib/textus/jobs/materialize.rb +20 -0
- data/lib/textus/{background → jobs}/plan.rb +1 -1
- data/lib/textus/jobs/planner.rb +101 -0
- data/lib/textus/jobs/retention.rb +48 -0
- data/lib/textus/jobs/sweep.rb +27 -0
- data/lib/textus/{background → jobs}/worker.rb +2 -2
- data/lib/textus/jobs.rb +15 -0
- data/lib/textus/key/path.rb +1 -1
- data/lib/textus/manifest/entry/base.rb +4 -19
- data/lib/textus/manifest/entry/parser.rb +27 -10
- data/lib/textus/manifest/entry/produced.rb +13 -34
- data/lib/textus/manifest/entry/publish/to_paths.rb +4 -4
- data/lib/textus/manifest/entry/publish.rb +0 -12
- data/lib/textus/manifest/entry/validators/format_matrix.rb +1 -1
- data/lib/textus/manifest/entry/validators.rb +0 -1
- data/lib/textus/manifest/policy/source.rb +14 -62
- data/lib/textus/manifest/policy.rb +2 -5
- data/lib/textus/manifest/resolver.rb +2 -2
- data/lib/textus/manifest/schema/contract.rb +61 -0
- data/lib/textus/manifest/schema/keys.rb +6 -20
- data/lib/textus/manifest/schema/semantics.rb +232 -0
- data/lib/textus/manifest/schema/validator.rb +24 -302
- data/lib/textus/manifest/schema/vocabulary.rb +1 -0
- data/lib/textus/manifest/schema.rb +1 -4
- data/lib/textus/manifest.rb +1 -3
- data/lib/textus/ports/{queue → job_store}/job.rb +1 -1
- data/lib/textus/ports/{queue.rb → job_store.rb} +6 -13
- data/lib/textus/produce/engine.rb +50 -0
- data/lib/textus/produce/render.rb +20 -0
- data/lib/textus/session.rb +15 -8
- data/lib/textus/store.rb +5 -14
- data/lib/textus/surfaces/mcp/catalog.rb +23 -11
- data/lib/textus/surfaces/mcp/errors.rb +0 -9
- data/lib/textus/surfaces/mcp/server.rb +87 -110
- data/lib/textus/surfaces/role_scope.rb +0 -4
- data/lib/textus/surfaces/watcher.rb +3 -3
- data/lib/textus/types.rb +15 -0
- data/lib/textus/version.rb +2 -2
- data/lib/textus/workflow/collector.rb +27 -0
- data/lib/textus/workflow/context.rb +5 -0
- data/lib/textus/workflow/dsl.rb +44 -0
- data/lib/textus/workflow/loader.rb +17 -0
- data/lib/textus/workflow/pattern.rb +18 -0
- data/lib/textus/workflow/registry.rb +21 -0
- data/lib/textus/workflow/runner.rb +99 -0
- data/lib/textus/workflow.rb +28 -0
- data/lib/textus.rb +12 -1
- metadata +67 -66
- data/lib/textus/action/pulse/scanner.rb +0 -118
- data/lib/textus/background/job/base.rb +0 -27
- data/lib/textus/background/job/materialize.rb +0 -31
- data/lib/textus/background/job/refresh.rb +0 -22
- data/lib/textus/background/job/sweep.rb +0 -31
- data/lib/textus/background/job.rb +0 -19
- data/lib/textus/background/planner/plan.rb +0 -113
- data/lib/textus/background/retention/apply.rb +0 -50
- data/lib/textus/doctor/check/handler_permit.rb +0 -34
- data/lib/textus/doctor/check/hooks.rb +0 -25
- data/lib/textus/doctor/check/intake_registration.rb +0 -46
- data/lib/textus/envelope/io/reader.rb +0 -48
- data/lib/textus/envelope/io/writer.rb +0 -211
- data/lib/textus/events.rb +0 -21
- data/lib/textus/init/templates/machine_intake.rb +0 -49
- data/lib/textus/init/templates/orientation_reducer.rb +0 -21
- data/lib/textus/manifest/entry/validators/events.rb +0 -22
- data/lib/textus/manifest/policy/handler_permit.rb +0 -17
- data/lib/textus/pipeline/acquire/handler.rb +0 -29
- data/lib/textus/pipeline/acquire/intake.rb +0 -132
- data/lib/textus/pipeline/acquire/projection.rb +0 -129
- data/lib/textus/pipeline/acquire/serializer/json.rb +0 -31
- data/lib/textus/pipeline/acquire/serializer/text.rb +0 -16
- data/lib/textus/pipeline/acquire/serializer/yaml.rb +0 -31
- data/lib/textus/pipeline/acquire/serializer.rb +0 -17
- data/lib/textus/pipeline/engine.rb +0 -97
- data/lib/textus/pipeline/render.rb +0 -25
- data/lib/textus/ports/audit_subscriber.rb +0 -42
- data/lib/textus/projection.rb +0 -103
- data/lib/textus/step/base.rb +0 -35
- data/lib/textus/step/builtin/csv_fetch.rb +0 -19
- data/lib/textus/step/builtin/ical_events_fetch.rb +0 -30
- data/lib/textus/step/builtin/json_fetch.rb +0 -18
- data/lib/textus/step/builtin/markdown_links_fetch.rb +0 -20
- data/lib/textus/step/builtin/rss_fetch.rb +0 -26
- data/lib/textus/step/builtin.rb +0 -22
- data/lib/textus/step/catalog.rb +0 -37
- data/lib/textus/step/context.rb +0 -74
- data/lib/textus/step/discovery.rb +0 -24
- data/lib/textus/step/error_log.rb +0 -32
- data/lib/textus/step/event_bus.rb +0 -113
- data/lib/textus/step/fetch.rb +0 -13
- data/lib/textus/step/fire_report.rb +0 -23
- data/lib/textus/step/loader.rb +0 -108
- data/lib/textus/step/observe.rb +0 -31
- data/lib/textus/step/registry_store.rb +0 -66
- data/lib/textus/step/signature.rb +0 -31
- data/lib/textus/step/transform.rb +0 -12
- data/lib/textus/step/validate.rb +0 -11
- data/lib/textus/step.rb +0 -10
- data/lib/textus/surfaces/mcp/session.rb +0 -9
- data/lib/textus/surfaces/mcp/tool_schemas.rb +0 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '08d1e232ff648999588cfcfe0cccafd7954a020805f3e344aabdbbb2798b51af'
|
|
4
|
+
data.tar.gz: 4b8545d90d8aa990d63565f1d2caaff7e3e519d7504ae22a04dad68507c90949
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28b8de7a9e84208008c7082cd597d6905b743fe035b0344953cc82d5581f8a6ce98abf4bae40e5f1040780a1874743e7403695831709a539ea2cd4fd7dbc4c79
|
|
7
|
+
data.tar.gz: 9be159077a4f4e17e0118b3efea9085d3e5f6f463d7f558d6fcfdc45912c07cde6fe0824de213171806245cbca3b38f689f6b6922a2f7ddf9fd4dcb0c0bdc2a7
|
data/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,58 @@ The **gem version** (`0.x.y`) is distinct from the **protocol version**
|
|
|
9
9
|
bump is a breaking change that requires a store migration; the gem version
|
|
10
10
|
tracks both additive improvements and breaking protocol bumps independently.
|
|
11
11
|
|
|
12
|
+
## 0.54.1 — 2026-06-17 — MCP SDK, dry ecosystem, ERB templates
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **`Textus::Types` module**: shared `dry-types` constrained types (`RoleName`, `Cursor`, `FormatName`) used across all dry-struct structs.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **MCP surface → official `mcp` SDK** (PR #223): the hand-rolled JSON-RPC 2.0 stdio loop is replaced by the official `mcp` gem (`~> 0.20`). Protocol version auto-negotiates up to `2025-11-25` (was hardcoded `2024-11-05`). `Catalog.build_tools` generates `MCP::Tool` instances from verb contracts; `Server` manages session lifecycle and delegates dispatch. `routing.rb`, the `MCP::Session` alias, and `ToolSchemas` are deleted.
|
|
21
|
+
- **`Session`, `Envelope`, `Container` → `Dry::Struct`** (PR #223): `Data.define` replaced with `Dry::Struct` for typed, loudly-failing construction at object creation time. `Session` enforces `RoleName` and non-negative `Cursor`; `Envelope` enforces known `FormatName`; `Container` has typed port references.
|
|
22
|
+
- **Manifest validator → dry-schema + Semantics** (PR #223): the 318-line programmatic validator is split into `contract.rb` (dry-schema structural contract) and `semantics.rb` (cross-field rules, `walk`-based unknown-key detection, ADR migration hints). Public interface `Validator.validate!` unchanged.
|
|
23
|
+
- **Mustache → ERB** (PR #223): `mustache` gem removed; all 8 `.mustache` templates converted to `.erb` using `ERB#result_with_hash`. `Produce::Render` now uses `ERB.new(template, trim_mode: "-").result_with_hash(ctx)`.
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
- `mustache` runtime dependency (replaced by Ruby stdlib ERB).
|
|
28
|
+
- `MCP::Routing` module, `MCP::Session` alias, `MCP::ToolSchemas` module — superseded by the SDK.
|
|
29
|
+
|
|
30
|
+
## 0.54.0 — 2026-06-16 — Workflow system, raw ingest pipeline, MCP resources
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **Workflow system** (PR #218): Ruby DSL files in `.textus/workflows/` replace the `step/` extension model. `Workflow::Registry` (loaded from `.textus/workflows/**/*.rb`) is resolved by `Produce::Engine` at produce time; `Workflow::Runner` threads data through each named step and persists. Core components: `Workflow::Context`, `Workflow::Pattern` (glob matching), `Workflow::DSL`, `Workflow::Collector`, `Workflow::Registry`, `Workflow::Loader`, `Workflow::Runner`.
|
|
35
|
+
- **`artifacts.index` produced workflow**: pre-computed full-store catalog (`artifacts.index`) served as a produced artifact — enumerates every manifest entry with its key, lane, format, etag, and `generated_at` timestamp.
|
|
36
|
+
- **MCP `resources/list` and `resources/read`** (PR #221): machine-lane `produced` entries are now exposed as MCP resources at `textus://<key>` URIs with correct MIME types. Clients discover them via the `resources` capability advertised in the `initialize` handshake.
|
|
37
|
+
- **Raw ingest pipeline** (PR #219, [ADR 0114](docs/architecture/decisions/0114-foundation-refactor.md), [ADR 0116](docs/architecture/decisions/0116-raw-lane-and-ingest-verb.md)): new `raw` zone-kind with a `write-once` gate and an `ingest` capability/verb (`Action::Ingest`). Doctor checks and an asset sentinel guard the lane. The `raw` bijection entry maps `raw → ingest`.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- **`artifacts.derived.*` → `artifacts.*`**: the `derived` key segment is dropped — all machine-lane entries flatten to `artifacts.<name>` in both the manifest and the on-disk store. Workflows, boot, and all other callers updated.
|
|
42
|
+
- **`boot` reads from `artifacts.index`**: inline computation removed from the boot action; the pre-computed catalog drives the response. `--lean` flag removed (PR #220).
|
|
43
|
+
- **`pulse` slimmed**: `stale`, `doctor`, and `next_due_at` removed from the pulse envelope; `index_etag` added so clients can cheaply detect catalog drift without a full list.
|
|
44
|
+
- **`ContractDrift` moved to core** (PR #220): `Textus::ContractDrift` extracted from the MCP surface into the core library so it is reusable across surfaces.
|
|
45
|
+
- **MCP `Server` refactored per Sandi Metz rules** (PR #220): routing extracted to `Routing` module; methods decomposed to ≤ 5 lines each.
|
|
46
|
+
- **Plugin manifest wiring** (PR #220): `claude_plugin` uses the installed `textus` binary (external use); `mcp_config` keeps `bundle exec` (dev environment). `--lean` references removed from the plugin manifest spec.
|
|
47
|
+
- **Namespace renames** (PR #218, internal): `entry/` → `format/`, `envelope/io/` → `envelope/`, `Ports::Queue` → `Ports::JobStore`, `background/` → `jobs/`, `pipeline/` → `produce/`.
|
|
48
|
+
- **Workflows reorganised**: workflow files split into `artifacts/` and `config/` subdirectories under `.textus/workflows/`.
|
|
49
|
+
|
|
50
|
+
### Removed
|
|
51
|
+
|
|
52
|
+
- **Step system** (PR #218): entire `lib/textus/step/` directory deleted along with all step-related specs, `container.steps`, dead `hooks.rb` doctor check, and `ports/audit_subscriber.rb`. **Migration:** rewrite step files as `.textus/workflows/*.rb` using the Workflow DSL.
|
|
53
|
+
- **`Jobs::Refresh`** ([ADR 0115](docs/architecture/decisions/0115-role-trust-model.md)): workflow-based periodic re-derivation replaces the background refresh job.
|
|
54
|
+
- **`handler_permit` manifest field** (PR #218): doctor-only field with no runtime enforcement deleted along with its policy class and schema key.
|
|
55
|
+
- **Dead guards and constants**: `derived_write?` no-op guard from `WriteVerb#cascade_to_rdeps`; `publish_each` runtime guard from `Entry::Publish`; duplicate inline `check_action!` from `put`/`key_delete`/`reject`; `BURN = :sync` constant; cross-lane notebook side-effect from `Action::Ingest`.
|
|
56
|
+
- **`source.from: fetch` and `source.from: derive`** narrowed to `external` only — fetch/derive methods removed from `Produced`; freshness/pulse use retention rules; boot drops intake/derived keys.
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
|
|
60
|
+
- **MCP `resources` capability missing from `initialize` handshake** (PR #221): the server only advertised `tools`, so MCP clients never called `resources/list`. Adding `"resources" => {}` makes all 9 produced artifacts discoverable as resources.
|
|
61
|
+
- **`adr_log` workflow**: `include_keyless: true` added for tree-publish of `knowledge.decisions`.
|
|
62
|
+
- **SpecLayout violations** (PR #221): `workflow_index_spec` and `workflow/errors_spec` (string-described) moved to `spec/conformance/workflow/`.
|
|
63
|
+
|
|
12
64
|
## 0.53.0 — 2026-06-15 — Auth consolidation and code quality
|
|
13
65
|
|
|
14
66
|
### Added
|
data/README.md
CHANGED
|
@@ -64,22 +64,20 @@ DURABLE │ notebook │ knowledge ★ the goal
|
|
|
64
64
|
(kept) │ agent's working truth │ canon — a human authors │
|
|
65
65
|
│ durable, but low-trust │ here · the context you ship │
|
|
66
66
|
├──────────────────────────┼───────────────────────────────┤
|
|
67
|
-
TRANSIENT │ artifacts
|
|
68
|
-
(staging) │
|
|
69
|
-
│
|
|
67
|
+
TRANSIENT │ artifacts.* │ proposals (queue) │
|
|
68
|
+
(staging) │ computed outputs and │ a candidate, in review │
|
|
69
|
+
│ external inputs │ ▲ climbs via human accept │
|
|
70
70
|
└──────────────────────────┴───────────────────────────────┘
|
|
71
71
|
raw material ──── propose ────► a human accept lifts it to canon
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
*(The `machine` lane's other half, `artifacts.derived.*`, isn't on this grid — it's a computed **output** projected from the lanes, not an input climbing toward trust.)*
|
|
75
|
-
|
|
76
74
|
Without coordination, they overwrite each other and nothing remembers why. textus gives each actor a **lane** — enforced at the protocol level, not by convention — routes everything they can't write directly through a **proposals queue**, and writes every successful change to an **append-only audit log**.
|
|
77
75
|
|
|
78
76
|
```
|
|
79
|
-
knowledge/ author only
|
|
80
|
-
notebook/ keep only
|
|
81
|
-
proposals/ propose (agent
|
|
82
|
-
artifacts/ converge only
|
|
77
|
+
knowledge/ author only — who you are, what you decide, how you sound
|
|
78
|
+
notebook/ keep only — agent's own durable lane (bytes climb to knowledge only via propose→accept)
|
|
79
|
+
proposals/ propose (agent+human) — proposals waiting on a human accept
|
|
80
|
+
artifacts/ converge only — machine-maintained: computed outputs + external inputs
|
|
83
81
|
```
|
|
84
82
|
|
|
85
83
|
An agent that tries to write directly into `knowledge/` gets `write_forbidden`. It writes to `proposals/` (to change authoritative content) or its own `notebook/` (for working memory). You accept the good proposals; textus promotes them, records the move, and audits both halves. Stable per-entry `uid:` means a reorganization doesn't break references. A monotonic audit cursor (`textus pulse --since=N`) means the next session — possibly a different agent, possibly a different model — picks up exactly where the last one left off.
|
|
@@ -109,12 +107,12 @@ Try the gate the other way (`textus put knowledge.notes.X --as=agent`) and you g
|
|
|
109
107
|
|
|
110
108
|
## Try it
|
|
111
109
|
|
|
112
|
-
- **Worked end-to-end store** — the role gate (propose → accept), drain/publish (`CLAUDE.md` / `AGENTS.md` generated from knowledge entries), schemas, templates, and
|
|
110
|
+
- **Worked end-to-end store** — the role gate (propose → accept), drain/publish (`CLAUDE.md` / `AGENTS.md` generated from knowledge entries), schemas, ERB templates, and workflows: [`.textus/`](.textus/)
|
|
113
111
|
- **Wire textus into Claude Code via MCP** — 4 steps, ~5 minutes: [`docs/how-to/agents-mcp.md`](docs/how-to/agents-mcp.md)
|
|
114
112
|
|
|
115
113
|
## Protocol, not just a gem
|
|
116
114
|
|
|
117
|
-
This Ruby gem is the reference implementation of **`textus/
|
|
115
|
+
This Ruby gem is the reference implementation of **`textus/4`** — a wire format and storage convention any language can speak. The protocol owns the envelope shape, the role/lane gate, the audit log format, and the key grammar. The gem version (semver, see badge) and the protocol version (`textus/4`) move independently; envelopes carry the `protocol` field so consumers can pin to the contract, not the implementation.
|
|
118
116
|
|
|
119
117
|
- Specification: [`SPEC.md`](SPEC.md)
|
|
120
118
|
- Architecture: [`docs/architecture/README.md`](docs/architecture/README.md)
|
|
@@ -146,26 +144,26 @@ roles:
|
|
|
146
144
|
- { name: automation, can: [converge] }
|
|
147
145
|
|
|
148
146
|
lanes:
|
|
149
|
-
- { name: knowledge, kind: canon } # author
|
|
150
|
-
- { name: notebook, kind: workspace } # keep
|
|
151
|
-
- { name: proposals, kind: queue } # propose
|
|
152
|
-
- { name: artifacts, kind: machine } # converge —
|
|
147
|
+
- { name: knowledge, kind: canon } # author — canonical truth
|
|
148
|
+
- { name: notebook, kind: workspace } # keep — agent's own durable lane
|
|
149
|
+
- { name: proposals, kind: queue } # propose — proposals awaiting accept
|
|
150
|
+
- { name: artifacts, kind: machine } # converge — computed outputs + external inputs
|
|
153
151
|
```
|
|
154
152
|
|
|
155
153
|
```
|
|
156
154
|
.textus/
|
|
157
155
|
manifest.yaml # role capabilities + lane kinds + key-to-path mapping
|
|
158
156
|
schemas/ # YAML field shapes per entry family
|
|
159
|
-
templates/ #
|
|
160
|
-
|
|
157
|
+
templates/ # ERB templates for produced entries
|
|
158
|
+
workflows/ # Ruby workflow files (Textus.workflow DSL) for data acquisition
|
|
161
159
|
.gitignore # generated — ignores .run/ and any tracked:false entries
|
|
162
160
|
data/ # one dir per lane; kinds + capabilities are in the manifest above
|
|
163
161
|
knowledge/ # e.g. identity (knowledge.identity.*), voice, decisions, notes
|
|
164
162
|
notebook/
|
|
165
163
|
proposals/
|
|
166
|
-
artifacts/ # machine lane:
|
|
164
|
+
artifacts/ # machine lane: computed outputs + external inputs
|
|
167
165
|
.run/ # disposable runtime state — gitignored, safe to delete (ADR 0038)
|
|
168
|
-
audit/audit.log # append-only NDJSON event ledger, every write (rotates at ~
|
|
166
|
+
audit/audit.log # append-only NDJSON event ledger, every write (rotates at ~10 MB)
|
|
169
167
|
state/cursor.<role> # per-role pulse cursor — where `pulse --since` resumes
|
|
170
168
|
locks/ # per-key produce locks + the produce mutex
|
|
171
169
|
sentinels/ # publish bookkeeping (target sha) — regenerated on drain (ADR 0070)
|
|
@@ -181,21 +179,23 @@ textus list --lane=knowledge
|
|
|
181
179
|
printf '%s' '{"_meta":{"name":"bob","org":"acme"},"body":"hi\n"}' \
|
|
182
180
|
| textus put knowledge.notes.bob --as=human --stdin
|
|
183
181
|
textus drain --as=automation # re-pull stale inputs + recompute derived outputs
|
|
184
|
-
textus rule list
|
|
185
|
-
textus audit --limit=20
|
|
182
|
+
textus rule list # show every rule block
|
|
183
|
+
textus audit --limit=20 # query the audit log
|
|
186
184
|
```
|
|
187
185
|
|
|
188
|
-
(All verbs return JSON envelopes; `--output=json` is the default and the only format
|
|
186
|
+
(All verbs return JSON envelopes; `--output=json` is the default and the only format.)
|
|
189
187
|
|
|
190
|
-
For a worked store — knowledge entries, a staged proposal, schemas,
|
|
188
|
+
For a worked store — knowledge entries, a staged proposal, schemas, ERB templates, and a `drain` that publishes `CLAUDE.md` / `AGENTS.md` — see [`.textus/`](.textus/).
|
|
191
189
|
|
|
192
190
|
## What's shipped
|
|
193
191
|
|
|
194
192
|
- **Per-entry formats & publish.** `format: markdown|json|yaml|text` per entry; a typed `publish:` block (`to:` for file fan-out, `tree:` for a whole-subtree mirror) byte-copies derived files to their consumer paths. ([SPEC §5.2–5.3](SPEC.md))
|
|
195
193
|
- **Stable identity.** Auto-minted `uid:` survives writes and `textus key mv`; reorganising never breaks references.
|
|
196
194
|
- **Capability × lane-kind gate.** Writes carry `--as=<role>`; a role may write a lane iff it holds the capability the lane's `kind:` requires (`canon`→`author`, `workspace`→`keep`, `machine`→`converge`, `queue`→`propose`). The wrong role gets `write_forbidden` naming the capability needed and the roles that hold it. ([SPEC §5](SPEC.md))
|
|
197
|
-
- **Agent loop.** `textus boot` orients a fresh session; `textus pulse --since=N` is the per-turn heartbeat (changed entries,
|
|
198
|
-
-
|
|
195
|
+
- **Agent loop.** `textus boot` orients a fresh session; `textus pulse --since=N` is the per-turn heartbeat (changed entries, pending proposals, index etag for catalog drift detection). ([docs/how-to/agents-mcp.md](docs/how-to/agents-mcp.md))
|
|
196
|
+
- **MCP surface.** The official `mcp` Ruby SDK drives the stdio JSON-RPC server; protocol version auto-negotiated up to `2025-11-25`. Wire textus into Claude Code, Cursor, or any MCP host in one config block.
|
|
197
|
+
- **`textus doctor`.** Health checks across schemas, workflow registrations, keys, sentinels, and the audit log.
|
|
198
|
+
- **`raw` lane kind.** A write-once intake lane for external data that hasn't been reviewed yet; carries the `ingest` capability.
|
|
199
199
|
|
|
200
200
|
## CLI and lanes
|
|
201
201
|
|
|
@@ -204,79 +204,59 @@ Every command operates on one store, located in this order: `--root <path>` flag
|
|
|
204
204
|
- Full verb table — read, write, health, scaffolding — is in [SPEC §9](SPEC.md).
|
|
205
205
|
- Lane semantics and the capability × lane-kind mapping live in [SPEC §5](SPEC.md), with the reference in [`docs/reference/zones.md`](docs/reference/zones.md).
|
|
206
206
|
|
|
207
|
-
`textus boot` prints the same information for the current store: lanes, entry families with schemas, registered
|
|
207
|
+
`textus boot` prints the same information for the current store: lanes, entry families with schemas, registered workflows, write flows, and the verb catalog. Run it inside a store and you get the live picture; reach for the SPEC when you want the contract.
|
|
208
208
|
|
|
209
209
|
## Produce and publish
|
|
210
210
|
|
|
211
|
-
Produced entries (`kind: produced`) declare how they're acquired in one `source:` block
|
|
211
|
+
Produced entries (`kind: produced`) declare how they're acquired in one `source:` block; `drain` materialises them. Two built-in modes, plus workflows for custom data acquisition:
|
|
212
212
|
|
|
213
|
-
- **`source: { from:
|
|
214
|
-
- **`source: { from:
|
|
215
|
-
- **`source: { from: external, sources: [...] }`** — *externally managed*: an out-of-band command writes the file; textus tracks the declared `sources` for staleness.
|
|
213
|
+
- **`source: { from: external, command: "...", sources: [...] }`** — *externally managed*: an out-of-band command or workflow writes the file; textus tracks staleness via declared `sources`.
|
|
214
|
+
- **`source: { from: external, command: "true", sources: [] }` + a workflow** — *workflow-driven*: a `Textus.workflow` block (in `.textus/workflows/`) acquires and shapes the data on `drain`.
|
|
216
215
|
|
|
217
|
-
Publishing is one typed `publish:` block (ADR 0052). `
|
|
216
|
+
Publishing is one typed `publish:` block (ADR 0052/0094). Each target is either `{ to: path, template?: name }` for a single file (optionally rendered through an ERB template) or `{ tree: "dir" }` to mirror a whole stored subtree. Sentinels for every published file live under `.textus/.run/sentinels/` (git-ignored, regenerated on drain). See SPEC §5.2, §5.3, §5.12.
|
|
218
217
|
|
|
219
|
-
|
|
218
|
+
Templates live in `.textus/templates/` as ERB files (`.erb`). The template receives the entry's `content` hash as local variables via `ERB#result_with_hash`. If `inject_boot: true`, a `boot` variable is also available with the live orientation context.
|
|
220
219
|
|
|
221
|
-
|
|
220
|
+
## Workflows
|
|
222
221
|
|
|
223
|
-
|
|
222
|
+
textus extends through **workflows** — a `Textus.workflow` block placed in `.textus/workflows/**/*.rb`. Each workflow matches a produced entry by key glob, then runs one or more named steps to acquire its data:
|
|
224
223
|
|
|
225
224
|
```ruby
|
|
226
|
-
# .textus/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
225
|
+
# .textus/workflows/artifacts/my_report.rb
|
|
226
|
+
Textus.workflow "my_report" do
|
|
227
|
+
match "artifacts.my-report"
|
|
228
|
+
|
|
229
|
+
step :build do |_, ctx|
|
|
230
|
+
# read from knowledge, fetch external data, compute anything
|
|
231
|
+
rows = ctx.container.manifest.resolver
|
|
232
|
+
.enumerate(prefix: "knowledge.notes")
|
|
233
|
+
.map { |r| { "key" => r[:key], "title" => r[:entry].schema } }
|
|
234
|
+
{ "content" => { "entries" => rows } }
|
|
236
235
|
end
|
|
237
236
|
end
|
|
238
237
|
```
|
|
239
238
|
|
|
240
|
-
|
|
239
|
+
`drain` discovers all workflow files, matches them against produced entries, and runs the steps. The result is written back to the entry's data path; `publish:` then copies it to its consumer paths.
|
|
241
240
|
|
|
242
|
-
|
|
243
|
-
# .textus/steps/transform/rank_by_recency.rb
|
|
244
|
-
module Textus
|
|
245
|
-
module Step
|
|
246
|
-
class RankByRecencyTransform < Transform
|
|
247
|
-
def call(rows:, config:, **)
|
|
248
|
-
rows.sort_by { |r| r["updated_at"].to_s }.reverse
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
end
|
|
252
|
-
end
|
|
253
|
-
```
|
|
241
|
+
## Hooks
|
|
254
242
|
|
|
255
|
-
|
|
243
|
+
Out-of-band event reactions use the hook DSL. Drop a file anywhere in `.textus/workflows/` and use `Textus.hook`:
|
|
256
244
|
|
|
257
245
|
```ruby
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
on :entry_written
|
|
263
|
-
|
|
264
|
-
def call(key:, envelope:, **)
|
|
265
|
-
$textus_event_log << [key, envelope.etag]
|
|
266
|
-
end
|
|
267
|
-
end
|
|
246
|
+
Textus.hook do |reg|
|
|
247
|
+
reg.on(:entry_written) do |key:, envelope:, **|
|
|
248
|
+
# fire-and-forget — runs after every successful write
|
|
249
|
+
$stderr.puts "wrote #{key} (etag #{envelope.etag[0, 8]})"
|
|
268
250
|
end
|
|
269
251
|
end
|
|
270
252
|
```
|
|
271
253
|
|
|
272
254
|
Observable events: `:entry_written`, `:entry_deleted`, `:entry_fetched`, `:entry_renamed`, `:entry_produced`, `:entry_published`, `:produce_failed`, `:proposal_accepted`, `:proposal_rejected`, `:store_loaded`, `:session_opened`, `:entry_fetch_started`, `:entry_fetch_failed`.
|
|
273
255
|
|
|
274
|
-
Stale
|
|
275
|
-
read that annotates the returned envelope with a freshness verdict (ADR 0089).
|
|
276
|
-
`drain` re-pulls anything past its `source.ttl` and recomputes derived outputs:
|
|
256
|
+
Stale produced entries are re-materialised by `drain`, not by reads — `get` is a pure read that annotates the returned envelope with a freshness verdict (ADR 0089).
|
|
277
257
|
|
|
278
258
|
```sh
|
|
279
|
-
textus drain --as=automation # re-
|
|
259
|
+
textus drain --as=automation # re-materialise every stale produced entry
|
|
280
260
|
textus drain artifacts.feeds --as=automation # scope to one prefix
|
|
281
261
|
textus get artifacts.feeds.calendar.events # a pure read; carries a freshness verdict
|
|
282
262
|
```
|
|
@@ -287,7 +267,7 @@ See [`docs/how-to/agents-mcp.md`](docs/how-to/agents-mcp.md) for the agent boot
|
|
|
287
267
|
|
|
288
268
|
## Examples
|
|
289
269
|
|
|
290
|
-
[`.textus/`](.textus/) — textus as a project's own context store
|
|
270
|
+
[`.textus/`](.textus/) — textus as a project's own context store. Human-authored `knowledge/` (project facts, runbooks, ADRs), a staged proposal showing the agent-propose / human-accept loop, schemas validating each family, ERB templates and workflows, and a `drain` that publishes the orientation artifact to `CLAUDE.md` and `AGENTS.md`. Includes a copy-paste adoption recipe for your own repo.
|
|
291
271
|
|
|
292
272
|
## Tests
|
|
293
273
|
|
data/SPEC.md
CHANGED
|
@@ -899,16 +899,13 @@ The agent's MCP write surface includes the single-key `key_delete` and `key_mv`
|
|
|
899
899
|
{
|
|
900
900
|
"cursor": 1845,
|
|
901
901
|
"changed": [ { "seq": 1843, "key": "knowledge.notes.x", "verb": "put", "role": "human", "ts": "..." } ],
|
|
902
|
-
"stale": [ "artifacts.marketplace" ],
|
|
903
902
|
"pending_review": [ "proposals.proposal.123" ],
|
|
904
|
-
"doctor": { "ok": true, "warn": 0, "fail": 0 },
|
|
905
903
|
"contract_etag": "sha256:1f3a…",
|
|
906
|
-
"
|
|
907
|
-
"hook_errors": [ { "seq": 1844, "event": "after_put", "hook": "notify", "key": "knowledge.notes.x", "error_class": "Timeout::Error", "error_message": "…", "at": "..." } ]
|
|
904
|
+
"index_etag": "sha256:8f3c…"
|
|
908
905
|
}
|
|
909
906
|
```
|
|
910
907
|
|
|
911
|
-
`cursor` is the new high-water mark; pass it as `--since` on the next call. `changed` is sourced from `audit --seq-since`. `
|
|
908
|
+
`cursor` is the new high-water mark; pass it as `--since` on the next call. `changed` is sourced from `audit --seq-since`. `pending_review` lists all keys in the queue zone. `contract_etag` is the `sha256:`-prefixed composite content hash of the contract — the manifest plus hooks and schemas (ADR 0074, via ADR 0025) — for cheap change-detection. `index_etag` is the etag of the `artifacts.index` catalog file, or `null` when it does not exist — agents use this to detect when the catalog has been rebuilt. When `--since` is below the oldest available seq (due to audit log rotation), pulse returns `CursorExpired`.
|
|
912
909
|
|
|
913
910
|
**`put` input** (read from stdin when `--stdin` is given):
|
|
914
911
|
|