@cat-factory/prompt-fragments 0.15.39 → 0.15.41

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.
Files changed (2) hide show
  1. package/README.md +17 -17
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @cat-factory/prompt-fragments
2
2
 
3
- The **built-in tier** of best-practice prompt fragments — small, curated guidance
3
+ The **built-in tier** of best-practice prompt fragments: small, curated guidance
4
4
  snippets that get folded into an agent's system prompt at run time
5
5
  (`composeSystemPrompt`). This package is **plain, build-static data**: no I/O, no
6
6
  framework. It is the source of truth for the shipped defaults and the seed for the
@@ -8,9 +8,9 @@ tenant-scoped [prompt-fragment library](../../docs/adr/0006-prompt-fragment-libr
8
8
 
9
9
  ## What's here
10
10
 
11
- - `src/collections/*.ts` — fragments authored per topic. Today: `node`, `react`,
11
+ - `src/collections/*.ts`: fragments authored per topic. Today: `node`, `react`,
12
12
  `acceptance`, `design`, `style`, `migration`. Each exports an array of `PromptFragment`.
13
- - `src/index.ts` — merges the collections into a single `FRAGMENTS` registry plus
13
+ - `src/index.ts`: merges the collections into a single `FRAGMENTS` registry plus
14
14
  `FRAGMENTS_BY_ID` and `getFragment(id)` for O(1) lookup during composition.
15
15
 
16
16
  A `PromptFragment` (shape defined in [`@cat-factory/contracts`](../contracts))
@@ -36,26 +36,26 @@ relevance selector), the `body` (injected text), an optional condensed `brief`
36
36
 
37
37
  ### Two-tier bodies: `body` and `brief`
38
38
 
39
- An **implementer** kind (`coder` / `fixer` / `ci-fixer` / `conflict-resolver` — the kinds
39
+ An **implementer** kind (`coder` / `fixer` / `ci-fixer` / `conflict-resolver`: the kinds
40
40
  carrying the `brief-standards` trait) runs a long agentic loop whose system prompt, standards
41
- included, is re-sent on **every turn**. Those kinds fold a fragment's optional `brief` — the
42
- same standard stated tersely — instead of its full `body`. Reviewer / planner / investigator
41
+ included, is re-sent on **every turn**. Those kinds fold a fragment's optional `brief` (the
42
+ same standard stated tersely) instead of its full `body`. Reviewer / planner / investigator
43
43
  kinds keep the full text: they run few turns and benefit from it when judging built work.
44
44
 
45
45
  Two rules govern authoring one:
46
46
 
47
47
  - **A `brief` must not drop a rule, only its elaboration.** It is the same standard compressed,
48
- not a subset — an agent folding the brief is held to everything the body demands.
48
+ not a subset: an agent folding the brief is held to everything the body demands.
49
49
  - **`brief` travels WITH the body it condenses** and is never re-resolved by id downstream. A
50
50
  higher tier that overrides a built-in id supplies its OWN brief (or none), so the override's
51
- own text is folded — never the built-in's condensed text over a tenant's standard.
51
+ own text is folded, never the built-in's condensed text over a tenant's standard.
52
52
 
53
53
  Omitting `brief` is always safe: the full `body` is used for every kind, unchanged. Fragments
54
54
  that can reach an implementer kind carry one; the ones scoped to `spec-writer` / `playwright` /
55
55
  document-authoring kinds (which are not implementers) deliberately do not.
56
56
 
57
57
  Every fragment in **this** package is comfortably under `FRAGMENT_BRIEF_MIN_BODY_CHARS`, so the
58
- auto-condensation below never acts on the shipped catalog — keep it that way by writing a brief
58
+ auto-condensation below never acts on the shipped catalog: keep it that way by writing a brief
59
59
  by hand when a built-in grows past ~1,500 characters.
60
60
 
61
61
  ### Where a brief comes from at run time
@@ -64,14 +64,14 @@ The built-in `brief` above is only the first of three answers. For a fragment re
64
64
  the tenant library ([ADR 0006](../../docs/adr/0006-prompt-fragment-library.md)) the resolution
65
65
  order is:
66
66
 
67
- 1. **The winning tier's linked `brief`** — a built-in's, or the one a tenant authored on its own
67
+ 1. **The winning tier's linked `brief`**: a built-in's, or the one a tenant authored on its own
68
68
  managed row (the library editor's short-version field, or a repo-sourced guideline file's
69
69
  `brief:` frontmatter key).
70
70
  2. **A model-GENERATED condensation**, for a body over `FRAGMENT_BRIEF_MIN_BODY_CHARS` that has
71
71
  no linked brief. Produced once on the first implementer dispatch that folds it, persisted, and
72
- **regenerated whenever the body changes** — a library edit, a repo resync, or a living
72
+ **regenerated whenever the body changes**: a library edit, a repo resync, or a living
73
73
  document re-resolved at run time.
74
- 3. **Nothing** — the full `body` is folded for every kind, which is also where every failure on
74
+ 3. **Nothing**: the full `body` is folded for every kind, which is also where every failure on
75
75
  that path lands (no model wired, an unreadable store, a refused condensation).
76
76
 
77
77
  Design, decisions and gotchas:
@@ -80,22 +80,22 @@ Design, decisions and gotchas:
80
80
  ## Programmatic deployment seams (custom fragments + per-task-type defaults)
81
81
 
82
82
  Two **module-global** registration seams let a deployment (local **or** hosted) extend
83
- the fragment behaviour at startup — an import side effect from the deployment entry, run
83
+ the fragment behaviour at startup: an import side effect from the deployment entry, run
84
84
  **once before** `start()` / `startLocal()`, mirroring `registerAgentKind`. No fork, no
85
85
  rebuild, no per-workspace UI.
86
86
 
87
- - **Add custom fragments to the universal pool** — `registerPromptFragment(fragment)` /
87
+ - **Add custom fragments to the universal pool**: `registerPromptFragment(fragment)` /
88
88
  `registerPromptFragments(fragments)`. Every `GET /prompt-fragments` catalog read and
89
89
  every run-time body lookup then sees them; re-registering an id overrides the built-in
90
90
  of that id. (`universalFragments()` is the merged built-in ∪ registered pool.)
91
- - **Mark fragments as the default for a task type** —
91
+ - **Mark fragments as the default for a task type**:
92
92
  `registerTaskTypeDefaultFragments(taskType, fragmentIds)`. Every **new** task of that
93
93
  type (`document`, `review`, `feature`, …) is then seeded with those fragments onto its
94
94
  own `fragmentIds` at creation (unioned with the built-in defaults and whatever it
95
95
  inherits from its service). The board resolves a new task's seed set through
96
96
  `defaultFragmentIdsForTaskType(taskType)`; the only built-in per-type default is the
97
97
  document writing-style set (`DEFAULT_DOCUMENT_STYLE_FRAGMENT_IDS`), which registered
98
- ids augment rather than replace. Seeding is server-side and authoritative — it applies
98
+ ids augment rather than replace. Seeding is server-side and authoritative: it applies
99
99
  even for tasks created via the public API with no create-form picker.
100
100
 
101
101
  ```ts
@@ -122,7 +122,7 @@ registerTaskTypeDefaultFragments('review', ['org.review-checklist'])
122
122
 
123
123
  1. Create `src/collections/<topic>.ts` and export an array of `PromptFragment`.
124
124
  2. Spread it into `FRAGMENTS` in `src/index.ts`.
125
- 3. Keep ids **globally unique and stable** — blocks persist them, so a renamed id
125
+ 3. Keep ids **globally unique and stable**: blocks persist them, so a renamed id
126
126
  silently drops a selection (unknown ids are skipped, never error).
127
127
 
128
128
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/prompt-fragments",
3
- "version": "0.15.39",
3
+ "version": "0.15.41",
4
4
  "description": "Curated, versioned best-practice prompt fragments injected into agent system prompts.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,7 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@cat-factory/contracts": "0.214.0"
27
+ "@cat-factory/contracts": "0.216.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "typescript": "7.0.2",