@datafog/fogclaw 0.2.0 → 0.3.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 (103) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/backlog-tools.d.ts +57 -0
  3. package/dist/backlog-tools.d.ts.map +1 -0
  4. package/dist/backlog-tools.js +173 -0
  5. package/dist/backlog-tools.js.map +1 -0
  6. package/dist/backlog.d.ts +82 -0
  7. package/dist/backlog.d.ts.map +1 -0
  8. package/dist/backlog.js +169 -0
  9. package/dist/backlog.js.map +1 -0
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +6 -0
  12. package/dist/config.js.map +1 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +87 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/message-sending-handler.d.ts +2 -1
  18. package/dist/message-sending-handler.d.ts.map +1 -1
  19. package/dist/message-sending-handler.js +5 -1
  20. package/dist/message-sending-handler.js.map +1 -1
  21. package/dist/tool-result-handler.d.ts +2 -1
  22. package/dist/tool-result-handler.d.ts.map +1 -1
  23. package/dist/tool-result-handler.js +5 -1
  24. package/dist/tool-result-handler.js.map +1 -1
  25. package/dist/types.d.ts +15 -0
  26. package/dist/types.d.ts.map +1 -1
  27. package/dist/types.js.map +1 -1
  28. package/openclaw.plugin.json +11 -1
  29. package/package.json +7 -1
  30. package/.github/workflows/harness-docs.yml +0 -30
  31. package/AGENTS.md +0 -28
  32. package/docs/DATA.md +0 -28
  33. package/docs/DESIGN.md +0 -17
  34. package/docs/DOMAIN_DOCS.md +0 -30
  35. package/docs/FRONTEND.md +0 -24
  36. package/docs/OBSERVABILITY.md +0 -32
  37. package/docs/PLANS.md +0 -171
  38. package/docs/PRODUCT_SENSE.md +0 -20
  39. package/docs/RELIABILITY.md +0 -60
  40. package/docs/SECURITY.md +0 -52
  41. package/docs/design-docs/core-beliefs.md +0 -17
  42. package/docs/design-docs/index.md +0 -8
  43. package/docs/generated/README.md +0 -36
  44. package/docs/generated/memory.md +0 -1
  45. package/docs/plans/2026-02-16-fogclaw-design.md +0 -172
  46. package/docs/plans/2026-02-16-fogclaw-implementation.md +0 -1606
  47. package/docs/plans/README.md +0 -15
  48. package/docs/plans/active/2026-02-16-feat-openclaw-official-submission-plan.md +0 -386
  49. package/docs/plans/active/2026-02-17-feat-release-fogclaw-via-datafog-package-plan.md +0 -328
  50. package/docs/plans/active/2026-02-17-feat-submit-fogclaw-to-openclaw-plan.md +0 -244
  51. package/docs/plans/active/2026-02-17-feat-tool-result-pii-scanning-plan.md +0 -293
  52. package/docs/plans/tech-debt-tracker.md +0 -42
  53. package/docs/plugins/fogclaw.md +0 -101
  54. package/docs/runbooks/address-review-findings.md +0 -30
  55. package/docs/runbooks/ci-failures.md +0 -46
  56. package/docs/runbooks/code-review.md +0 -34
  57. package/docs/runbooks/merge-change.md +0 -28
  58. package/docs/runbooks/pull-request.md +0 -45
  59. package/docs/runbooks/record-evidence.md +0 -43
  60. package/docs/runbooks/reproduce-bug.md +0 -42
  61. package/docs/runbooks/respond-to-feedback.md +0 -42
  62. package/docs/runbooks/review-findings.md +0 -31
  63. package/docs/runbooks/submit-openclaw-plugin.md +0 -68
  64. package/docs/runbooks/update-agents-md.md +0 -59
  65. package/docs/runbooks/update-domain-docs.md +0 -42
  66. package/docs/runbooks/validate-current-state.md +0 -41
  67. package/docs/runbooks/verify-release.md +0 -69
  68. package/docs/specs/2026-02-16-feat-openclaw-official-submission-spec.md +0 -115
  69. package/docs/specs/2026-02-17-feat-outbound-message-pii-scanning-spec.md +0 -93
  70. package/docs/specs/2026-02-17-feat-submit-fogclaw-to-openclaw.md +0 -125
  71. package/docs/specs/2026-02-17-feat-tool-result-pii-scanning-spec.md +0 -122
  72. package/docs/specs/README.md +0 -5
  73. package/docs/specs/index.md +0 -8
  74. package/docs/spikes/README.md +0 -8
  75. package/fogclaw.config.example.json +0 -33
  76. package/scripts/ci/he-docs-config.json +0 -123
  77. package/scripts/ci/he-docs-drift.sh +0 -112
  78. package/scripts/ci/he-docs-lint.sh +0 -234
  79. package/scripts/ci/he-plans-lint.sh +0 -354
  80. package/scripts/ci/he-runbooks-lint.sh +0 -445
  81. package/scripts/ci/he-specs-lint.sh +0 -258
  82. package/scripts/ci/he-spikes-lint.sh +0 -249
  83. package/scripts/runbooks/select-runbooks.sh +0 -154
  84. package/src/config.ts +0 -183
  85. package/src/engines/gliner.ts +0 -240
  86. package/src/engines/regex.ts +0 -71
  87. package/src/extract.ts +0 -98
  88. package/src/index.ts +0 -381
  89. package/src/message-sending-handler.ts +0 -87
  90. package/src/redactor.ts +0 -51
  91. package/src/scanner.ts +0 -196
  92. package/src/tool-result-handler.ts +0 -133
  93. package/src/types.ts +0 -75
  94. package/tests/config.test.ts +0 -78
  95. package/tests/extract.test.ts +0 -185
  96. package/tests/gliner.test.ts +0 -289
  97. package/tests/message-sending-handler.test.ts +0 -244
  98. package/tests/plugin-smoke.test.ts +0 -250
  99. package/tests/redactor.test.ts +0 -320
  100. package/tests/regex.test.ts +0 -345
  101. package/tests/scanner.test.ts +0 -348
  102. package/tests/tool-result-handler.test.ts +0 -329
  103. package/tsconfig.json +0 -20
@@ -1,42 +0,0 @@
1
- ---
2
- title: "Reproduce Bug"
3
- use_when: "You have a bug report and need a minimal, reliable reproduction with evidence before implementing a fix."
4
- called_from:
5
- - he-implement
6
- - he-video
7
- ---
8
-
9
- # Reproduce Bug
10
-
11
- This runbook is repo-specific and **additive only**. It must not waive or override any gates enforced by skills.
12
-
13
- The goal is a smallest-possible reproducer you can run repeatedly to prove the bug exists and prove it is fixed.
14
-
15
- ## Repro Checklist
16
-
17
- 1. Write down the expected behavior vs observed behavior in plain language.
18
- 2. Reduce to one of:
19
- - a single command (unit/integration test, script, request), or
20
- - a single UI flow script (agent-browser), or
21
- - a single minimal fixture (input file, request payload).
22
- 3. Make it deterministic:
23
- - pin any randomness, time, or external dependencies when possible
24
- - record env/config assumptions
25
-
26
- ## Evidence Capture
27
-
28
- - For UI/behavior: capture a short `failure` video via `he-video`.
29
- - For non-UI: capture terminal output (command + short excerpt) and link it in the plan.
30
-
31
- ## Test Strategy (Preferred)
32
-
33
- - Add a real unit or e2e test that fails on the current state.
34
- - Avoid mock-only tests unless the repo explicitly documents an exception.
35
-
36
- ## Plan Updates
37
-
38
- Update `docs/plans/active/<slug>-plan.md`:
39
-
40
- - `Progress`: add/mark the repro artifact as complete only when repeatable
41
- - `Artifacts and Notes`: link the repro command/script and evidence paths
42
-
@@ -1,42 +0,0 @@
1
- ---
2
- title: "Respond To Feedback"
3
- use_when: "A PR has review comments or requested changes, and you need a consistent loop to address them with evidence and minimal diffs."
4
- called_from:
5
- - he-github
6
- - he-review
7
- - he-implement
8
- ---
9
-
10
- # Respond To Feedback
11
-
12
- This runbook is repo-specific and **additive only**. It must not waive or override any gates enforced by skills.
13
-
14
- Treat feedback as new requirements. The objective is to address comments with the smallest correct change and keep the plan/evidence accurate.
15
-
16
- ## Triage
17
-
18
- 1. Group comments by theme (correctness, security/data, architecture, taste).
19
- 2. Identify which comments require code changes vs explanation-only.
20
- 3. For any comment that is ambiguous or high risk, escalate per `he-review` SKILL.md § Escalation.
21
-
22
- ## Commands (Recommended)
23
-
24
- - Read comments:
25
- - `gh pr view --comments`
26
- - Re-check CI:
27
- - `gh pr checks`
28
- - Pull failed logs:
29
- - `gh run view --log-failed`
30
-
31
- ## Fix Loop
32
-
33
- 1. Make the root-cause fix.
34
- 2. Update tests/e2e evidence as needed.
35
- 3. Update the active plan:
36
- - `Progress` items
37
- - `Review Findings` (if you’re tracking findings there)
38
- - `Artifacts and Notes`
39
- 4. Push and re-check (when approved):
40
- - `git push`
41
- - `gh pr checks`
42
-
@@ -1,31 +0,0 @@
1
- ---
2
- title: "Review Findings"
3
- use_when: "Writing or interpreting review findings in docs/plans/active/<slug>-plan.md under the Review Findings section."
4
- called_from:
5
- - he-review
6
- ---
7
-
8
- # Review Findings
9
-
10
- This runbook is repo-specific and **additive only**. It must not waive or override any gates enforced by skills.
11
-
12
- Review findings must be actionable and verifiable. The goal is to let a future reader fix issues without rediscovering context.
13
-
14
- ## Required Fields
15
-
16
- Each finding includes:
17
-
18
- - priority: `critical|high|medium|low`
19
- - location: file path + symbol or short pointer
20
- - issue summary: what is wrong
21
- - required action: what must change or what proof is missing
22
- - owner: who is responsible (team/name/agent)
23
-
24
- ## Priority Rubric, No-Mocks Policy, Mandatory Coverage
25
-
26
- Canonical definitions live in `he-review` SKILL.md. Add repo-specific examples or exceptions below — do not redefine the severity levels or gate rules.
27
-
28
- ## Acceptance Rules
29
-
30
- - Unresolved `critical` or `high` blocks progression to verify/release.
31
- - `medium` and `low` can proceed only if explicitly accepted in writing in the plan.
@@ -1,68 +0,0 @@
1
- ---
2
- title: "Submitting a third-party plugin for official OpenClaw listing"
3
- called_from:
4
- - he-learn
5
- - he-implement
6
- - he-verify-release
7
- read_when:
8
- - You need to submit an external plugin package for official OpenClaw intake
9
- - You are preparing a reviewable PR to openclaw/openclaw for plugin visibility
10
- ---
11
-
12
- # Submitting a third-party plugin for official OpenClaw listing
13
-
14
- This repository is the third-party plugin source, while OpenClaw core intake is handled through `openclaw/openclaw`. Use this checklist when promoting a plugin from an external repo to official listing visibility.
15
-
16
- ## Scope
17
-
18
- Apply this process for a plugin that is already validated in its own repo and needs official OpenClaw documentation/intake handling.
19
-
20
- ## Prerequisites (in plugin repo)
21
-
22
- - Plugin manifest and metadata validated (`openclaw.plugin.json`, `package.json#openclaw.extensions`, `package.json#name`).
23
- - Plugin smoke/contract checks pass.
24
- - Runtime evidence available for plugin load and behavior.
25
-
26
- ## Prepare upstream fork PR
27
-
28
- Because `openclaw/openclaw` generally expects cross-repo PRs from a fork, use this sequence unless the plugin repo is itself an existing fork.
29
-
30
- 1. Use an org-owned fork as the preferred source (for this repository: `DataFog/openclaw`).
31
- 2. Create a branch in the fork (for example `openclaw-fogclaw-submission`).
32
- 3. Copy only official-listing artifacts from the plugin source repo (typically one or more docs/pages under `docs/plugins/`).
33
- 4. Open PR from the fork branch to `openclaw/openclaw` (base `main`).
34
-
35
- - If an org-owned fork does not exist yet, use the fastest available forking path to open a temporary PR, then migrate to the org-owned fork once created.
36
-
37
- Do **not** include unrelated code changes in this PR unless required by maintainer feedback.
38
-
39
- ## Evidence to include in PR body
40
-
41
- Use a compact, reproducible evidence block:
42
-
43
- - `npm test`
44
- - `npm run build` or `pnpm build` (repo-specific)
45
- - `npm run test:plugin-smoke`
46
- - `npm pkg get openclaw`
47
- - Node import smoke from `dist/index.js`
48
-
49
- ## Useful PR body sections
50
-
51
- - Summary and impact
52
- - What changed and what did not change (scope boundary)
53
- - Security impact
54
- - Commands + expected outputs
55
- - Human verification
56
- - Compatibility/rollback
57
-
58
- ## Review-time guardrails
59
-
60
- - Verify PR template expectations from `.github/pull_request_template.md` in upstream repo.
61
- - Keep PR title clear and scoped to official-listing changes.
62
- - Track maintainer feedback separately; only apply plugin code changes if explicitly requested.
63
-
64
- ## Post-creation tracking
65
-
66
- - Record PR URL, branch/commit, and CI check status in the active initiative plan.
67
- - Keep plugin evidence/release status in sync with maintainer review and upstream merge checks.
68
- - If `@openclaw/<plugin>` is not yet visible in npm, record that as an explicit follow-up item rather than conflating it with code issues.
@@ -1,59 +0,0 @@
1
- ---
2
- title: "Update AGENTS.md"
3
- use_when: "Creating or updating a project's AGENTS.md (agent instructions, conventions, and workflows)."
4
- called_from:
5
- - he-bootstrap
6
- - he-learn
7
- - he-doc-gardening
8
- ---
9
-
10
- # Update AGENTS.md
11
-
12
- This runbook is repo-specific and **additive only**. It must not waive or override any gates enforced by skills.
13
-
14
- AGENTS.md is the agent-facing README: a predictable place to put the few repo-specific instructions an agent needs to work effectively.
15
-
16
- When `he-bootstrap` runs in a repo that already has `AGENTS.md`, it appends a managed block once using:
17
-
18
- - `<!-- he-bootstrap:start -->`
19
- - `<!-- he-bootstrap:end -->`
20
-
21
- Do not edit outside your repo's intended scope when touching this managed block.
22
-
23
- ## What To Optimize For
24
-
25
- - Keep it short and stable (a map, not an encyclopedia).
26
- - Put only high-leverage, repo-specific guidance here: build/test commands, conventions, and hard constraints.
27
- - Add rules over time when you observe repeated failure modes; do not try to predict everything up front.
28
-
29
- ## What To Put Elsewhere
30
-
31
- - Long procedures, checklists, and evolving processes: `docs/runbooks/<topic>.md` and link from AGENTS.md.
32
- - One-off migrations or multi-hour work: a plan/spec doc under `docs/` (not in AGENTS.md).
33
-
34
- ## Minimum Sections (Good Starting Point)
35
-
36
- - Setup commands (install, dev, test, lint) in copy-pastable form.
37
- - Repo map (where the important stuff lives; key entrypoints).
38
- - Conventions (formatting, naming, dependency rules, boundaries).
39
- - Safety and verification (what not to do; how to prove the change works here).
40
- - Runbook index (links into `docs/runbooks/` for process).
41
-
42
- ## Rules Of Thumb When Editing AGENTS.md
43
-
44
- - If it changes often, it probably belongs in a runbook, not AGENTS.md.
45
- - Prefer "When X, do Y" over vague guidance.
46
- - Make requirements verifiable (a command, a file path, an expected output).
47
- - Avoid duplicating information already in `docs/`; link instead.
48
- - Keep any `he-bootstrap` managed block concise and link-first to avoid disrupting existing user conventions.
49
-
50
- ## Quick Update Checklist
51
-
52
- 1. Confirm scope: are you editing the right AGENTS.md for the files you are touching (root vs nested)?
53
- 2. Keep it minimal: can you replace paragraphs with a link to a runbook?
54
- 3. Verify paths/commands exist:
55
-
56
- ```sh
57
- rg -n "docs/runbooks|PLANS\\.md|Runbooks|Setup|test|lint" AGENTS.md
58
- find docs/runbooks -type f -maxdepth 2 -name "*.md" -print
59
- ```
@@ -1,42 +0,0 @@
1
- ---
2
- title: "Update Domain Docs"
3
- use_when: "A change introduces new product/engineering policy (security, reliability, frontend, observability, design) that should be captured as durable guidance for future work."
4
- called_from:
5
- - he-plan
6
- - he-implement
7
- - he-learn
8
- - he-doc-gardening
9
- ---
10
-
11
- # Update Domain Docs
12
-
13
- This runbook is repo-specific and **additive only**. It must not waive or override any gates enforced by skills.
14
-
15
- Domain docs live under `docs/` and capture stable, repo-specific policy. Update them when you learn something that will prevent future bugs, regressions, or confusion.
16
-
17
- ## What Counts As A Domain-Doc Change
18
-
19
- - A recurring decision rule ("we always do X when Y").
20
- - A new constraint or boundary (security model, data sensitivity, performance guardrails).
21
- - An operational expectation (SLOs, monitoring, alerts, rollback rules).
22
- - A UI/UX standard or accessibility requirement.
23
-
24
- If it's a one-off procedure or checklist, prefer a runbook in `docs/runbooks/`.
25
-
26
- ## Where To Put It
27
-
28
- - The registry: `docs/DOMAIN_DOCS.md` (what exists and why).
29
- - The doc itself (when present): `docs/SECURITY.md`, `docs/RELIABILITY.md`, `docs/FRONTEND.md`, `docs/OBSERVABILITY.md`, `docs/DESIGN.md`, `docs/PRODUCT_SENSE.md`.
30
-
31
- ## How To Update (Minimum)
32
-
33
- 1. Add the smallest rule that will prevent the problem from recurring (short, testable language).
34
- 2. Include a concrete anchor:
35
- - a file path, command, config key, or observable behavior.
36
- 3. Avoid long procedures; link to a runbook if needed.
37
- 4. If the change implies enforcement, note the guardrail candidate (lint/test/CI gate) so it can be promoted later.
38
-
39
- ## When To Do This
40
-
41
- - During `he-learn`, when converting "what happened" into durable prevention.
42
- - During review, if you discover undocumented constraints the next contributor will trip over.
@@ -1,41 +0,0 @@
1
- ---
2
- title: "Validate Current State"
3
- use_when: "Starting an initiative and you need to confirm you understand the current behavior, repo state, and baseline signals before changing code."
4
- called_from:
5
- - he-workflow
6
- - he-implement
7
- ---
8
-
9
- # Validate Current State
10
-
11
- This runbook is repo-specific and **additive only**. It must not waive or override any gates enforced by skills.
12
-
13
- This runbook defines the minimum baseline checks before claiming you understand "what's broken" (or "what exists") today.
14
-
15
- ## Repo Baseline
16
-
17
- - Confirm you are in the intended workspace (worktree/branch):
18
- - `git status --short --branch`
19
- - Confirm clean-ish state (or record intentional local changes):
20
- - `git diff`
21
- - Confirm remote + default branch context:
22
- - `git remote -v`
23
-
24
- ## Behavior Baseline (Customize Per Repo)
25
-
26
- Record the exact commands used and a short excerpt of the output in the active plan.
27
-
28
- - Boot the app/service:
29
- - `<command>`
30
- - Run the fastest “is it alive” check:
31
- - `<command>`
32
- - Run targeted tests for the area (if they exist):
33
- - `<command>`
34
-
35
- ## Evidence
36
-
37
- Link evidence from `docs/plans/active/<slug>-plan.md` under:
38
-
39
- - `Surprises & Discoveries` (what you observed)
40
- - `Artifacts and Notes` (logs, screenshots, recordings)
41
-
@@ -1,69 +0,0 @@
1
- ---
2
- title: "Verify/Release"
3
- use_when: "Running he-verify-release to decide GO/NO-GO with evidence, rollback readiness, and post-release checks recorded in the active plan."
4
- called_from:
5
- - he-verify-release
6
- ---
7
-
8
- # Verify/Release
9
-
10
- This runbook is repo-specific and **additive only**. It must not waive or override any gates enforced by skills.
11
-
12
- The skill `he-verify-release` enforces the stable invariants; this document carries the details that change per project. Inputs: active plan (`docs/plans/active/<slug>-plan.md` with `## Verify/Release Decision`) and review findings (populated by `he-review`).
13
-
14
- ## Output
15
-
16
- Fill in `## Verify/Release Decision` with:
17
-
18
- - decision: `GO` or `NO-GO`
19
- - date:
20
- - open findings by priority (if any):
21
- - evidence: links/paths to test output and E2E artifacts
22
- - rollback: exact steps or pointers
23
- - post-release checks: exact checks/queries/URLs
24
- - owner:
25
-
26
- ## Verification Ladder (Customize Per Repo)
27
-
28
- Define the repo's minimum ladder here. Keep it short and ordered.
29
-
30
- 1. Fast checks: format/lint/typecheck (if applicable)
31
- 2. Targeted tests for changed area
32
- 3. Full relevant suite (unit/e2e)
33
- 4. Manual/E2E scenario (required for user-visible changes)
34
-
35
- Document the exact commands for this repo:
36
-
37
- # From repo root:
38
- <command>
39
-
40
- ## Evidence Requirements
41
-
42
- - Prefer evidence that a reviewer can reproduce (commands + short transcripts).
43
- - For UI changes, include screenshots or a short recording (see `docs/runbooks/record-evidence.md`).
44
- - For regressions, include a "before vs after" behavior description in plain language.
45
-
46
- ## Rollback And Recovery
47
-
48
- Record the rollback plan for this repo:
49
-
50
- - What to revert (commit/flag/config)
51
- - How to detect failure
52
- - How to restore service/data (if relevant)
53
-
54
- ## Post-Release Checks
55
-
56
- Record the minimum set of checks to run after merge/release:
57
-
58
- - health checks / smoke path
59
- - key metrics / dashboards (if any)
60
- - error logs / alerts (if any)
61
-
62
- ## Escalation
63
-
64
- If any of these apply, stop and escalate per `he-verify-release` SKILL.md § Escalation:
65
-
66
- - Unclear risk to users/data
67
- - Flaky or non-deterministic failures
68
- - Rollback steps are missing or untested
69
- - Evidence is incomplete but time pressure exists
@@ -1,115 +0,0 @@
1
- ---
2
- slug: 2026-02-16-feat-openclaw-official-submission
3
- status: intake-complete
4
- date: 2026-02-16T17:35:00Z
5
- owner: sidmohan
6
- plan_mode: execution
7
- spike_recommended: no
8
- priority: high
9
- ---
10
-
11
- # Prepare FogClaw for Official OpenClaw Plugin Submission
12
-
13
- ## Purpose / Big Picture
14
- FogClaw already has a working PII/custom-entity redaction core; this initiative is to move it from "feature-complete" to "submission-ready" as an official OpenClaw plugin so maintainers can review and install it directly from the plugin ecosystem with reliable tests and repeatable packaging checks.
15
-
16
- ## Scope
17
-
18
- ### In Scope
19
- - Confirm and, if needed, adjust repository structure and metadata to match OpenClaw plugin submission expectations for official listing.
20
- - Add/standardize verification steps that prove plugin loadability, tool registration, and guardrail hook wiring from a clean checkout.
21
- - Add PR-facing execution evidence (commands + expected outputs) for submission readiness.
22
- - Stabilize test/packaging behavior for CI and maintainers (e.g., deterministic output, clear failure diagnostics) without changing detection algorithms.
23
- - Validate local install path, built artifact correctness, and versioning assumptions used by OpenClaw.
24
-
25
- ### Boundaries
26
- - No changes to regex or GLiNER detection logic (entity patterns, model behavior, labels, or thresholds).
27
- - No new engine integrations, retraining, or additional model support.
28
- - No changes to core OpenClaw platform behavior outside plugin surface.
29
- - No new product features beyond what the plugin already exposes (`before_agent_start`, `fogclaw_scan`, `fogclaw_redact`).
30
-
31
- ## Non-Goals
32
- - Building an alternate PII engine.
33
- - Adding user-facing dashboards or external service integrations.
34
- - Performing a full security audit or formal compliance certification.
35
-
36
- ## Risks
37
- - OpenClaw official plugin submission may have stricter manifest/metadata constraints than what is currently in the repo.
38
- - CI environments used by maintainers may differ from local Node versions and fail model-download or ONNX runtime behaviors unless mocked/guarded appropriately.
39
- - Test expectations can become unstable if packaging assumes environment-specific paths.
40
-
41
- ## Rollout
42
- - Validate locally, then verify against the same commands that CI or reviewers will run.
43
- - Prepare a PR checklist in the issue/PR description with explicit pass/fail commands and artifact outputs.
44
- - Submit/refresh PR only after all acceptance criteria in this spec are met and documented in the review thread.
45
-
46
- ## Validation and Acceptance Signals
47
- - `npm test` passes 100% with no skipped suites.
48
- - `npm run build` completes without TypeScript errors and emits the expected `dist/` entry points.
49
- - Plugin manifest is loadable by OpenClaw with `dist/index.js` as the entry point and valid `openclaw.plugin.json` schema.
50
- - A reviewer can run a minimal smoke test to confirm: guardrail hook executes, `fogclaw_scan` returns entities, and `fogclaw_redact` redacts at least one sample value.
51
- - PR includes a reproducible command log proving plugin installation and invocation in a clean environment.
52
-
53
- ## Requirements
54
-
55
- | ID | Priority | Requirement |
56
- |---|---|---|
57
- | R1 | critical | Confirm plugin metadata and layout match official OpenClaw plugin expectations, including `openclaw.plugin.json` manifest and plugin export surface from `dist/index.js`.
58
- | R2 | high | Establish submission-ready verification commands for loadability, guardrail operation, and tool invocation so a reviewer can validate behavior end-to-end.
59
- | R3 | high | Ensure tests and build are deterministic in CI-like environments, including clear diagnostics when optional GLiNER/ONNX initialization degrades.
60
- | R4 | medium | Document PR submission checklist and expected outputs (exact commands, pass criteria, and known fallbacks) in repository docs.
61
- | R5 | medium | Capture release-readiness constraints and owner decisions that affect publication (version, package name, maintainer expectations) as explicit open questions or constraints.
62
-
63
- ## Chosen Direction (Recommended)
64
- - Proceed with a submission-readiness initiative (rather than adding any new detection features); focus on packaging, validation, and PR evidence as the primary v1 deliverable. This reduces review risk and directly addresses maintainer blockers for the current PR.
65
-
66
- ## Alternatives Considered
67
- - **Address detection logic first** — Rejected because the current engine work appears functionally complete and would delay PR readiness without improving submission eligibility.
68
- - **Open a broad refactor pass first** — Rejected because this would reduce review clarity and increase the risk of introducing regressions during an already time-sensitive submission.
69
-
70
- ## Key Decisions
71
- - Decision: Treat plugin submission hardening as a single, measurable pre-release initiative and keep engine behavior unchanged.
72
- Rationale: Maintainers can review functional and packaging concerns independently; this minimizes risk of review churn and keeps the current plugin semantics stable.
73
-
74
- ## Open Questions
75
- - **[decision]** Which exact OpenClaw ecosystem target (registry path and expected metadata contract) should be used for the first-party listing?
76
- - **[research]** Is a dedicated CI workflow/pipeline required by OpenClaw reviewers beyond existing project checks, and if so what exact command matrix is expected?
77
- - **[planning]** Should we include a semantic release/version-bump policy in this same initiative or defer to a follow-up plan after initial acceptance?
78
-
79
- ## Success Criteria
80
- - All current unit tests remain green (`98` tests passing as baseline).
81
- - A local review command can verify plugin registration and tool availability in one run with no manual code edits.
82
- - PR description includes reproducible evidence covering: bootstrap state, tests, build, plugin smoke test, and any known degradations.
83
- - No functional changes to existing scanning/redaction APIs (signatures and outputs remain as currently implemented).
84
-
85
- ## Constraints
86
- - Maintain Node.js `>=22.0.0` compatibility and existing TypeScript module format (`type: module`).
87
- - Keep GLiNER optional and fallback-safe so environments without model assets still pass plugin-level tests via regex-only flow.
88
- - Preserve current public interfaces in `src/index.ts`, `Scanner`, and redaction utilities.
89
- - Keep the initiative PR-sized and review-friendly: no broad architectural refactor unless required by submission gates.
90
-
91
- ## Tech Preferences
92
- - **Language/runtime**: TypeScript / Node.js 22+.
93
- - **Framework**: OpenClaw plugin API and existing test stack (`vitest`).
94
- - **Infrastructure**: NPM scripts and repository-level CI checks only (no external services required for baseline validation).
95
- - **Rationale**: Minimizes external dependencies and makes the PR reproducible by maintainers.
96
-
97
- ## Reference Artifacts
98
- - None provided by user in this session.
99
-
100
- ## Priority
101
- - priority: high
102
- - rationale: This is a prerequisite for official listing, and unresolved submission-readiness blockers prevent release despite working core features.
103
-
104
- ## Initial Milestone Candidates
105
- - M1: Submission Readiness Baseline — verify manifest, entrypoint, and smoke tests are documented and passing on clean checkout.
106
- - M2: PR Evidence Pack — add concise contributor-facing evidence and rollout instructions for PR reviewers.
107
- - M3: Final Review Gate — cross-check remaining open questions and obtain sign-off to move into `he-plan` and PR merge flow.
108
-
109
- ## Handoff
110
- - Owner hands this artifact to `he-plan` for executable planning.
111
- - `he-plan` should first resolve open questions that block official submission criteria, then sequence changes in small PR-safe milestones.
112
- - After planning, transition target is `he-implement` unless `[research]` or `[spike]` questions remain, in which case route first to `he-research`/`he-spike`.
113
-
114
- ## Revision Notes
115
- - 2026-02-16T17:35:00Z: Initialized spec from existing implementation state and known PR intent. Reason: move from feature-complete code to official OpenClaw submission readiness.
@@ -1,93 +0,0 @@
1
- ---
2
- slug: 2026-02-17-feat-outbound-message-pii-scanning
3
- status: intake-complete
4
- date: 2026-02-17T00:00:00Z
5
- owner: sidmohan
6
- plan_mode: lightweight
7
- spike_recommended: no
8
- priority: high
9
- ---
10
-
11
- # feat: Add PII scanning to outbound messages via message_sending hook
12
-
13
- ## Purpose / Big Picture
14
-
15
- FogClaw now scans user prompts (`before_agent_start`) and tool results (`tool_result_persist`), but outbound messages — the agent's final responses delivered to Telegram, Slack, Discord, etc. — are not scanned. If PII slips through into the agent's response (hallucinated, echoed, or reassembled from partial data), it reaches external channels unredacted.
16
-
17
- By hooking into OpenClaw's `message_sending` lifecycle, FogClaw adds a last-chance gate that scans and redacts PII in outbound messages before they are delivered to recipients.
18
-
19
- Note: `message_sending` is defined in OpenClaw's type system but not yet invoked upstream. This handler will activate automatically when OpenClaw wires the hook into its outbound message flow.
20
-
21
- ## Scope
22
-
23
- ### In Scope
24
-
25
- - Register a `message_sending` hook handler in FogClaw's plugin registration
26
- - Scan `event.content` (outbound message text) using the **full Scanner** (regex + GLiNER) since this hook is async-capable
27
- - Apply existing `guardrail_mode`, `entityActions`, `redactStrategy`, and `allowlist` config
28
- - Redact PII spans in the outbound message content (all modes produce span-level redaction, never cancel)
29
- - Return `{ content: redactedText }` when PII is found
30
- - Emit audit log entries when `auditEnabled: true`
31
- - Add unit tests for the handler
32
- - Extend plugin smoke test
33
-
34
- ### Boundaries
35
-
36
- - **No message cancellation.** FogClaw will never return `cancel: true`. Span-level redaction is always preferred over dropping messages silently.
37
- - **No new config surface.** Reuse existing FogClaw config.
38
- - **No changes to OpenClaw upstream.** Handler will activate when OpenClaw wires the hook.
39
- - **No scanning of `event.metadata`.** Only `event.content` (the text delivered to the recipient).
40
-
41
- ## Non-Goals
42
-
43
- - Cancelling message delivery
44
- - Scanning message metadata or recipient addresses
45
- - Modifying recipient routing
46
-
47
- ## Risks
48
-
49
- - **Hook not invoked upstream.** The handler exists but won't fire until OpenClaw activates `message_sending`. This is accepted — the code is ready and waiting.
50
- - **GLiNER latency on outbound path.** Scanner.scan() is async and may add 50-200ms per message. This is acceptable for outbound messages (not a hot-path like tool_result_persist) and provides coverage for person names and organizations.
51
-
52
- ## Requirements
53
-
54
- | ID | Priority | Requirement |
55
- |---|---|---|
56
- | R1 | critical | Register a `message_sending` hook handler that scans outbound message content for PII using the full Scanner (regex + GLiNER) |
57
- | R2 | critical | Redact detected PII spans using the configured `redactStrategy` |
58
- | R3 | critical | Return `{ content: redactedText }` when PII is found; return void when clean |
59
- | R4 | high | Apply existing `entityActions`, `guardrail_mode`, and `allowlist` config; all actions produce span-level redaction |
60
- | R5 | high | Never return `cancel: true` — always deliver the (redacted) message |
61
- | R6 | medium | Emit audit log entry with `source: "outbound"` when PII is detected and `auditEnabled: true` |
62
- | R7 | low | Handler may be async (Scanner.scan() returns a Promise) |
63
-
64
- ## Success Criteria
65
-
66
- - Unit tests pass for the message sending handler covering PII detection, redaction, allowlist, audit logging, and no-op cases
67
- - Plugin smoke test verifies `message_sending` hook registration
68
- - Plugin smoke test verifies PII in outbound content is redacted
69
- - All existing tests pass (no regression)
70
-
71
- ## Constraints
72
-
73
- - Must not introduce new dependencies
74
- - Must not change the existing `FogClawConfig` type
75
- - Must reuse the existing Scanner instance (not create a new one)
76
-
77
- ## Priority
78
-
79
- - priority: high
80
- - rationale: This is the last-chance safety net before PII reaches external messaging channels. Even if upstream scanning catches most PII, outbound scanning prevents hallucinated or reassembled PII from leaking.
81
-
82
- ## Initial Milestone Candidates
83
-
84
- - M1: Create `src/message-sending-handler.ts` with async handler factory, plus unit tests
85
- - M2: Register hook in `src/index.ts`, extend plugin smoke test, full suite validation
86
-
87
- ## Handoff
88
-
89
- After spec approval, proceed directly to implementation (lightweight plan mode — code mirrors the established `tool-result-handler.ts` pattern).
90
-
91
- ## Revision Notes
92
-
93
- - 2026-02-17T00:00:00Z: Initialized spec. message_sending hook is typed but not invoked in OpenClaw; handler ships as future-ready.