@orderful/droid 0.45.1 → 0.47.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.
Files changed (46) hide show
  1. package/.claude-plugin/plugin.json +4 -1
  2. package/.github/workflows/claude-issue-agent.yml +1 -1
  3. package/CHANGELOG.md +12 -0
  4. package/dist/tools/pii/.claude-plugin/plugin.json +25 -0
  5. package/dist/tools/pii/TOOL.yaml +22 -0
  6. package/dist/tools/pii/agents/pii-scanner.md +85 -0
  7. package/dist/tools/pii/commands/pii.md +33 -0
  8. package/dist/tools/pii/skills/pii/SKILL.md +97 -0
  9. package/dist/tools/pii/skills/pii/references/supported-entities.md +90 -0
  10. package/dist/tools/pii/skills/pii/scripts/presidio-analyze.d.ts +18 -0
  11. package/dist/tools/pii/skills/pii/scripts/presidio-analyze.d.ts.map +1 -0
  12. package/dist/tools/pii/skills/pii/scripts/presidio-analyze.ts +258 -0
  13. package/dist/tools/pii/skills/pii/scripts/presidio-init.d.ts +17 -0
  14. package/dist/tools/pii/skills/pii/scripts/presidio-init.d.ts.map +1 -0
  15. package/dist/tools/pii/skills/pii/scripts/presidio-init.ts +151 -0
  16. package/dist/tools/pii/skills/pii/scripts/presidio-redact.d.ts +21 -0
  17. package/dist/tools/pii/skills/pii/scripts/presidio-redact.d.ts.map +1 -0
  18. package/dist/tools/pii/skills/pii/scripts/presidio-redact.ts +294 -0
  19. package/dist/tools/pii/skills/pii/scripts/presidio.test.ts +444 -0
  20. package/dist/tools/project/.claude-plugin/plugin.json +1 -1
  21. package/dist/tools/project/TOOL.yaml +2 -2
  22. package/dist/tools/project/skills/project/SKILL.md +4 -3
  23. package/dist/tools/project/skills/project/references/changelog.md +10 -21
  24. package/dist/tools/project/skills/project/references/creating.md +12 -2
  25. package/dist/tools/project/skills/project/references/loading.md +2 -1
  26. package/dist/tools/project/skills/project/references/templates.md +115 -71
  27. package/dist/tools/project/skills/project/references/updating.md +78 -4
  28. package/package.json +1 -1
  29. package/src/tools/pii/.claude-plugin/plugin.json +25 -0
  30. package/src/tools/pii/TOOL.yaml +22 -0
  31. package/src/tools/pii/agents/pii-scanner.md +85 -0
  32. package/src/tools/pii/commands/pii.md +33 -0
  33. package/src/tools/pii/skills/pii/SKILL.md +97 -0
  34. package/src/tools/pii/skills/pii/references/supported-entities.md +90 -0
  35. package/src/tools/pii/skills/pii/scripts/presidio-analyze.ts +258 -0
  36. package/src/tools/pii/skills/pii/scripts/presidio-init.ts +151 -0
  37. package/src/tools/pii/skills/pii/scripts/presidio-redact.ts +294 -0
  38. package/src/tools/pii/skills/pii/scripts/presidio.test.ts +444 -0
  39. package/src/tools/project/.claude-plugin/plugin.json +1 -1
  40. package/src/tools/project/TOOL.yaml +2 -2
  41. package/src/tools/project/skills/project/SKILL.md +4 -3
  42. package/src/tools/project/skills/project/references/changelog.md +10 -21
  43. package/src/tools/project/skills/project/references/creating.md +12 -2
  44. package/src/tools/project/skills/project/references/loading.md +2 -1
  45. package/src/tools/project/skills/project/references/templates.md +115 -71
  46. package/src/tools/project/skills/project/references/updating.md +78 -4
@@ -1,14 +1,13 @@
1
1
  # Project Templates
2
2
 
3
- Templates vary by `preset` setting.
4
-
5
- ## Markdown Preset (default)
6
-
7
- ### PROJECT.md
3
+ ## PROJECT.md
8
4
 
9
5
  ```markdown
10
6
  ---
7
+ type: project
11
8
  status: active
9
+ created: {today}
10
+ updated: {today}
12
11
  ---
13
12
 
14
13
  # Project: {Name}
@@ -33,15 +32,16 @@ status: active
33
32
 
34
33
  {Architecture, key files, patterns}
35
34
 
35
+ ## Related
36
+
37
+ - {Links to related notes}
38
+
36
39
  ## Changelog
37
40
 
38
41
  See [CHANGELOG.md](CHANGELOG.md) for full history.
39
-
40
- ### 0.1.0 - {today}
41
- - Initial project setup
42
42
  ```
43
43
 
44
- ### CHANGELOG.md
44
+ ## CHANGELOG.md
45
45
 
46
46
  ```markdown
47
47
  # Changelog
@@ -54,58 +54,6 @@ All notable changes to the {Name} project.
54
54
 
55
55
  ---
56
56
 
57
- ## Obsidian Preset
58
-
59
- ### PROJECT.md
60
-
61
- ```markdown
62
- ---
63
- type: project
64
- status: active
65
- created: {today}
66
- updated: {today}
67
- ---
68
-
69
- # Project: {Name}
70
-
71
- {Brief description}
72
-
73
- | | |
74
- |---|---|
75
- | **Version** | 0.1.0 |
76
- | **Started** | {today} |
77
- | **Status** | Active |
78
-
79
- ## Overview
80
-
81
- {**What** this project does, **why** it exists}
82
-
83
- ## Goals
84
-
85
- - {Goal 1}
86
-
87
- ## Technical Details
88
-
89
- {Architecture, key files, patterns}
90
-
91
- ## Related
92
-
93
- - {Links to related notes}
94
-
95
- ## Changelog
96
-
97
- See [[CHANGELOG|full history]].
98
-
99
- ### 0.1.0 - {today}
100
- - Initial project setup
101
- ```
102
-
103
- ### CHANGELOG.md
104
-
105
- Same as markdown preset.
106
-
107
- ---
108
-
109
57
  ## Template Variables
110
58
 
111
59
  | Variable | Expands To |
@@ -115,19 +63,23 @@ Same as markdown preset.
115
63
  | `{name}` | Project name (lowercase) |
116
64
  | `{kebab-name}` | Folder name (kebab-case) |
117
65
 
118
- ## Preset Differences Summary
66
+ ## Link Style
67
+
68
+ Templates show standard markdown links. When `preset` is `obsidian`, substitute wikilinks:
119
69
 
120
- | Feature | Markdown | Obsidian |
121
- |---------|----------|----------|
122
- | Links | `[text](path)` | `[[path\|text]]` |
123
- | YAML properties | Minimal (`status`) | Rich (`type`, `created`, `updated`) |
124
- | Related section | Optional | Included |
70
+ | Standard (markdown) | Wikilink (obsidian) |
71
+ |---------------------|---------------------|
72
+ | `[CHANGELOG.md](CHANGELOG.md)` | `[[CHANGELOG]]` |
73
+ | `[DECISIONS.md](DECISIONS.md)` | `[[DECISIONS]]` |
74
+ | `[WORKLOG.md](WORKLOG.md)` | `[[WORKLOG]]` |
75
+
76
+ This is the only difference between presets — structure, frontmatter, and sections are identical.
125
77
 
126
78
  ---
127
79
 
128
80
  ## Seeded from Codex
129
81
 
130
- When creating with `--from codex:{name}`, use this template variant. Works with both markdown and obsidian presets.
82
+ When creating with `--from codex:{name}`, use this template variant.
131
83
 
132
84
  ### Additional Variables
133
85
 
@@ -145,7 +97,10 @@ When creating with `--from codex:{name}`, use this template variant. Works with
145
97
 
146
98
  ```markdown
147
99
  ---
100
+ type: project
148
101
  status: active
102
+ created: {today}
103
+ updated: {today}
149
104
  codex_source: projects/{codex-name}
150
105
  ---
151
106
 
@@ -190,9 +145,6 @@ Personal working memory for {Name}, seeded from shared codex context.
190
145
  ## Changelog
191
146
 
192
147
  See [CHANGELOG.md](CHANGELOG.md) for full history.
193
-
194
- ### 0.1.0 - {today}
195
- - Project created from codex:{codex-name}
196
148
  ```
197
149
 
198
150
  ### CHANGELOG.md (Seeded)
@@ -218,3 +170,95 @@ When extracting content from codex files:
218
170
 
219
171
  If a section is missing, use placeholder text:
220
172
  - `{To be extracted from codex or filled manually}`
173
+
174
+ ---
175
+
176
+ ## Companion Doc Templates
177
+
178
+ Companion docs are **never** created at project start. They emerge when a project grows enough to benefit from them. See `creating.md` for when each is created.
179
+
180
+ ### DECISIONS.md
181
+
182
+ Create when 3+ decisions have accumulated in PROJECT.md.
183
+
184
+ **Table format (default)** — scales well for projects with many decisions:
185
+
186
+ ```markdown
187
+ ---
188
+ type: decisions
189
+ project: {Name}
190
+ created: {today}
191
+ updated: {today}
192
+ ---
193
+
194
+ # Decisions
195
+
196
+ Key decisions for the {Name} project.
197
+
198
+ | # | Decision | Date | Context |
199
+ |---|----------|------|---------|
200
+ | 1 | {Decision title} | {YYYY-MM-DD} | {Brief rationale or link to discussion} |
201
+ ```
202
+
203
+ **Rich format (alternative)** — for fewer, more significant decisions:
204
+
205
+ ```markdown
206
+ ---
207
+ type: decisions
208
+ project: {Name}
209
+ created: {today}
210
+ updated: {today}
211
+ ---
212
+
213
+ # Decisions
214
+
215
+ Key decisions for the {Name} project.
216
+
217
+ ## 1. {Decision Title}
218
+
219
+ **Date:** {YYYY-MM-DD}
220
+ **Status:** Accepted
221
+
222
+ {2-3 sentences of context and rationale. Link to plan or research doc if one exists.}
223
+ ```
224
+
225
+ Choose the format that fits the project. Table for many small decisions, rich for fewer important ones. Mixing is fine — start with table, expand significant entries to rich format if needed.
226
+
227
+ ### WORKLOG.md
228
+
229
+ Create when PROJECT.md exceeds ~300 lines with completed work items that can be archived.
230
+
231
+ ```markdown
232
+ ---
233
+ type: worklog
234
+ project: {Name}
235
+ created: {today}
236
+ updated: {today}
237
+ ---
238
+
239
+ # Worklog
240
+
241
+ Completed work for the {Name} project. Newest first.
242
+
243
+ ## {Title of completed work}
244
+
245
+ {YYYY-MM-DD} · PR #{number} · [plan link if exists]
246
+
247
+ {1-3 sentence narrative of what was done and why it mattered.}
248
+
249
+ ---
250
+
251
+ ## {Older completed work}
252
+
253
+ {YYYY-MM-DD}
254
+
255
+ {Brief narrative.}
256
+ ```
257
+
258
+ ### Worklog Entry Guidelines
259
+
260
+ - **Title:** Descriptive, in past tense ("Restructured PROJECT.md", "Added permission controls")
261
+ - **Metadata line:** Date is required, PR and plan links are optional
262
+ - **Narrative:** Brief — it's an index, not a retelling. Link out to plans, research, PRs for detail.
263
+ - **Order:** Reverse chronological (newest first)
264
+ - **Separator:** Use `---` between entries for readability
@@ -17,18 +17,25 @@
17
17
  - Important file paths or code locations
18
18
  - Bug fixes or gotchas encountered
19
19
 
20
- 3. **If significant new information found:**
20
+ 3. **Size check** (read current PROJECT.md and count lines):
21
+ - **Under ~300 lines:** Proceed normally
22
+ - **300–400 lines:** Look for archival opportunities — mention them in your proposal
23
+ - **Over 400 lines:** Actively identify content to archive (see "Archival to WORKLOG.md" below)
24
+
25
+ 4. **If significant new information found:**
21
26
  - Propose specific sections/content to add or update
27
+ - Include archival proposals if the size check warrants it
22
28
  - Show what will be changed
23
29
  - Ask for confirmation before proceeding
24
30
 
25
- 4. **If no obvious updates:**
31
+ 5. **If no obvious updates:**
26
32
  - Ask what the user would like to update
27
33
  - Suggest sections: metadata, implementation details, technical decisions, notes
28
34
 
29
- 5. **After approval:**
35
+ 6. **After approval:**
30
36
  - Read current project file
31
37
  - Make approved updates, preserving existing structure
38
+ - Route decisions appropriately (see "Decisions Routing" below)
32
39
  - Determine version bump (see `versioning.md`)
33
40
  - Add changelog entry (see `changelog.md`)
34
41
  - Confirm what was updated
@@ -46,7 +53,74 @@ Good project updates include:
46
53
  | **Progress** | "Completed validation layer, starting on UI" |
47
54
  | **File locations** | "Key files: `src/services/template.service.ts`" |
48
55
 
49
- ## Example
56
+ ## Decisions Routing
57
+
58
+ Decisions are captured differently depending on whether the project has a DECISIONS.md companion doc:
59
+
60
+ 1. **DECISIONS.md exists** → Add new decisions there. Add a brief reference in PROJECT.md only when the decision directly affects active work.
61
+ 2. **DECISIONS.md does not exist AND 3+ decisions in PROJECT.md** → Offer to create DECISIONS.md (from template in `templates.md`) and migrate existing decisions. Keep a summary reference in PROJECT.md.
62
+ 3. **Fewer than 3 decisions** → Keep inline in PROJECT.md as usual.
63
+
64
+ When migrating, preserve the original decision date and context. Remove the detailed decision content from PROJECT.md, leaving just a "See DECISIONS.md" reference in the relevant section.
65
+
66
+ ## Archival to WORKLOG.md
67
+
68
+ When the size check identifies archival opportunities, propose moving completed work items to a WORKLOG.md companion doc.
69
+
70
+ ### What to archive
71
+
72
+ - **Completed** Current Work items (fully shipped, no active follow-ups)
73
+ - **Previous Work** or **Done** sections
74
+ - Inline decision tables with 5+ entries (migrate to DECISIONS.md instead)
75
+ - Historical context that's useful for reference but not needed in active context
76
+
77
+ ### What NOT to archive
78
+
79
+ - Active or in-progress work items
80
+ - Technical details still relevant to current work
81
+ - Architectural patterns or constraints that guide ongoing development
82
+ - The Overview, Goals, or metadata sections
83
+
84
+ ### Archival procedure
85
+
86
+ 1. **Identify candidates** — List completed items with their approximate line counts
87
+ 2. **Propose archival** — Show before/after line counts so the user sees the impact:
88
+ ```
89
+ PROJECT.md is currently 427 lines. Proposed archival:
90
+ - "Completed: Permission Controls" (~35 lines) → WORKLOG.md
91
+ - "Completed: Template Rendering" (~28 lines) → WORKLOG.md
92
+ - Inline decisions table (12 entries) → DECISIONS.md
93
+
94
+ After: ~340 lines (saved ~87 lines)
95
+ ```
96
+ 3. **Create companion doc** if needed — Use templates from `templates.md`
97
+ 4. **Convert to worklog entries** — Condense each item to title + metadata line + 1-3 sentence narrative (see template guidelines)
98
+ 5. **Remove from PROJECT.md** — Delete the detailed content, not the section headers
99
+ 6. **Verify** — Confirm the archived content is preserved in the companion doc
100
+
101
+ ### Example
102
+
103
+ ```
104
+ User: /project update
105
+
106
+ Claude: I'll update #project-transaction-templates with learnings from this session.
107
+
108
+ PROJECT.md is 382 lines — I also found archival opportunities.
109
+
110
+ Proposed changes:
111
+ - Add "Batch Processing" to Current Work with the patterns we established
112
+ - Note the decision to use streaming for large payloads
113
+
114
+ Proposed archival (saves ~45 lines):
115
+ - "Permission Controls" (completed 2026-01-15) → WORKLOG.md
116
+ - "Template Validation" (completed 2026-02-01) → WORKLOG.md
117
+
118
+ This is a minor version bump (0.16.0 → 0.17.0).
119
+
120
+ Proceed with these updates?
121
+ ```
122
+
123
+ ## Example (standard update)
50
124
 
51
125
  ```
52
126
  User: /project update
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orderful/droid",
3
- "version": "0.45.1",
3
+ "version": "0.47.0",
4
4
  "description": "AI workflow toolkit for sharing skills, commands, and agents across the team",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "droid-pii",
3
+ "version": "0.1.0",
4
+ "description": "Detect and redact PII (personally identifiable information) in text files. Powered by Microsoft Presidio with a bundled Python venv — zero external dependencies after first run.",
5
+ "author": {
6
+ "name": "Orderful",
7
+ "url": "https://github.com/orderful"
8
+ },
9
+ "repository": "https://github.com/orderful/droid",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "droid",
13
+ "ai",
14
+ "pii"
15
+ ],
16
+ "skills": [
17
+ "./skills/pii/SKILL.md"
18
+ ],
19
+ "commands": [
20
+ "./commands/pii.md"
21
+ ],
22
+ "agents": [
23
+ "./agents/pii-scanner.md"
24
+ ]
25
+ }
@@ -0,0 +1,22 @@
1
+ name: pii
2
+ description: "Detect and redact PII (personally identifiable information) in text files. Powered by Microsoft Presidio with a bundled Python venv — zero external dependencies after first run."
3
+ version: 0.1.0
4
+ status: beta
5
+
6
+ includes:
7
+ skills:
8
+ - name: pii
9
+ required: true
10
+ commands:
11
+ - name: pii
12
+ is_alias: false
13
+ agents:
14
+ - pii-scanner
15
+
16
+ dependencies: []
17
+
18
+ prerequisites:
19
+ - name: python3
20
+ description: "Python 3.8+ required to run the Presidio venv"
21
+ check: "python3 --version"
22
+ install_hint: "Install Python 3 from python.org or via: brew install python3"
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: pii-scanner
3
+ description: "Isolated PII analysis agent. Runs presidio-analyze.ts in a contained context so raw entity values never appear in the parent conversation. Use PROACTIVELY when the pii skill delegates scan operations."
4
+ tools:
5
+ - Bash
6
+ color: orange
7
+ ---
8
+
9
+ You are a PII scanning agent. Your sole job is to run `presidio-analyze.ts` on a file or text and return a structured summary — without leaking raw PII values into the conversation.
10
+
11
+ ## Inputs
12
+
13
+ You will receive:
14
+
15
+ 1. `file_path` — absolute path to the file to scan (preferred), OR
16
+ 2. `text_content` — inline text to scan (for small strings only)
17
+ 3. `entities` (optional) — comma-separated list of entity types to filter (e.g. `EMAIL_ADDRESS,PHONE_NUMBER`)
18
+ 4. `venv_path` (optional) — override for the Presidio venv path (default: `~/.droid/runtimes/presidio/`)
19
+
20
+ ## Rules
21
+
22
+ - **Never echo raw PII values** in your output — return entity types, counts, and line numbers only
23
+ - Make exactly one Bash call to `presidio-analyze.ts`
24
+ - Parse the JSON result and return only the structured summary
25
+ - If the script returns `init_required: true`, stop and tell the parent skill to run `presidio-init.ts` first
26
+ - If the file does not exist, return a clear error
27
+
28
+ ## Procedure
29
+
30
+ 1. Build the command:
31
+ ```bash
32
+ droid exec pii presidio-analyze --file <file_path> [--entities <types>]
33
+ ```
34
+ (Use `--text` only for inline strings under ~1000 characters)
35
+
36
+ 2. Parse the JSON output from the script
37
+
38
+ 3. From the `entities` array, compute:
39
+ - `total_entities`: total count
40
+ - `by_type`: entity type → count map
41
+ - `lines_affected`: sorted unique list of line numbers
42
+ - `sample_lines`: up to 5 line numbers with the entity types found on each line
43
+
44
+ 4. Return the structured summary (see Output Format below)
45
+
46
+ ## Output Format
47
+
48
+ Return JSON:
49
+
50
+ ```json
51
+ {
52
+ "file": "/path/to/file.md",
53
+ "total_entities": 3,
54
+ "by_type": {
55
+ "EMAIL_ADDRESS": 2,
56
+ "PHONE_NUMBER": 1
57
+ },
58
+ "lines_affected": [4, 8, 12],
59
+ "sample_lines": [
60
+ { "line": 4, "types": ["EMAIL_ADDRESS"] },
61
+ { "line": 8, "types": ["PHONE_NUMBER"] },
62
+ { "line": 12, "types": ["EMAIL_ADDRESS"] }
63
+ ]
64
+ }
65
+ ```
66
+
67
+ If no entities are found:
68
+ ```json
69
+ {
70
+ "file": "/path/to/file.md",
71
+ "total_entities": 0,
72
+ "by_type": {},
73
+ "lines_affected": [],
74
+ "sample_lines": []
75
+ }
76
+ ```
77
+
78
+ If an error occurs:
79
+ ```json
80
+ {
81
+ "file": "/path/to/file.md",
82
+ "error": "...",
83
+ "init_required": true
84
+ }
85
+ ```
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: pii
3
+ description: "Detect and redact PII (personally identifiable information) in files and directories. Powered by Microsoft Presidio."
4
+ argument-hint: "[scan | redact] {file|dir} [--entities TYPES] [--output PATH] [--dry-run] [--mask]"
5
+ ---
6
+
7
+ # /pii
8
+
9
+ **User invoked:** `/pii $ARGUMENTS`
10
+
11
+ **Your task:** Invoke the **pii skill** with these arguments.
12
+
13
+ ## Examples
14
+
15
+ - `/pii scan transcript.md`
16
+ - `/pii scan ./meeting-notes/`
17
+ - `/pii redact transcript.md --output transcript-clean.md`
18
+ - `/pii redact transcript.md --dry-run`
19
+ - `/pii redact transcript.md --entities PHONE_NUMBER,EMAIL_ADDRESS`
20
+
21
+ ## Quick Reference
22
+
23
+ ```bash
24
+ /pii scan {file} # Scan file for PII
25
+ /pii scan {dir} # Scan directory recursively
26
+ /pii redact {file} # Redact PII (writes {file}-redacted.{ext})
27
+ /pii redact {file} --output {out} # Redact to specific output path
28
+ /pii redact {file} --dry-run # Preview redactions without writing
29
+ /pii redact {file} --entities TYPES # Redact only specific entity types
30
+ /pii redact {file} --mask # Use *** instead of <ENTITY_TYPE>
31
+ ```
32
+
33
+ See the **pii skill** for full behaviour, procedure, and supported entity types.
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: pii
3
+ description: "Detect and redact PII in text files and directories. Use when scanning files for sensitive data before sharing, or redacting emails, phone numbers, credit cards, SSNs, and other PII. User prompts like '/pii scan transcript.md' or '/pii redact meeting-notes/ --dry-run'."
4
+ argument-hint: "[scan | redact] {file|dir} [--entities TYPES] [--output PATH] [--dry-run] [--mask]"
5
+ allowed-tools: [Read, Glob, Grep, Bash, Task]
6
+ ---
7
+
8
+ # PII Skill
9
+
10
+ Detect and redact personally identifiable information using Microsoft Presidio — deterministic pattern matching + NER, fully offline after first run.
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ /pii scan transcript.md # Scan a file for PII
16
+ /pii scan ./meeting-notes/ # Scan a directory recursively
17
+ /pii redact transcript.md # Redact PII in-place (writes to transcript-redacted.md)
18
+ /pii redact transcript.md --output clean.md # Redact to specific output file
19
+ /pii redact transcript.md --dry-run # Preview redactions without writing
20
+ /pii redact transcript.md --entities PHONE_NUMBER,EMAIL_ADDRESS # Redact specific types only
21
+ /pii redact transcript.md --mask # Use *** instead of <ENTITY_TYPE> placeholders
22
+ ```
23
+
24
+ ## Procedure
25
+
26
+ ### Step 0: Ensure Presidio venv is ready
27
+
28
+ Before any scan or redact operation, verify the venv exists:
29
+
30
+ ```bash
31
+ droid exec pii presidio-init
32
+ ```
33
+
34
+ On first run this takes ~2–3 min (downloads Presidio packages + spaCy en_core_web_lg model). Subsequent runs return immediately (`already_existed: true`).
35
+
36
+ If init fails, surface the error and stop — do not attempt to run analysis without the venv.
37
+
38
+ ### Step 1: Route on subcommand
39
+
40
+ Parse the first argument:
41
+ - `scan` → proceed to Step 2
42
+ - `redact` → proceed to Step 3
43
+ - anything else → show usage and stop
44
+
45
+ ### Step 2: Scan (delegate to pii-scanner agent)
46
+
47
+ The `pii-scanner` agent runs analysis in an isolated context so raw PII values never appear in the parent conversation.
48
+
49
+ **For a single file:**
50
+ Delegate to the `pii-scanner` agent with `file_path` set to the absolute path.
51
+
52
+ **For a directory:**
53
+ Use `Glob` to find text files matching: `**/*.{md,txt,ts,js,json,yaml,yml,csv,html,xml}`
54
+ Delegate each file to `pii-scanner` individually and aggregate results.
55
+
56
+ **Display results:**
57
+ Show entity types, counts, and affected line numbers only — never print raw PII values.
58
+
59
+ Example output:
60
+ ```
61
+ transcript.md: 3 PII entities found
62
+ EMAIL_ADDRESS × 2 (lines 4, 12)
63
+ PHONE_NUMBER × 1 (line 8)
64
+ ```
65
+
66
+ ### Step 3: Redact (run presidio-redact.ts directly)
67
+
68
+ ```bash
69
+ droid exec pii presidio-redact \
70
+ --file <path> \
71
+ [--output <path>] \
72
+ [--dry-run] \
73
+ [--entities <TYPES>] \
74
+ [--mask]
75
+ ```
76
+
77
+ Parse the JSON result and display:
78
+ - Number of entities found and redacted
79
+ - Output file path (if written)
80
+ - In `--dry-run` mode: show a brief diff preview (first 10 redacted lines), but do NOT echo the full `redacted_text` field by default
81
+
82
+ **Never echo `redacted_text` in full to the terminal** unless the user explicitly requests it.
83
+
84
+ ### Step 4: Format and present results
85
+
86
+ - Always show: entity type, count, affected lines
87
+ - On success for redact: confirm output path and entity counts
88
+ - On failure: surface the error from the script's `error` field with actionable next steps
89
+
90
+ ## Behaviour Rules
91
+
92
+ - **Never print raw PII values** to the terminal — always show types + line numbers only
93
+ - For `--dry-run` redact, show a preview diff (10 lines max) not the full document
94
+ - If `python3` is not found, show a clear install message from the prerequisite check
95
+ - Binary files and unknown extensions are skipped during directory scans
96
+ - The `pii-scanner` agent handles the isolation boundary for `scan`; `redact` operates directly since the redacted output is the goal
97
+ - Supported entity types are listed in `references/supported-entities.md`