@acrylblends/system-prompt 0.1.0 → 0.2.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/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # acryl-system-prompt
2
2
 
3
- Ported from ACRYL (`plugins/acryl-system-prompt`, see `provenance.json`): the frame's agent gets the prompt shape ACRYL IDE's agent has.
4
-
5
- The shaping of the system prompt in the shape pi.dev builds its own (`packages/coding-agent/src/core/system-prompt.ts`): one identity line, then
3
+ ACRYL's shaping of the system prompt, in the shape pi.dev builds its own (`packages/coding-agent/src/core/system-prompt.ts`): one identity line, then
6
4
  every section as a tagged block. It is a pass-through on the harness's `system-prompt/assemble` waterfall: only the identity line is replaced, sections
7
5
  are tagged and empties dropped, and every other section keeps its upstream text, so harness updates still reach the model. It records what upstream
8
- contributed (`acrylSystemPrompt.lastUpstream()`), so a harness update shows exactly what changed.
6
+ contributed so a harness update shows exactly what changed (`drift/`). See `docs/system-prompt/README.md` in the repository for where the whole prompt
7
+ comes from and how to change it.
8
+
9
+ It also adds one section of its own, the reply style (`acryl:reply-style`, tagged `<reply_style>`): plain, short sentences and no em dash.
9
10
 
10
- It adds one section of its own right after the identity, the reply style (`<reply_style>`): plain, short sentences and never an em dash or en dash
11
- in replies, comments or files, a plain `-` instead.
11
+ Config (row `acryl-system-prompt`): `identity` (the opening line; ACRYL's by default, and every ACRYL Blends app's composition sets the Blends
12
+ one), `style` (the reply style; empty leaves it out), `tagSections`, `dropEmpty`.
12
13
 
13
- Config (row `acryl-system-prompt`): `identity`, `style` (empty leaves the reply style out), `tagSections`, `dropEmpty`. `acryl-app-context` contributes the `acryl:plugin-router` section this
14
- plugin tags `<acryl_plugin_docs>`.
14
+ Source: `src/index.ts` (the plugin) and `src/transform.ts` (the pure shaping, also exported as `acryl-system-prompt/transform`). One package
15
+ for ACRYL and for the Blends frame, which publishes it as `@acrylblends/system-prompt` (spec 051).
@@ -0,0 +1,10 @@
1
+ {
2
+ "web": {
3
+ "systemChars": 8900,
4
+ "toolsChars": 31200
5
+ },
6
+ "cli": {
7
+ "systemChars": 5800,
8
+ "toolsChars": 21700
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "web": {
3
+ "systemChars": 9100,
4
+ "toolsChars": 32400
5
+ },
6
+ "cli": {
7
+ "systemChars": 6000,
8
+ "toolsChars": 22900
9
+ }
10
+ }
package/drift/cli.json ADDED
@@ -0,0 +1,70 @@
1
+ [
2
+ {
3
+ "name": "harness:identity",
4
+ "hash": "1dd6363fa551"
5
+ },
6
+ {
7
+ "name": "deployment:persona-prefix",
8
+ "hash": "e3b0c44298fc"
9
+ },
10
+ {
11
+ "name": "plan:policy",
12
+ "hash": "e3b0c44298fc"
13
+ },
14
+ {
15
+ "name": "tool:bash",
16
+ "hash": "647bd85ba2e8"
17
+ },
18
+ {
19
+ "name": "tool:read",
20
+ "hash": "4a23d2ec84aa"
21
+ },
22
+ {
23
+ "name": "tool:write",
24
+ "hash": "06221af32d81"
25
+ },
26
+ {
27
+ "name": "tool:edit",
28
+ "hash": "89df623d3529"
29
+ },
30
+ {
31
+ "name": "tool:glob",
32
+ "hash": "2a21a1ccfe63"
33
+ },
34
+ {
35
+ "name": "tool:grep",
36
+ "hash": "5cf488ba882d"
37
+ },
38
+ {
39
+ "name": "tool:jobs",
40
+ "hash": "ba71da85048b"
41
+ },
42
+ {
43
+ "name": "tool:web_search",
44
+ "hash": "4142c297778f"
45
+ },
46
+ {
47
+ "name": "tool:web_fetch",
48
+ "hash": "4fe4c0ce663c"
49
+ },
50
+ {
51
+ "name": "tool:goal",
52
+ "hash": "ebf10b6ae984"
53
+ },
54
+ {
55
+ "name": "tool:workflow",
56
+ "hash": "4e6240cecbf5"
57
+ },
58
+ {
59
+ "name": "tool:subagent",
60
+ "hash": "7f02d244c70b"
61
+ },
62
+ {
63
+ "name": "mcp-resource-servers",
64
+ "hash": "e3b0c44298fc"
65
+ },
66
+ {
67
+ "name": "deployment:persona-suffix",
68
+ "hash": "e3b0c44298fc"
69
+ }
70
+ ]
@@ -0,0 +1,70 @@
1
+ [
2
+ {
3
+ "name": "harness:identity",
4
+ "hash": "1dd6363fa551"
5
+ },
6
+ {
7
+ "name": "deployment:persona-prefix",
8
+ "hash": "e3b0c44298fc"
9
+ },
10
+ {
11
+ "name": "plan:policy",
12
+ "hash": "e3b0c44298fc"
13
+ },
14
+ {
15
+ "name": "tool:pwsh",
16
+ "hash": "c01abf413b19"
17
+ },
18
+ {
19
+ "name": "tool:read",
20
+ "hash": "4a23d2ec84aa"
21
+ },
22
+ {
23
+ "name": "tool:write",
24
+ "hash": "06221af32d81"
25
+ },
26
+ {
27
+ "name": "tool:edit",
28
+ "hash": "89df623d3529"
29
+ },
30
+ {
31
+ "name": "tool:glob",
32
+ "hash": "2a21a1ccfe63"
33
+ },
34
+ {
35
+ "name": "tool:grep",
36
+ "hash": "5cf488ba882d"
37
+ },
38
+ {
39
+ "name": "tool:jobs",
40
+ "hash": "ba71da85048b"
41
+ },
42
+ {
43
+ "name": "tool:web_search",
44
+ "hash": "4142c297778f"
45
+ },
46
+ {
47
+ "name": "tool:web_fetch",
48
+ "hash": "4fe4c0ce663c"
49
+ },
50
+ {
51
+ "name": "tool:goal",
52
+ "hash": "ebf10b6ae984"
53
+ },
54
+ {
55
+ "name": "tool:workflow",
56
+ "hash": "4e6240cecbf5"
57
+ },
58
+ {
59
+ "name": "tool:subagent",
60
+ "hash": "7f02d244c70b"
61
+ },
62
+ {
63
+ "name": "mcp-resource-servers",
64
+ "hash": "e3b0c44298fc"
65
+ },
66
+ {
67
+ "name": "deployment:persona-suffix",
68
+ "hash": "e3b0c44298fc"
69
+ }
70
+ ]
package/drift/web.json ADDED
@@ -0,0 +1,90 @@
1
+ [
2
+ {
3
+ "name": "harness:identity",
4
+ "hash": "1dd6363fa551"
5
+ },
6
+ {
7
+ "name": "deployment:persona-prefix",
8
+ "hash": "e0eb4484e486"
9
+ },
10
+ {
11
+ "name": "plan:policy",
12
+ "hash": "e3b0c44298fc"
13
+ },
14
+ {
15
+ "name": "context:file-reference",
16
+ "hash": "63738afd0d9f"
17
+ },
18
+ {
19
+ "name": "tool:bash",
20
+ "hash": "647bd85ba2e8"
21
+ },
22
+ {
23
+ "name": "tool:read",
24
+ "hash": "4a23d2ec84aa"
25
+ },
26
+ {
27
+ "name": "tool:write",
28
+ "hash": "06221af32d81"
29
+ },
30
+ {
31
+ "name": "tool:edit",
32
+ "hash": "89df623d3529"
33
+ },
34
+ {
35
+ "name": "tool:glob",
36
+ "hash": "2a21a1ccfe63"
37
+ },
38
+ {
39
+ "name": "tool:grep",
40
+ "hash": "5cf488ba882d"
41
+ },
42
+ {
43
+ "name": "tool:jobs",
44
+ "hash": "ba71da85048b"
45
+ },
46
+ {
47
+ "name": "tool:web_search",
48
+ "hash": "4142c297778f"
49
+ },
50
+ {
51
+ "name": "tool:web_fetch",
52
+ "hash": "4fe4c0ce663c"
53
+ },
54
+ {
55
+ "name": "tool:goal",
56
+ "hash": "ebf10b6ae984"
57
+ },
58
+ {
59
+ "name": "tool:workflow",
60
+ "hash": "4e6240cecbf5"
61
+ },
62
+ {
63
+ "name": "tool:subagent",
64
+ "hash": "7f02d244c70b"
65
+ },
66
+ {
67
+ "name": "tool:subagent_fork",
68
+ "hash": "762559ae5281"
69
+ },
70
+ {
71
+ "name": "mcp-resource-servers",
72
+ "hash": "e3b0c44298fc"
73
+ },
74
+ {
75
+ "name": "ui:deliverable-file-references",
76
+ "hash": "e8a2eb8da7f6"
77
+ },
78
+ {
79
+ "name": "harness:source",
80
+ "hash": "414d63a35846"
81
+ },
82
+ {
83
+ "name": "app:web-surface",
84
+ "hash": "103429ae00b5"
85
+ },
86
+ {
87
+ "name": "deployment:persona-suffix",
88
+ "hash": "3484a8eb5011"
89
+ }
90
+ ]
@@ -0,0 +1,90 @@
1
+ [
2
+ {
3
+ "name": "harness:identity",
4
+ "hash": "1dd6363fa551"
5
+ },
6
+ {
7
+ "name": "deployment:persona-prefix",
8
+ "hash": "e0eb4484e486"
9
+ },
10
+ {
11
+ "name": "plan:policy",
12
+ "hash": "e3b0c44298fc"
13
+ },
14
+ {
15
+ "name": "context:file-reference",
16
+ "hash": "63738afd0d9f"
17
+ },
18
+ {
19
+ "name": "tool:pwsh",
20
+ "hash": "c01abf413b19"
21
+ },
22
+ {
23
+ "name": "tool:read",
24
+ "hash": "4a23d2ec84aa"
25
+ },
26
+ {
27
+ "name": "tool:write",
28
+ "hash": "06221af32d81"
29
+ },
30
+ {
31
+ "name": "tool:edit",
32
+ "hash": "89df623d3529"
33
+ },
34
+ {
35
+ "name": "tool:glob",
36
+ "hash": "2a21a1ccfe63"
37
+ },
38
+ {
39
+ "name": "tool:grep",
40
+ "hash": "5cf488ba882d"
41
+ },
42
+ {
43
+ "name": "tool:jobs",
44
+ "hash": "ba71da85048b"
45
+ },
46
+ {
47
+ "name": "tool:web_search",
48
+ "hash": "4142c297778f"
49
+ },
50
+ {
51
+ "name": "tool:web_fetch",
52
+ "hash": "4fe4c0ce663c"
53
+ },
54
+ {
55
+ "name": "tool:goal",
56
+ "hash": "ebf10b6ae984"
57
+ },
58
+ {
59
+ "name": "tool:workflow",
60
+ "hash": "4e6240cecbf5"
61
+ },
62
+ {
63
+ "name": "tool:subagent",
64
+ "hash": "7f02d244c70b"
65
+ },
66
+ {
67
+ "name": "tool:subagent_fork",
68
+ "hash": "762559ae5281"
69
+ },
70
+ {
71
+ "name": "mcp-resource-servers",
72
+ "hash": "e3b0c44298fc"
73
+ },
74
+ {
75
+ "name": "ui:deliverable-file-references",
76
+ "hash": "e8a2eb8da7f6"
77
+ },
78
+ {
79
+ "name": "harness:source",
80
+ "hash": "87454d47e42c"
81
+ },
82
+ {
83
+ "name": "app:web-surface",
84
+ "hash": "103429ae00b5"
85
+ },
86
+ {
87
+ "name": "deployment:persona-suffix",
88
+ "hash": "3484a8eb5011"
89
+ }
90
+ ]
package/lib/transform.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import { createHash } from "node:crypto";
2
2
  //#region src/transform.ts
3
- /** pi.dev opens its prompt with one identity line ("You are an expert coding assistant operating inside pi, ..."). This is the Blends app builder's. */
4
- const DEFAULT_IDENTITY = "You are an expert coding assistant operating inside an ACRYL Blends app, an app made of Cordis plugins that blend.yaml composes and that you extend by writing plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing the app's plugins when asked.";
3
+ /**
4
+ * pi.dev opens its prompt with one identity line ("You are an expert coding assistant operating inside pi, ..."). This is ACRYL's; a product built
5
+ * on ACRYL passes its own line through the plugin's `identity` config (the Blends frame does, in every app's composition).
6
+ */
7
+ const DEFAULT_IDENTITY = "You are an expert coding assistant operating inside ACRYL, a coding agent harness that can extend itself with plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing ACRYL extensions when asked.";
5
8
  /**
6
9
  * How the agent writes its replies to the person: plain words, short, and with a plain dash instead of an em dash (the owner's rule for everything
7
10
  * ACRYL writes, which a model otherwise breaks in nearly every answer).
@@ -37,7 +40,7 @@ const alreadyTagged = (text) => /^<([a-z][a-z0-9_-]*)>[\s\S]*<\/\1>\s*$/u.test(t
37
40
  * @param sections - upstream sections in final order.
38
41
  */
39
42
  function shapeSections(sections, options = {}) {
40
- const identity = options.identity ?? "You are an expert coding assistant operating inside an ACRYL Blends app, an app made of Cordis plugins that blend.yaml composes and that you extend by writing plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing the app's plugins when asked.";
43
+ const identity = options.identity ?? "You are an expert coding assistant operating inside ACRYL, a coding agent harness that can extend itself with plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing ACRYL extensions when asked.";
41
44
  const tagSections = options.tagSections ?? true;
42
45
  const dropEmpty = options.dropEmpty ?? true;
43
46
  const out = [];
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","names":[],"sources":["../src/transform.ts"],"sourcesContent":["import { createHash } from 'node:crypto'\n\n/** pi.dev opens its prompt with one identity line (\"You are an expert coding assistant operating inside pi, ...\"). This is the Blends app builder's. */\nexport const DEFAULT_IDENTITY =\n 'You are an expert coding assistant operating inside an ACRYL Blends app, an app made of Cordis plugins that blend.yaml composes and that you extend by writing plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing the app\\'s plugins when asked.'\n\n/**\n * How the agent writes its replies to the person: plain words, short, and with a plain dash instead of an em dash (the owner's rule for everything\n * ACRYL writes, which a model otherwise breaks in nearly every answer).\n */\nexport const DEFAULT_STYLE =\n 'Write replies in plain, short sentences the person can act on. Never use the em dash character (U+2014) or the en dash (U+2013) in replies, code comments or files you write; use a plain hyphen-minus (-) or a comma instead.'\n\n/** The reply style's section: right after the identity line (the harness identity is -1000, the deployment persona 0). */\nexport const STYLE_SECTION = { name: 'acryl:reply-style', order: -900 } as const\n\n/** Section names the harness registers for its identity line. */\nexport const IDENTITY_SECTION = 'harness:identity'\n\n/** Readable tag names for sections whose harness name is not tag-friendly (pi.dev uses tags such as `docs`, `cwd`, `skills`). */\nconst TAG_ALIASES: Readonly<Record<string, string>> = {\n 'deployment:persona-prefix': 'persona',\n 'deployment:persona-suffix': 'cwd',\n 'acryl:plugin-router': 'acryl_plugin_docs',\n 'acryl:reply-style': 'reply_style',\n}\n\n/** One section of the assembled prompt, as the harness's `system-prompt/assemble` waterfall carries it. */\nexport interface PromptSection {\n readonly name: string\n readonly text: string\n}\n\nexport interface ShapeOptions {\n readonly identity?: string\n readonly tagSections?: boolean\n readonly dropEmpty?: boolean\n}\n\n/** `tool:read` becomes `tool_read`; anything outside `[a-z0-9_-]` becomes `_`, and a tag never starts with a digit or separator. */\nexport function tagName(sectionName: string): string {\n const alias = TAG_ALIASES[sectionName]\n if (alias !== undefined) return alias\n const tag = sectionName.toLowerCase().replace(/[^a-z0-9_-]+/gu, '_').replace(/^[^a-z]+/u, '').replace(/_+$/u, '')\n return tag === '' ? 'section' : tag\n}\n\n/** A section whose text already is one complete tagged block (the plugin docs router carries its own tag). */\nconst alreadyTagged = (text: string): boolean => /^<([a-z][a-z0-9_-]*)>[\\s\\S]*<\\/\\1>\\s*$/u.test(text.trim())\n\n/**\n * Shape the harness's assembled sections the way pi.dev's `buildSystemPromptSections` shapes its own: an untagged opening identity line,\n * then every other section as a tagged block, with empty sections dropped. Nothing else is rewritten: every section that is not the\n * identity passes through with its upstream text unchanged, so upstream improvements to tool guidance still reach the model.\n * @param sections - upstream sections in final order.\n */\nexport function shapeSections(sections: readonly PromptSection[], options: ShapeOptions = {}): PromptSection[] {\n const identity = options.identity ?? DEFAULT_IDENTITY\n const tagSections = options.tagSections ?? true\n const dropEmpty = options.dropEmpty ?? true\n const out: PromptSection[] = []\n for (const section of sections) {\n if (section.name === IDENTITY_SECTION) {\n out.push({ name: section.name, text: identity })\n continue\n }\n const text = String(section.text ?? '')\n if (dropEmpty && text.trim() === '') continue\n if (!tagSections || alreadyTagged(text)) {\n out.push({ name: section.name, text })\n continue\n }\n const tag = tagName(section.name)\n out.push({ name: section.name, text: `<${tag}>\\n${text.trim()}\\n</${tag}>` })\n }\n return out\n}\n\n/** Text that legitimately differs per run (the web surface section names its random local port) must not look like drift. */\nexport function normalizeVolatile(text: string): string {\n return String(text ?? '').replace(/\\b(127\\.0\\.0\\.1|localhost|0\\.0\\.0\\.0):\\d+/gu, '$1:<port>')\n}\n\n/**\n * What upstream contributed, for drift detection: name and a short hash of the text, excluding ACRYL's own sections (they carry\n * machine-specific paths and are ours to change). Variables such as `{{cwd}}` are not yet interpolated at this stage, so the hashes are stable.\n */\nexport function upstreamSnapshot(sections: readonly PromptSection[]): { name: string; hash: string }[] {\n return sections\n .filter(section => !section.name.startsWith('acryl:'))\n .map(section => ({ name: section.name, hash: createHash('sha256').update(normalizeVolatile(section.text)).digest('hex').slice(0, 12) }))\n}\n"],"mappings":";;;AAGA,MAAa,mBACX;;;;;AAMF,MAAa,gBACX;;AAGF,MAAa,gBAAgB;CAAE,MAAM;CAAqB,OAAO;AAAK;;AAGtE,MAAa,mBAAmB;;AAGhC,MAAM,cAAgD;CACpD,6BAA6B;CAC7B,6BAA6B;CAC7B,uBAAuB;CACvB,qBAAqB;AACvB;;AAeA,SAAgB,QAAQ,aAA6B;CACnD,MAAM,QAAQ,YAAY;CAC1B,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,MAAM,YAAY,YAAY,CAAC,CAAC,QAAQ,kBAAkB,GAAG,CAAC,CAAC,QAAQ,aAAa,EAAE,CAAC,CAAC,QAAQ,QAAQ,EAAE;CAChH,OAAO,QAAQ,KAAK,YAAY;AAClC;;AAGA,MAAM,iBAAiB,SAA0B,0CAA0C,KAAK,KAAK,KAAK,CAAC;;;;;;;AAQ3G,SAAgB,cAAc,UAAoC,UAAwB,CAAC,GAAoB;CAC7G,MAAM,WAAW,QAAQ,YAAA;CACzB,MAAM,cAAc,QAAQ,eAAe;CAC3C,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,MAAuB,CAAC;CAC9B,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,QAAQ,SAAA,oBAA2B;GACrC,IAAI,KAAK;IAAE,MAAM,QAAQ;IAAM,MAAM;GAAS,CAAC;GAC/C;EACF;EACA,MAAM,OAAO,OAAO,QAAQ,QAAQ,EAAE;EACtC,IAAI,aAAa,KAAK,KAAK,MAAM,IAAI;EACrC,IAAI,CAAC,eAAe,cAAc,IAAI,GAAG;GACvC,IAAI,KAAK;IAAE,MAAM,QAAQ;IAAM;GAAK,CAAC;GACrC;EACF;EACA,MAAM,MAAM,QAAQ,QAAQ,IAAI;EAChC,IAAI,KAAK;GAAE,MAAM,QAAQ;GAAM,MAAM,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE,MAAM,IAAI;EAAG,CAAC;CAC9E;CACA,OAAO;AACT;;AAGA,SAAgB,kBAAkB,MAAsB;CACtD,OAAO,OAAO,QAAQ,EAAE,CAAC,CAAC,QAAQ,+CAA+C,WAAW;AAC9F;;;;;AAMA,SAAgB,iBAAiB,UAAsE;CACrG,OAAO,SACJ,QAAO,YAAW,CAAC,QAAQ,KAAK,WAAW,QAAQ,CAAC,CAAC,CACrD,KAAI,aAAY;EAAE,MAAM,QAAQ;EAAM,MAAM,WAAW,QAAQ,CAAC,CAAC,OAAO,kBAAkB,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;CAAE,EAAE;AAC3I"}
1
+ {"version":3,"file":"transform.js","names":[],"sources":["../src/transform.ts"],"sourcesContent":["import { createHash } from 'node:crypto'\n\n/**\n * pi.dev opens its prompt with one identity line (\"You are an expert coding assistant operating inside pi, ...\"). This is ACRYL's; a product built\n * on ACRYL passes its own line through the plugin's `identity` config (the Blends frame does, in every app's composition).\n */\nexport const DEFAULT_IDENTITY =\n 'You are an expert coding assistant operating inside ACRYL, a coding agent harness that can extend itself with plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing ACRYL extensions when asked.'\n\n/**\n * How the agent writes its replies to the person: plain words, short, and with a plain dash instead of an em dash (the owner's rule for everything\n * ACRYL writes, which a model otherwise breaks in nearly every answer).\n */\nexport const DEFAULT_STYLE =\n 'Write replies in plain, short sentences the person can act on. Never use the em dash character (U+2014) or the en dash (U+2013) in replies, code comments or files you write; use a plain hyphen-minus (-) or a comma instead.'\n\n/** The reply style's section: right after the identity line (the harness identity is -1000, the deployment persona 0). */\nexport const STYLE_SECTION = { name: 'acryl:reply-style', order: -900 } as const\n\n/** Section names the harness registers for its identity line. */\nexport const IDENTITY_SECTION = 'harness:identity'\n\n/** Readable tag names for sections whose harness name is not tag-friendly (pi.dev uses tags such as `docs`, `cwd`, `skills`). */\nconst TAG_ALIASES: Readonly<Record<string, string>> = {\n 'deployment:persona-prefix': 'persona',\n 'deployment:persona-suffix': 'cwd',\n 'acryl:plugin-router': 'acryl_plugin_docs',\n 'acryl:reply-style': 'reply_style',\n}\n\n/** One section of the assembled prompt, as the harness's `system-prompt/assemble` waterfall carries it. */\nexport interface PromptSection {\n readonly name: string\n readonly text: string\n}\n\nexport interface ShapeOptions {\n readonly identity?: string\n readonly tagSections?: boolean\n readonly dropEmpty?: boolean\n}\n\n/** `tool:read` becomes `tool_read`; anything outside `[a-z0-9_-]` becomes `_`, and a tag never starts with a digit or separator. */\nexport function tagName(sectionName: string): string {\n const alias = TAG_ALIASES[sectionName]\n if (alias !== undefined) return alias\n const tag = sectionName.toLowerCase().replace(/[^a-z0-9_-]+/gu, '_').replace(/^[^a-z]+/u, '').replace(/_+$/u, '')\n return tag === '' ? 'section' : tag\n}\n\n/** A section whose text already is one complete tagged block (the plugin docs router carries its own tag). */\nconst alreadyTagged = (text: string): boolean => /^<([a-z][a-z0-9_-]*)>[\\s\\S]*<\\/\\1>\\s*$/u.test(text.trim())\n\n/**\n * Shape the harness's assembled sections the way pi.dev's `buildSystemPromptSections` shapes its own: an untagged opening identity line,\n * then every other section as a tagged block, with empty sections dropped. Nothing else is rewritten: every section that is not the\n * identity passes through with its upstream text unchanged, so upstream improvements to tool guidance still reach the model.\n * @param sections - upstream sections in final order.\n */\nexport function shapeSections(sections: readonly PromptSection[], options: ShapeOptions = {}): PromptSection[] {\n const identity = options.identity ?? DEFAULT_IDENTITY\n const tagSections = options.tagSections ?? true\n const dropEmpty = options.dropEmpty ?? true\n const out: PromptSection[] = []\n for (const section of sections) {\n if (section.name === IDENTITY_SECTION) {\n out.push({ name: section.name, text: identity })\n continue\n }\n const text = String(section.text ?? '')\n if (dropEmpty && text.trim() === '') continue\n if (!tagSections || alreadyTagged(text)) {\n out.push({ name: section.name, text })\n continue\n }\n const tag = tagName(section.name)\n out.push({ name: section.name, text: `<${tag}>\\n${text.trim()}\\n</${tag}>` })\n }\n return out\n}\n\n/** Text that legitimately differs per run (the web surface section names its random local port) must not look like drift. */\nexport function normalizeVolatile(text: string): string {\n return String(text ?? '').replace(/\\b(127\\.0\\.0\\.1|localhost|0\\.0\\.0\\.0):\\d+/gu, '$1:<port>')\n}\n\n/**\n * What upstream contributed, for drift detection: name and a short hash of the text, excluding ACRYL's own sections (they carry\n * machine-specific paths and are ours to change). Variables such as `{{cwd}}` are not yet interpolated at this stage, so the hashes are stable.\n */\nexport function upstreamSnapshot(sections: readonly PromptSection[]): { name: string; hash: string }[] {\n return sections\n .filter(section => !section.name.startsWith('acryl:'))\n .map(section => ({ name: section.name, hash: createHash('sha256').update(normalizeVolatile(section.text)).digest('hex').slice(0, 12) }))\n}\n"],"mappings":";;;;;;AAMA,MAAa,mBACX;;;;;AAMF,MAAa,gBACX;;AAGF,MAAa,gBAAgB;CAAE,MAAM;CAAqB,OAAO;AAAK;;AAGtE,MAAa,mBAAmB;;AAGhC,MAAM,cAAgD;CACpD,6BAA6B;CAC7B,6BAA6B;CAC7B,uBAAuB;CACvB,qBAAqB;AACvB;;AAeA,SAAgB,QAAQ,aAA6B;CACnD,MAAM,QAAQ,YAAY;CAC1B,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,MAAM,YAAY,YAAY,CAAC,CAAC,QAAQ,kBAAkB,GAAG,CAAC,CAAC,QAAQ,aAAa,EAAE,CAAC,CAAC,QAAQ,QAAQ,EAAE;CAChH,OAAO,QAAQ,KAAK,YAAY;AAClC;;AAGA,MAAM,iBAAiB,SAA0B,0CAA0C,KAAK,KAAK,KAAK,CAAC;;;;;;;AAQ3G,SAAgB,cAAc,UAAoC,UAAwB,CAAC,GAAoB;CAC7G,MAAM,WAAW,QAAQ,YAAA;CACzB,MAAM,cAAc,QAAQ,eAAe;CAC3C,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,MAAuB,CAAC;CAC9B,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,QAAQ,SAAA,oBAA2B;GACrC,IAAI,KAAK;IAAE,MAAM,QAAQ;IAAM,MAAM;GAAS,CAAC;GAC/C;EACF;EACA,MAAM,OAAO,OAAO,QAAQ,QAAQ,EAAE;EACtC,IAAI,aAAa,KAAK,KAAK,MAAM,IAAI;EACrC,IAAI,CAAC,eAAe,cAAc,IAAI,GAAG;GACvC,IAAI,KAAK;IAAE,MAAM,QAAQ;IAAM;GAAK,CAAC;GACrC;EACF;EACA,MAAM,MAAM,QAAQ,QAAQ,IAAI;EAChC,IAAI,KAAK;GAAE,MAAM,QAAQ;GAAM,MAAM,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE,MAAM,IAAI;EAAG,CAAC;CAC9E;CACA,OAAO;AACT;;AAGA,SAAgB,kBAAkB,MAAsB;CACtD,OAAO,OAAO,QAAQ,EAAE,CAAC,CAAC,QAAQ,+CAA+C,WAAW;AAC9F;;;;;AAMA,SAAgB,iBAAiB,UAAsE;CACrG,OAAO,SACJ,QAAO,YAAW,CAAC,QAAQ,KAAK,WAAW,QAAQ,CAAC,CAAC,CACrD,KAAI,aAAY;EAAE,MAAM,QAAQ;EAAM,MAAM,WAAW,QAAQ,CAAC,CAAC,OAAO,kBAAkB,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;CAAE,EAAE;AAC3I"}
@@ -1,5 +1,8 @@
1
- /** pi.dev opens its prompt with one identity line ("You are an expert coding assistant operating inside pi, ..."). This is the Blends app builder's. */
2
- export declare const DEFAULT_IDENTITY = "You are an expert coding assistant operating inside an ACRYL Blends app, an app made of Cordis plugins that blend.yaml composes and that you extend by writing plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing the app's plugins when asked.";
1
+ /**
2
+ * pi.dev opens its prompt with one identity line ("You are an expert coding assistant operating inside pi, ..."). This is ACRYL's; a product built
3
+ * on ACRYL passes its own line through the plugin's `identity` config (the Blends frame does, in every app's composition).
4
+ */
5
+ export declare const DEFAULT_IDENTITY = "You are an expert coding assistant operating inside ACRYL, a coding agent harness that can extend itself with plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing ACRYL extensions when asked.";
3
6
  /**
4
7
  * How the agent writes its replies to the person: plain words, short, and with a plain dash instead of an em dash (the owner's rule for everything
5
8
  * ACRYL writes, which a model otherwise breaks in nearly every answer).
package/package.json CHANGED
@@ -1,12 +1,20 @@
1
1
  {
2
2
  "name": "@acrylblends/system-prompt",
3
- "version": "0.1.0",
4
- "description": "ACRYL's own shaping of the system prompt on top of the harness's sections: the app builder's identity, pi.dev-style tagged sections, no empty sections, and a drift record of what upstream contributes",
3
+ "version": "0.2.0",
4
+ "description": "ACRYL's own shaping of the system prompt on top of the harness's sections: ACRYL identity, pi.dev-style tagged sections, no empty sections, and a drift record of what upstream contributes",
5
5
  "license": "MIT",
6
+ "publishConfig": {
7
+ "access": "public",
8
+ "registry": "https://registry.npmjs.org"
9
+ },
6
10
  "repository": {
7
11
  "type": "git",
8
- "url": "git+https://github.com/acrylblends/acrylblends.git",
9
- "directory": "ide/acryl-system-prompt"
12
+ "url": "git+https://github.com/acryldev/acryl.git",
13
+ "directory": "plugins/acryl-system-prompt"
14
+ },
15
+ "homepage": "https://github.com/acryldev/acryl/tree/main/plugins/acryl-system-prompt#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/acryldev/acryl/issues"
10
18
  },
11
19
  "type": "module",
12
20
  "main": "lib/index.js",
@@ -16,24 +24,22 @@
16
24
  "types": "./lib/types/index.d.ts",
17
25
  "default": "./lib/index.js"
18
26
  },
27
+ "./package.json": "./package.json",
19
28
  "./transform": {
20
29
  "types": "./lib/types/transform.d.ts",
21
30
  "default": "./lib/transform.js"
22
- },
23
- "./package.json": "./package.json"
24
- },
25
- "dsh": {
26
- "bundle": {
27
- "patch": "./cordis.patch.yml"
28
31
  }
29
32
  },
30
33
  "files": [
31
34
  "cordis.patch.yml",
32
35
  "lib/**",
36
+ "drift/**",
33
37
  "README.md"
34
38
  ],
35
- "engines": {
36
- "node": "^22.19.0 || >=24.0.0"
39
+ "dsh": {
40
+ "bundle": {
41
+ "patch": "./cordis.patch.yml"
42
+ }
37
43
  },
38
44
  "scripts": {
39
45
  "build": "node scripts/clean.mjs && tsdown && tsc -p tsconfig.json --emitDeclarationOnly",
@@ -42,6 +48,9 @@
42
48
  "check": "pnpm run build && pnpm run typecheck && pnpm run test",
43
49
  "prepack": "pnpm run check"
44
50
  },
51
+ "engines": {
52
+ "node": "^22.19.0 || >=24.0.0"
53
+ },
45
54
  "dependencies": {
46
55
  "@deepseek-ai/schemastery": "~3.18.4"
47
56
  },
@@ -50,9 +59,9 @@
50
59
  },
51
60
  "devDependencies": {
52
61
  "@deepseek-ai/cordis": "4.0.4",
53
- "@types/node": "^24.0.0",
54
- "tsdown": "0.23.0",
62
+ "@types/node": "^22.20.0",
63
+ "tsdown": "0.22.2",
55
64
  "typescript": "6.0.3",
56
- "vitest": "5.0.3"
65
+ "vitest": "4.1.11"
57
66
  }
58
67
  }