@introspection-ai/recipe-documents-docx 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
@@ -4,10 +4,52 @@ The Word (`.docx`) format for the Recipes [`documents` tool](../../../docs/docum
4
4
  `read`, `propose_edits`, `comment`, `respond` and `remove_section`, on paper-docx.
5
5
  `render` is not registered.
6
6
 
7
+ ## With and without a profile
8
+
9
+ The tool is the same either way: the same commands, the same checks, and the original
10
+ is never changed. A profile only adds guidance the agent reads.
11
+
12
+ **Without a profile** — any Word work: editing a policy, filling a template, marking up
13
+ a memo, answering comments.
14
+
7
15
  ```json
8
16
  { "pi": { "documents": [{ "format": "docx" }] } }
9
17
  ```
10
18
 
19
+ The agent gets the core `documents` skill: which command fits which change, how to quote
20
+ text so an edit lands, and what to do when an edit fails. It says nothing about any one
21
+ kind of work, so the Recipe's own skills decide how changes should read.
22
+
23
+ **With `legal-redlining-en-US`** — contract redlines, and responses to the other side's
24
+ redline.
25
+
26
+ ```json
27
+ { "pi": { "documents": [{ "format": "docx", "profile": "legal-redlining-en-US" }] } }
28
+ ```
29
+
30
+ The agent also gets `profiles/legal-redlining-en-us/SKILL.md`, which covers:
31
+
32
+ - planning a first markup by what moves a right, an obligation or a risk;
33
+ - making the changes in `revise` batches, one rationale comment per change;
34
+ - removing a clause with `remove_section`, leaving `Reserved.` so numbering still lines up;
35
+ - answering the other side's changes with counters and replies, so the discussion stays
36
+ visible, rather than accepting or rejecting;
37
+ - writing each rationale as the reason, in your side's voice, never narrating the edit.
38
+
39
+ The profile is generic legal practice. A firm's own positions, playbook and comment
40
+ style belong in the Recipe's skills, beside it.
41
+
42
+ **Your own profile** — for another kind of work with its own way of using the tool,
43
+ write a profile in the Recipe: a folder holding a `SKILL.md` whose frontmatter `name` is
44
+ the folder's name, and point `profile` at it.
45
+
46
+ ```json
47
+ { "pi": { "documents": [{ "format": "docx", "profile": "./profiles/house-style-en-gb" }] } }
48
+ ```
49
+
50
+ [Write your own profile](../../../docs/documents.md#write-your-own-profile) has the
51
+ contract, what a profile should say, and a complete example.
52
+
11
53
  The helpers in `python/` run with the Recipe's `pi.runtime.python` environment, which must
12
54
  provide `paper-docx==0.2.0`. `python/uv.lock` pins what the tests run on.
13
55
 
package/dist/index.d.ts CHANGED
@@ -34,6 +34,11 @@ export declare class DocxDocumentAdapter implements DocumentAdapter {
34
34
  * tools: [documents]
35
35
  * ```
36
36
  */
37
+ /**
38
+ * Contract redlining in US English: how to plan a first markup and answer the
39
+ * other side's redline. A Recipe selects it with `"profile": "legal-redlining-en-US"`.
40
+ */
41
+ export declare const LEGAL_REDLINING_EN_US: string;
37
42
  export declare const docxDocumentFormatModule: import("@introspection-ai/recipes/documents").RecipeDocumentFormatModule;
38
43
  export default docxDocumentFormatModule;
39
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,qCAAqC,CAAC;AAI7C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE1D,sDAAsD;AACtD,eAAO,MAAM,WAAW,QAAsE,CAAC;AAE/F;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,oBAQxC,CAAC;AAEF,qBAAa,mBAAoB,YAAW,eAAe;IAK7C,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAmC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJ1F,QAAQ,CAAC,MAAM,UAAU;IACzB,QAAQ,CAAC,UAAU,YAAI,OAAO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,QAAQ,CAAC,MAAM;IAJ1F,QAAQ,CAAC,MAAM,UAAU;IACzB,QAAQ,CAAC,UAAU,YAAI,OAAO,EAAW;IACzC,QAAQ,CAAC,YAAY,uBAA8B;IAEnD,YAA6B,GAAG,GAAE,MAAM,CAAC,UAAwB,EAAmB,MAAM,SAAc,EAAI;IAE5G,OAAO,CAAC,IAAI;IAIZ,IAAI,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,iBAAiB,2BAEzD;IAED,MAAM,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,mBAAmB,2BAE7D;IAED,YAAY,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,yBAAyB,2BAEzE;IAED,OAAO,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,oBAAoB,2BAE/D;IAED,OAAO,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,oBAAoB,2BAE/D;IAED,aAAa,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,0BAA0B,2BAE3E;CACF;AAED;;;;;;;;;;GAUG;AACH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAwF,CAAC;AAE3H,eAAO,MAAM,wBAAwB,0EAMnC,CAAC;eAEY,wBAAwB"}
package/dist/index.js CHANGED
@@ -61,10 +61,16 @@ export class DocxDocumentAdapter {
61
61
  * tools: [documents]
62
62
  * ```
63
63
  */
64
+ /**
65
+ * Contract redlining in US English: how to plan a first markup and answer the
66
+ * other side's redline. A Recipe selects it with `"profile": "legal-redlining-en-US"`.
67
+ */
68
+ export const LEGAL_REDLINING_EN_US = fileURLToPath(new URL("../profiles/legal-redlining-en-us/SKILL.md", import.meta.url));
64
69
  export const docxDocumentFormatModule = createDocumentFormatModule({
65
70
  format: "docx",
66
71
  extensions: [".docx"],
67
72
  capabilities: DOCX_DOCUMENT_CAPABILITIES,
73
+ profiles: { "legal-redlining-en-US": LEGAL_REDLINING_EN_US },
68
74
  createAdapter: ({ env }) => new DocxDocumentAdapter(env),
69
75
  });
70
76
  export default docxDocumentFormatModule;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,0BAA0B,GAW3B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE1D,sDAAsD;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,0BAA0B,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/F;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAyB;IAC9D,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,IAAI;IACnB,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,MAAM,OAAO,mBAAmB;IAKD,GAAG;IAAoD,MAAM;IAJjF,MAAM,GAAG,MAAM,CAAC;IAChB,UAAU,GAAG,CAAC,OAAO,CAAU,CAAC;IAChC,YAAY,GAAG,0BAA0B,CAAC;IAEnD,YAA6B,GAAG,GAAsB,OAAO,CAAC,GAAG,EAAmB,MAAM,GAAG,WAAW;mBAA3E,GAAG;sBAAoD,MAAM;IAAiB,CAAC;IAEpG,IAAI,CAAC,GAA2B,EAAE,OAAe,EAAE,KAAa;QACtE,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAA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"0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Word (.docx) format for the Introspection Recipes documents tool: tracked edits, comments and responses on paper-docx.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "files": [
11
11
  "dist",
12
+ "profiles",
12
13
  "python/*.py",
13
14
  "python/recipe_documents_docx/*.py",
14
15
  "python/recipe_documents_docx/LICENSE-redline-bench",
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: legal-redlining-en-us
3
+ description: How to use the documents tool for a contract redline, or a response to the other side's redline (profile legal-redlining-en-US). Read it with the documents skill before changing a contract.
4
+ ---
5
+
6
+ # Documents for legal redlining
7
+
8
+ This profile layers on the core `documents` skill. Every change is a tracked change with
9
+ its rationale as a margin comment, written for the other side's lawyer to read.
10
+
11
+ ## A first markup
12
+
13
+ 1. `read` the brief and the whole contract, every part.
14
+ 2. Plan by priority before editing: what moves a right, an obligation or a risk. Leave
15
+ drafting preferences alone unless the brief asks for them.
16
+ 3. Make the changes in one `revise` batch, or as few as possible, in document order. For
17
+ each paragraph give its `paragraph` id, its full revised `text` (copy the current text
18
+ from `read` and change only what must move) and the `rationale`.
19
+ 4. Revise table cells by their ids (`p-105.r2c3`); a short rationale is fine for the cells
20
+ of a row that share a reason.
21
+ 5. Use `propose_edits` for a small fix after a batch, such as one figure, quoted from a
22
+ fresh `read`.
23
+ 6. Remove a whole numbered clause with `remove_section`: it strikes `from`..`through` and
24
+ leaves `Reserved.` after `keep` (the heading), so the numbering after it still lines
25
+ up. Strike a clause's words with `revise` only when the clause stays.
26
+
27
+ ## A response turn
28
+
29
+ Tracked changes and comments in a file aren't always the other side's. Sort them by
30
+ author first: some can be your own side's earlier turn, or your own edits from this
31
+ session. Treat it as a response turn only when the request says the file came back from
32
+ the other side, or the authors show it did. Then, for the other side's markup:
33
+
34
+ - Leave their changes in place and layer yours on top, so they see what you did.
35
+ - `respond` with `counter` answers one of their changes with your own tracked change,
36
+ inside their language, with the rationale on its `thread` when the point has one.
37
+ Prefer it to rejecting: a counter keeps the discussion visible.
38
+ - Agree with `respond` `{action: "reply", thread, text: "Accepted."}`. Accept or reject
39
+ only when the request asks to resolve changes for good, such as cleaning a draft
40
+ before it goes out; those leave no trace.
41
+ - Changes the tool says it can't accept or reject here are for the lawyer to resolve in
42
+ Word: list them in the open decisions.
43
+
44
+ ## Rationale
45
+
46
+ Write each rationale as the reason, in one or two sentences, in your side's voice: what
47
+ the change protects and why the original doesn't work for you. Never narrate the edit
48
+ ("Changed thirty to sixty"); the tracked change already shows it.
49
+
50
+ ## When an edit fails
51
+
52
+ Fix that edit from its reason and the closest text, and resubmit only it. An edit that
53
+ fails twice is skipped: list it under "Edits not applied" in the open decisions, and never
54
+ retry it by widening it to more text. Read the redline back once before you finish and
55
+ check every change has its rationale.