@datafog/fogclaw 0.1.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 (97) hide show
  1. package/.github/workflows/harness-docs.yml +30 -0
  2. package/AGENTS.md +28 -0
  3. package/LICENSE +21 -0
  4. package/README.md +208 -0
  5. package/dist/config.d.ts +4 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/config.js +30 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/engines/gliner.d.ts +14 -0
  10. package/dist/engines/gliner.d.ts.map +1 -0
  11. package/dist/engines/gliner.js +75 -0
  12. package/dist/engines/gliner.js.map +1 -0
  13. package/dist/engines/regex.d.ts +5 -0
  14. package/dist/engines/regex.d.ts.map +1 -0
  15. package/dist/engines/regex.js +54 -0
  16. package/dist/engines/regex.js.map +1 -0
  17. package/dist/index.d.ts +19 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +157 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/redactor.d.ts +3 -0
  22. package/dist/redactor.d.ts.map +1 -0
  23. package/dist/redactor.js +37 -0
  24. package/dist/redactor.js.map +1 -0
  25. package/dist/scanner.d.ts +11 -0
  26. package/dist/scanner.d.ts.map +1 -0
  27. package/dist/scanner.js +77 -0
  28. package/dist/scanner.js.map +1 -0
  29. package/dist/types.d.ts +31 -0
  30. package/dist/types.d.ts.map +1 -0
  31. package/dist/types.js +18 -0
  32. package/dist/types.js.map +1 -0
  33. package/docs/DATA.md +28 -0
  34. package/docs/DESIGN.md +17 -0
  35. package/docs/DOMAIN_DOCS.md +30 -0
  36. package/docs/FRONTEND.md +24 -0
  37. package/docs/OBSERVABILITY.md +25 -0
  38. package/docs/PLANS.md +171 -0
  39. package/docs/PRODUCT_SENSE.md +20 -0
  40. package/docs/RELIABILITY.md +60 -0
  41. package/docs/SECURITY.md +50 -0
  42. package/docs/design-docs/core-beliefs.md +17 -0
  43. package/docs/design-docs/index.md +8 -0
  44. package/docs/generated/README.md +36 -0
  45. package/docs/generated/memory.md +1 -0
  46. package/docs/plans/2026-02-16-fogclaw-design.md +172 -0
  47. package/docs/plans/2026-02-16-fogclaw-implementation.md +1606 -0
  48. package/docs/plans/README.md +15 -0
  49. package/docs/plans/active/2026-02-16-feat-openclaw-official-submission-plan.md +386 -0
  50. package/docs/plans/active/2026-02-17-feat-release-fogclaw-via-datafog-package-plan.md +318 -0
  51. package/docs/plans/active/2026-02-17-feat-submit-fogclaw-to-openclaw-plan.md +244 -0
  52. package/docs/plans/tech-debt-tracker.md +42 -0
  53. package/docs/plugins/fogclaw.md +95 -0
  54. package/docs/runbooks/address-review-findings.md +30 -0
  55. package/docs/runbooks/ci-failures.md +46 -0
  56. package/docs/runbooks/code-review.md +34 -0
  57. package/docs/runbooks/merge-change.md +28 -0
  58. package/docs/runbooks/pull-request.md +45 -0
  59. package/docs/runbooks/record-evidence.md +43 -0
  60. package/docs/runbooks/reproduce-bug.md +42 -0
  61. package/docs/runbooks/respond-to-feedback.md +42 -0
  62. package/docs/runbooks/review-findings.md +31 -0
  63. package/docs/runbooks/submit-openclaw-plugin.md +68 -0
  64. package/docs/runbooks/update-agents-md.md +59 -0
  65. package/docs/runbooks/update-domain-docs.md +42 -0
  66. package/docs/runbooks/validate-current-state.md +41 -0
  67. package/docs/runbooks/verify-release.md +69 -0
  68. package/docs/specs/2026-02-16-feat-openclaw-official-submission-spec.md +115 -0
  69. package/docs/specs/2026-02-17-feat-submit-fogclaw-to-openclaw.md +125 -0
  70. package/docs/specs/README.md +5 -0
  71. package/docs/specs/index.md +8 -0
  72. package/docs/spikes/README.md +8 -0
  73. package/fogclaw.config.example.json +15 -0
  74. package/openclaw.plugin.json +45 -0
  75. package/package.json +37 -0
  76. package/scripts/ci/he-docs-config.json +123 -0
  77. package/scripts/ci/he-docs-drift.sh +112 -0
  78. package/scripts/ci/he-docs-lint.sh +234 -0
  79. package/scripts/ci/he-plans-lint.sh +354 -0
  80. package/scripts/ci/he-runbooks-lint.sh +445 -0
  81. package/scripts/ci/he-specs-lint.sh +258 -0
  82. package/scripts/ci/he-spikes-lint.sh +249 -0
  83. package/scripts/runbooks/select-runbooks.sh +154 -0
  84. package/src/config.ts +46 -0
  85. package/src/engines/gliner.ts +88 -0
  86. package/src/engines/regex.ts +71 -0
  87. package/src/index.ts +223 -0
  88. package/src/redactor.ts +51 -0
  89. package/src/scanner.ts +90 -0
  90. package/src/types.ts +52 -0
  91. package/tests/config.test.ts +104 -0
  92. package/tests/gliner.test.ts +184 -0
  93. package/tests/plugin-smoke.test.ts +114 -0
  94. package/tests/redactor.test.ts +320 -0
  95. package/tests/regex.test.ts +345 -0
  96. package/tests/scanner.test.ts +199 -0
  97. package/tsconfig.json +20 -0
@@ -0,0 +1,69 @@
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
@@ -0,0 +1,115 @@
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.
@@ -0,0 +1,125 @@
1
+ ---
2
+ slug: 2026-02-17-feat-submit-fogclaw-to-openclaw
3
+ status: intake-complete
4
+ date: 2026-02-17T01:56:00Z
5
+ owner: sidmohan
6
+ plan_mode: execution
7
+ spike_recommended: yes
8
+ priority: high
9
+ ---
10
+
11
+ # Submit FogClaw to OpenClaw official plugin channel
12
+
13
+ ## Purpose / Big Picture
14
+
15
+ FogClaw is already installable and usable via the `@openclaw/fogclaw` package, and it now has repository-side submission readiness artifacts. This initiative is to prepare and execute the **next submission step**: opening and completing the cross-repository contribution in the OpenClaw ecosystem so the plugin can be discovered through official OpenClaw workflows.
16
+
17
+ The outcome is observable when a maintainer-facing OpenClaw repo PR is opened with reproducible validation evidence and receives maintainer review status. A user should be able to verify this by checking the new upstream PR and the documented checklist that proves package identity, installability, hook/tool behavior, and testability in a clean environment.
18
+
19
+ ## Scope
20
+
21
+ ### In Scope
22
+
23
+ - Identify the exact official OpenClaw submission path for plugins and prepare the required contribution artifacts for FogClaw.
24
+ - Create a maintainer-facing submission PR in the OpenClaw repository using the already-merged `DataFog/fogclaw` release state.
25
+ - Include submission evidence mapping between this repository and OpenClaw review expectations (package name/version, manifest, installation command, and reproducible test checks).
26
+ - Add/confirm any minimal metadata or docs updates needed specifically for external submission in this repo (if required after upstream validation).
27
+ - Track and document outcomes, open questions, and blockers in spec/plan artifacts.
28
+
29
+ ### Boundaries
30
+
31
+ - No changes to detection logic, redaction strategies, or plugin runtime behavior.
32
+ - No implementation changes to OpenClaw platform code.
33
+ - No introduction of new dependencies or CI infrastructure in the plugin repo.
34
+ - No security/privacy model changes; this effort only covers publication workflow and submission evidence.
35
+
36
+ ## Non-Goals
37
+
38
+ - Reworking plugin internals or adding new plugin features.
39
+ - Re-running full internal feature validation already completed in the plugin merge.
40
+ - Creating a parallel package/brand strategy beyond the existing `@openclaw/fogclaw` identity.
41
+
42
+ ## Risks
43
+
44
+ - OpenClaw may enforce additional fields, naming constraints, or review expectations that were not covered by the DataFog repo readiness work.
45
+ - Upstream PR template may require evidence format changes from repo-local PR notes.
46
+ - There may be a delay between contribution and maintainer review if expectations remain unclear.
47
+ - Maintainers may request a packaging/metadata adjustment after we submit, requiring a follow-up PR.
48
+
49
+ ## Rollout
50
+
51
+ - Use the already-merged `main` state of `DataFog/fogclaw` as the submission baseline.
52
+ - Draft and open the OpenClaw submission PR with reproducible commands and exact expected outputs.
53
+ - If OpenClaw maintainers request changes, loop through `respond-to-feedback` and reopen on the same submission branch.
54
+ - Close the initiative once the upstream PR is accepted and merged, or route back to `he-implement` if repository changes are required.
55
+
56
+ ## Validation and Acceptance Signals
57
+
58
+ - Reproducible local evidence command block exists and matches what is sent in the OpenClaw submission PR.
59
+ - `@openclaw/fogclaw` package identity remains stable and points to the merged `DataFog/fogclaw` release state.
60
+ - OpenClaw upstream PR reaches at least “ready for review” with all requested evidence attachments present.
61
+ - The maintainer-facing PR includes explicit answers for submission criteria and known caveats (for example model/download behavior in constrained environments).
62
+
63
+ ## Requirements
64
+
65
+ | ID | Priority | Requirement |
66
+ |---|---|---|
67
+ | R1 | high | Prepare a submission PR in the OpenClaw repo that references the `@openclaw/fogclaw` package and the merged DataFog commit history relevant for reviewers.
68
+ | R2 | high | Include a clean check list in the OpenClaw PR body with outputs for `npm test`, `npm run build`, `npm run test:plugin-smoke`, and package manifest verification.
69
+ | R3 | medium | Confirm any OpenClaw-specific metadata expectations (template fields, review checklist, review labels, or required docs) before requesting maintainer action.
70
+ | R4 | medium | Capture and resolve any maintainer feedback by returning to local implementation only when repository edits are required.
71
+ | R5 | low | Record submission status and next action in durable docs (`docs/plans/...` and open questions log).
72
+
73
+ ## Chosen Direction (Recommended)
74
+
75
+ - Use a single upstream pull request targeting the designated OpenClaw repository path as the primary submission vehicle (recommended) because it minimizes fragmentation and matches standard contributor workflows. The risk is that external process details may require iteration.
76
+ - A second, duplicate submission route should be avoided unless a maintainer explicitly requests it, because duplicate PRs tend to create conflicting discussions and slower review.
77
+
78
+ ## Open Questions
79
+
80
+ - **[research]** What exact OpenClaw repository/path and PR template must FogClaw target for official plugin publication?
81
+ - **[research]** Does OpenClaw require an additional manifest or catalog file update inside their own repository in addition to package metadata?
82
+ - **[decision]** Should this initiative include one follow-up patch branch for any requested metadata changes, or remain submission-only until maintainer asks?
83
+ - **[planning]** If additional upstream packaging adjustments are required, should those be merged through the current open submission branch or a fresh follow-up branch?
84
+
85
+ ## Success Criteria
86
+
87
+ - A new OpenClaw-side PR is created with: plugin identity, install command, reproducible tests, and evidence of `src/index.ts` contract behavior.
88
+ - The submission PR body cites the merged plugin-merge commit from `DataFog/fogclaw` as canonical source-of-truth.
89
+ - Maintainers can reproduce the core checks from the PR body without guessing or adding setup instructions.
90
+ - Any blocking submission questions are answered in the PR thread or captured in plan artifacts before proceeding to final merge.
91
+
92
+ ## Constraints
93
+
94
+ - Only proceed with outward-facing submission work while preserving plugin behavior unchanged.
95
+ - Keep all package names and registry scope aligned to `@openclaw/fogclaw` unless OpenClaw maintainer instruction requires a temporary exception.
96
+ - Do not assume access to external OpenClaw maintainer accounts beyond normal GitHub contributor permissions.
97
+ - Avoid changing internal plugin code until submission blockers are confirmed as code-level.
98
+
99
+ ## Tech Preferences
100
+
101
+ - **Language/runtime**: TypeScript / Node.js (repository remains unchanged).
102
+ - **Framework/API**: OpenClaw plugin API and GitHub PR process for upstream submission.
103
+ - **Infrastructure**: GitHub CLI and repository PR workflow.
104
+ - **Rationale**: Keeps this initiative low-risk and focused on process and reviewability rather than implementation.
105
+
106
+ ## Handoff
107
+
108
+ - This spec should transition to `he-plan` once the exact OpenClaw target path and submission requirements are clear.
109
+ - `he-plan` should define submission mechanics and maintainer-proof evidence formatting as separate milestones.
110
+ - If significant process uncertainty remains after planning, first route to `he-research` for missing process facts.
111
+
112
+ ## Priority
113
+
114
+ - priority: high
115
+ - rationale: This is the final official publication step and required for wider ecosystem discoverability.
116
+
117
+ ## Initial Milestone Candidates
118
+
119
+ - M1: Confirm official OpenClaw submission target and required review template/evidence format.
120
+ - M2: Draft and open the upstream OpenClaw PR with reproducible checks, package identity, and maintainer-facing rationale.
121
+ - M3: Respond to initial feedback loop and either land metadata fixes or close with explicit blocker notes.
122
+
123
+ ## Revision Notes
124
+
125
+ - 2026-02-17T01:56:00Z: Initialized spec to formalize the cross-repo OpenClaw submission step after plugin readiness merge landed on `DataFog/fogclaw` main.
@@ -0,0 +1,5 @@
1
+ # Specs
2
+
3
+ Store initiative specs here using one file per slug.
4
+ Each spec must start with YAML frontmatter and set `plan_mode: lightweight|execution`.
5
+ Store spike findings separately in `docs/spikes/`.
@@ -0,0 +1,8 @@
1
+ # Specs Index
2
+
3
+ Use this index to track initiative specs in `docs/specs/`.
4
+
5
+ ## Active Specs
6
+
7
+ - `<slug>`: `docs/specs/<slug>-spec.md`
8
+
@@ -0,0 +1,8 @@
1
+ # Spikes
2
+
3
+ Time-boxed investigations for uncertain/risky initiatives.
4
+ Use the pattern `docs/spikes/<slug>-spike.md`.
5
+
6
+ Spike docs should start with YAML frontmatter (see `docs/PLANS.md` for the artifact contract).
7
+
8
+ Recommended sections: `Context`, `Validation Goal`, `Approach`, `Findings`, `Decisions`, `Recommendation`, `Impact on Upstream Docs`, `Spike Code`, `Remaining Unknowns`, `Time Spent`, and append-only `Revision Notes`.
@@ -0,0 +1,15 @@
1
+ {
2
+ "enabled": true,
3
+ "guardrail_mode": "redact",
4
+ "redactStrategy": "token",
5
+ "model": "onnx-community/gliner_large-v2.1",
6
+ "confidence_threshold": 0.5,
7
+ "custom_entities": ["project codename", "internal tool name"],
8
+ "entityActions": {
9
+ "SSN": "block",
10
+ "CREDIT_CARD": "block",
11
+ "EMAIL": "redact",
12
+ "PHONE": "redact",
13
+ "PERSON": "warn"
14
+ }
15
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "id": "fogclaw",
3
+ "name": "FogClaw",
4
+ "version": "0.1.0",
5
+ "description": "PII detection & custom entity redaction powered by DataFog",
6
+ "configSchema": {
7
+ "type": "object",
8
+ "properties": {
9
+ "enabled": { "type": "boolean", "default": true },
10
+ "guardrail_mode": {
11
+ "type": "string",
12
+ "enum": ["redact", "block", "warn"],
13
+ "default": "redact"
14
+ },
15
+ "redactStrategy": {
16
+ "type": "string",
17
+ "enum": ["token", "mask", "hash"],
18
+ "default": "token"
19
+ },
20
+ "model": {
21
+ "type": "string",
22
+ "default": "onnx-community/gliner_large-v2.1"
23
+ },
24
+ "confidence_threshold": {
25
+ "type": "number",
26
+ "default": 0.5,
27
+ "minimum": 0,
28
+ "maximum": 1
29
+ },
30
+ "custom_entities": {
31
+ "type": "array",
32
+ "items": { "type": "string" },
33
+ "default": []
34
+ },
35
+ "entityActions": {
36
+ "type": "object",
37
+ "additionalProperties": {
38
+ "type": "string",
39
+ "enum": ["redact", "block", "warn"]
40
+ },
41
+ "default": {}
42
+ }
43
+ }
44
+ }
45
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@datafog/fogclaw",
3
+ "version": "0.1.0",
4
+ "description": "OpenClaw plugin for PII detection & custom entity redaction powered by DataFog",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "test": "vitest run",
11
+ "test:watch": "vitest",
12
+ "test:plugin-smoke": "vitest run tests/plugin-smoke.test.ts",
13
+ "lint": "tsc --noEmit"
14
+ },
15
+ "dependencies": {
16
+ "gliner": "^0.0.19",
17
+ "onnxruntime-node": "1.19.2"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^22.0.0",
21
+ "typescript": "^5.7.0",
22
+ "vitest": "^2.1.0"
23
+ },
24
+ "engines": {
25
+ "node": ">=22.0.0"
26
+ },
27
+ "openclaw": {
28
+ "extensions": [
29
+ "./dist/index.js"
30
+ ]
31
+ },
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/datafog/fogclaw"
36
+ }
37
+ }
@@ -0,0 +1,123 @@
1
+ {
2
+ "required_docs": [
3
+ "AGENTS.md",
4
+ "docs/PLANS.md",
5
+ "docs/DOMAIN_DOCS.md"
6
+ ],
7
+ "expected_runbooks": [
8
+ "docs/runbooks/update-agents-md.md",
9
+ "docs/runbooks/update-domain-docs.md",
10
+ "docs/runbooks/code-review.md",
11
+ "docs/runbooks/review-findings.md",
12
+ "docs/runbooks/address-review-findings.md",
13
+ "docs/runbooks/validate-current-state.md",
14
+ "docs/runbooks/reproduce-bug.md",
15
+ "docs/runbooks/pull-request.md",
16
+ "docs/runbooks/respond-to-feedback.md",
17
+ "docs/runbooks/verify-release.md",
18
+ "docs/runbooks/record-evidence.md",
19
+ "docs/runbooks/ci-failures.md",
20
+ "docs/runbooks/merge-change.md"
21
+ ],
22
+ "domain_docs": [
23
+ "docs/DESIGN.md",
24
+ "docs/DATA.md",
25
+ "docs/FRONTEND.md",
26
+ "docs/PRODUCT_SENSE.md",
27
+ "docs/RELIABILITY.md",
28
+ "docs/SECURITY.md",
29
+ "docs/OBSERVABILITY.md",
30
+ "docs/design-docs/core-beliefs.md"
31
+ ],
32
+ "required_headings": {
33
+ "docs/SECURITY.md": [
34
+ "## Threat Model",
35
+ "## Auth Model",
36
+ "## Data Sensitivity",
37
+ "## Compliance",
38
+ "## Controls"
39
+ ],
40
+ "docs/RELIABILITY.md": [
41
+ "## Reliability Goals",
42
+ "## Failure Modes",
43
+ "## Monitoring",
44
+ "## Operational Guardrails"
45
+ ],
46
+ "docs/FRONTEND.md": [
47
+ "## Stack",
48
+ "## Conventions",
49
+ "## Component Architecture",
50
+ "## Performance",
51
+ "## Accessibility"
52
+ ],
53
+ "docs/DESIGN.md": [
54
+ "## Design Principles",
55
+ "## Visual Direction",
56
+ "## Interaction Standards"
57
+ ],
58
+ "docs/PRODUCT_SENSE.md": [
59
+ "## Target Users",
60
+ "## Key Outcomes",
61
+ "## Decision Heuristics",
62
+ "## Quality Criteria"
63
+ ],
64
+ "docs/DATA.md": [
65
+ "## Data Model",
66
+ "## Migrations",
67
+ "## Backfills And Data Fixes",
68
+ "## Integrity And Consistency",
69
+ "## Sensitive Data Notes"
70
+ ],
71
+ "docs/OBSERVABILITY.md": [
72
+ "## Logging Strategy",
73
+ "## Metrics",
74
+ "## Traces",
75
+ "## Health Checks",
76
+ "## Agent Access"
77
+ ]
78
+ },
79
+ "artifact_placeholder_patterns": [
80
+ "<slug>",
81
+ "<YYYY-",
82
+ "<title>"
83
+ ],
84
+ "lint_completed_plans": true,
85
+ "required_spec_frontmatter_keys": [
86
+ "slug",
87
+ "status",
88
+ "date",
89
+ "owner",
90
+ "plan_mode",
91
+ "spike_recommended",
92
+ "priority"
93
+ ],
94
+ "required_plan_frontmatter_keys": [
95
+ "slug",
96
+ "status",
97
+ "phase",
98
+ "plan_mode",
99
+ "priority",
100
+ "owner"
101
+ ],
102
+ "required_spike_frontmatter_keys": [
103
+ "slug",
104
+ "status",
105
+ "date",
106
+ "owner",
107
+ "timebox"
108
+ ],
109
+ "drift_rules": [
110
+ {
111
+ "regex": "(^auth/|/auth/|^middleware/|/middleware/|(^|/)security/|(^|/)permissions/)",
112
+ "doc": "docs/SECURITY.md"
113
+ },
114
+ {
115
+ "regex": "(^infra/|^ops/|^deploy/|^terraform/|^k8s/|^helm/|(^|/)monitoring/|(^|/)alerts/)",
116
+ "doc": "docs/RELIABILITY.md"
117
+ },
118
+ {
119
+ "regex": "(^package\\\\.json$|^pnpm-lock\\\\.yaml$|^yarn\\\\.lock$|^bun\\\\.lockb$|^tsconfig\\\\.json$|^vite\\\\.config\\\\.|^next\\\\.config\\\\.)",
120
+ "doc": "docs/FRONTEND.md"
121
+ }
122
+ ]
123
+ }
@@ -0,0 +1,112 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
5
+ DEFAULT_CONFIG_PATH="scripts/ci/he-docs-config.json"
6
+
7
+ config_path="${HARNESS_DOCS_CONFIG:-$DEFAULT_CONFIG_PATH}"
8
+ config_file="${REPO_ROOT}/${config_path}"
9
+
10
+ if [[ ! -f "$config_file" ]]; then
11
+ echo "Error: he-docs-drift missing/invalid config: Missing config '${config_path}'. Fix: create it (bootstrap should do this) or set HARNESS_DOCS_CONFIG." >&2
12
+ exit 2
13
+ fi
14
+
15
+ cfg="$(cat "$config_file")"
16
+ if ! echo "$cfg" | jq -e 'type == "object"' >/dev/null 2>&1; then
17
+ echo "Error: he-docs-drift missing/invalid config: Config must be a JSON object." >&2
18
+ exit 2
19
+ fi
20
+
21
+ base_ref="${GITHUB_BASE_REF:-}"
22
+ head_ref="${GITHUB_HEAD_REF:-}"
23
+
24
+ if [[ -n "$base_ref" ]]; then
25
+ diff_range="origin/${base_ref}...HEAD"
26
+ else
27
+ if git -C "$REPO_ROOT" rev-parse -q --verify HEAD~1 >/dev/null 2>&1; then
28
+ diff_range="HEAD~1...HEAD"
29
+ else
30
+ diff_range=""
31
+ fi
32
+ fi
33
+
34
+ echo "he-docs-drift: starting" >&2
35
+ echo "Repro: bash scripts/ci/he-docs-drift.sh" >&2
36
+ if [[ -n "$base_ref" ]]; then
37
+ echo "PR context: base_ref='${base_ref}' head_ref='${head_ref}' diff='${diff_range}'" >&2
38
+ else
39
+ echo "Local context: diff='${diff_range}'" >&2
40
+ fi
41
+
42
+ if [[ -n "$diff_range" ]]; then
43
+ changed="$(git -C "$REPO_ROOT" diff --name-only "$diff_range" 2>/dev/null || true)"
44
+ else
45
+ changed="$(git -C "$REPO_ROOT" diff-tree --no-commit-id --name-only -r HEAD 2>/dev/null || true)"
46
+ fi
47
+
48
+ # Trim empty lines
49
+ changed="$(echo "$changed" | sed '/^[[:space:]]*$/d')"
50
+
51
+ if [[ -z "$changed" ]]; then
52
+ echo "he-docs-drift: no changes detected"
53
+ exit 0
54
+ fi
55
+
56
+ # Build list of changed docs (files starting with docs/)
57
+ changed_docs="$(echo "$changed" | grep '^docs/' || true)"
58
+
59
+ # Extract drift_rules array; default to empty array if missing or wrong type
60
+ drift_rules="$(echo "$cfg" | jq -c '.drift_rules // [] | if type == "array" then . else [] end')"
61
+ rule_count="$(echo "$drift_rules" | jq 'length')"
62
+
63
+ missing=0
64
+
65
+ for ((i = 0; i < rule_count; i++)); do
66
+ rule="$(echo "$drift_rules" | jq -c ".[$i]")"
67
+
68
+ # Skip non-object entries
69
+ if ! echo "$rule" | jq -e 'type == "object"' >/dev/null 2>&1; then
70
+ continue
71
+ fi
72
+
73
+ regex="$(echo "$rule" | jq -r '.regex // empty')"
74
+ doc="$(echo "$rule" | jq -r '.doc // empty')"
75
+
76
+ if [[ -z "$regex" || -z "$doc" ]]; then
77
+ continue
78
+ fi
79
+
80
+ # Validate regex by testing it
81
+ if ! echo "" | grep -qE "$regex" 2>/dev/null && [[ $? -eq 2 ]]; then
82
+ echo "Error: invalid drift rule regex: ${regex}" >&2
83
+ missing=1
84
+ continue
85
+ fi
86
+
87
+ # Find changed files matching the regex
88
+ matching="$(echo "$changed" | grep -E "$regex" || true)"
89
+
90
+ if [[ -z "$matching" ]]; then
91
+ continue
92
+ fi
93
+
94
+ # Check if the required doc is in the changed docs list
95
+ if ! echo "$changed_docs" | grep -qxF "$doc" 2>/dev/null; then
96
+ sample="$(echo "$matching" | head -n 10 | sed 's/^/- /')"
97
+ echo "::error file=${doc},title=Docs drift gate::Missing required doc update '${doc}' when files match /${regex}/ (see job logs for matching files)."
98
+ echo "Missing doc update: '${doc}' should change when files match /${regex}/." >&2
99
+ echo "Matching files (up to 10):" >&2
100
+ echo "$sample" >&2
101
+ echo "Fix: update '${doc}' in this PR, or edit drift_rules in '${DEFAULT_CONFIG_PATH}' (or HARNESS_DOCS_CONFIG) if this mapping is wrong." >&2
102
+ missing=1
103
+ fi
104
+ done
105
+
106
+ if [[ "$missing" -ne 0 ]]; then
107
+ echo "Error: docs drift gate failed (see missing doc updates above)" >&2
108
+ exit 1
109
+ fi
110
+
111
+ echo "he-docs-drift: OK"
112
+ exit 0