@karmaniverous/jeeves 0.5.9 → 0.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/skills/coding.md +149 -0
- package/content/skills/operations.md +125 -0
- package/content/skills/playbooks.md +75 -0
- package/content/skills/slack-bot-provisioner.md +57 -0
- package/content/tools-platform.md +14 -0
- package/dist/cli/jeeves/index.js +491 -31
- package/dist/cli/plugin/index.js +472 -31
- package/dist/cli/service/index.js +27 -13
- package/dist/index.d.ts +50 -7
- package/dist/index.js +557 -32
- package/package.json +26 -32
- /package/content/{skill.md → skills/jeeves.md} +0 -0
package/dist/cli/plugin/index.js
CHANGED
|
@@ -53,31 +53,31 @@ var hasRequiredExtraTypings;
|
|
|
53
53
|
function requireExtraTypings () {
|
|
54
54
|
if (hasRequiredExtraTypings) return extraTypings.exports;
|
|
55
55
|
hasRequiredExtraTypings = 1;
|
|
56
|
-
(function (module, exports
|
|
56
|
+
(function (module, exports) {
|
|
57
57
|
const commander = require$$0;
|
|
58
58
|
|
|
59
|
-
exports
|
|
59
|
+
exports = module.exports = {};
|
|
60
60
|
|
|
61
61
|
// Return a different global program than commander,
|
|
62
62
|
// and don't also return it as default export.
|
|
63
|
-
exports
|
|
63
|
+
exports.program = new commander.Command();
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Expose classes. The FooT versions are just types, so return Commander original implementations!
|
|
67
67
|
*/
|
|
68
68
|
|
|
69
|
-
exports
|
|
70
|
-
exports
|
|
71
|
-
exports
|
|
72
|
-
exports
|
|
73
|
-
exports
|
|
74
|
-
exports
|
|
75
|
-
exports
|
|
69
|
+
exports.Argument = commander.Argument;
|
|
70
|
+
exports.Command = commander.Command;
|
|
71
|
+
exports.CommanderError = commander.CommanderError;
|
|
72
|
+
exports.Help = commander.Help;
|
|
73
|
+
exports.InvalidArgumentError = commander.InvalidArgumentError;
|
|
74
|
+
exports.InvalidOptionArgumentError = commander.InvalidArgumentError; // Deprecated
|
|
75
|
+
exports.Option = commander.Option;
|
|
76
76
|
|
|
77
|
-
exports
|
|
78
|
-
exports
|
|
77
|
+
exports.createCommand = (name) => new commander.Command(name);
|
|
78
|
+
exports.createOption = (flags, description) =>
|
|
79
79
|
new commander.Option(flags, description);
|
|
80
|
-
exports
|
|
80
|
+
exports.createArgument = (name, description) =>
|
|
81
81
|
new commander.Argument(name, description);
|
|
82
82
|
} (extraTypings, extraTypings.exports));
|
|
83
83
|
return extraTypings.exports;
|
|
@@ -121,8 +121,6 @@ const WORKSPACE_FILES = {
|
|
|
121
121
|
};
|
|
122
122
|
/** Skill directory name within workspace. */
|
|
123
123
|
const SKILLS_DIR = 'skills';
|
|
124
|
-
/** Jeeves skill directory name. */
|
|
125
|
-
const JEEVES_SKILL_DIR = 'jeeves';
|
|
126
124
|
/** Component versions state file name. */
|
|
127
125
|
const COMPONENT_VERSIONS_FILE = 'component-versions.json';
|
|
128
126
|
|
|
@@ -130,14 +128,14 @@ const COMPONENT_VERSIONS_FILE = 'component-versions.json';
|
|
|
130
128
|
* Core library version, inlined at build time.
|
|
131
129
|
*
|
|
132
130
|
* @remarks
|
|
133
|
-
* The `0.5.
|
|
131
|
+
* The `0.5.10` placeholder is replaced by
|
|
134
132
|
* `@rollup/plugin-replace` during the build with the actual version
|
|
135
133
|
* from `package.json`. This ensures the correct version survives
|
|
136
134
|
* when consumers bundle core into their own dist (where runtime
|
|
137
135
|
* `import.meta.url`-based resolution would find the wrong package.json).
|
|
138
136
|
*/
|
|
139
137
|
/** The core library version from package.json (inlined at build time). */
|
|
140
|
-
const CORE_VERSION = '0.5.
|
|
138
|
+
const CORE_VERSION = '0.5.10';
|
|
141
139
|
|
|
142
140
|
/**
|
|
143
141
|
* Shared file I/O helpers for managed section operations.
|
|
@@ -376,12 +374,26 @@ const SECTION_ORDER = [
|
|
|
376
374
|
* - `{configRoot}/jeeves-{name}/` for each component
|
|
377
375
|
*/
|
|
378
376
|
let state;
|
|
377
|
+
const WINDOWS_DRIVE_RE = /^[a-zA-Z]:/;
|
|
378
|
+
/**
|
|
379
|
+
* Throw if a path looks like a Windows drive letter on a non-Windows platform.
|
|
380
|
+
*
|
|
381
|
+
* @param label - Human-readable name for the path (used in error messages).
|
|
382
|
+
* @param value - The raw path string to validate.
|
|
383
|
+
*/
|
|
384
|
+
function rejectWindowsDrivePath(label, value) {
|
|
385
|
+
if (process.platform !== 'win32' && WINDOWS_DRIVE_RE.test(value)) {
|
|
386
|
+
throw new Error(`jeeves-core: ${label} "${value}" looks like a Windows drive-letter path and will not resolve correctly on this platform.`);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
379
389
|
/**
|
|
380
390
|
* Initialize the core library with workspace and config root paths.
|
|
381
391
|
*
|
|
382
392
|
* @param options - Workspace and config root paths.
|
|
383
393
|
*/
|
|
384
394
|
function init(options) {
|
|
395
|
+
rejectWindowsDrivePath('configRoot', options.configRoot);
|
|
396
|
+
rejectWindowsDrivePath('workspacePath', options.workspacePath);
|
|
385
397
|
state = {
|
|
386
398
|
workspacePath: options.workspacePath,
|
|
387
399
|
configRoot: options.configRoot,
|
|
@@ -751,7 +763,158 @@ function buildWithSections(beforeContent, userContent, sections, markers, coreVe
|
|
|
751
763
|
return parts.join('\n');
|
|
752
764
|
}
|
|
753
765
|
|
|
754
|
-
var
|
|
766
|
+
var codingContent = `---
|
|
767
|
+
name: coding
|
|
768
|
+
description: Engineering standards for all code work. Use when writing code, reviewing PRs, spawning coding sub-agents, or making architectural decisions in any project (not just Jeeves). Covers design-first development, schema-first patterns, testing, STAN workflow, dependency management, and pre-PR checklist.
|
|
769
|
+
---
|
|
770
|
+
|
|
771
|
+
# Engineering Standards
|
|
772
|
+
|
|
773
|
+
These standards apply to ALL code work — whether done directly or via sub-agents.
|
|
774
|
+
When spawning sub-agents for coding tasks, include the relevant rules in the task prompt.
|
|
775
|
+
Sub-agents don't inherit your context — if you don't pass the rules, they don't exist.
|
|
776
|
+
|
|
777
|
+
---
|
|
778
|
+
|
|
779
|
+
## Design-First Development
|
|
780
|
+
|
|
781
|
+
1. **Iterate on design until convergence** — Summarize requirements, propose approach, raise questions BEFORE writing code.
|
|
782
|
+
2. **Services-first architecture** — Core logic in services behind ports; adapters thin; side effects at boundaries.
|
|
783
|
+
3. **Schema-first** — Runtime schema (Zod) is source of truth; TypeScript types derived via \`z.infer<>\`; validation centralized. Plain TypeScript \`interface\` declarations for config surfaces are not acceptable.
|
|
784
|
+
4. **300 LOC hard limit** — If a file would exceed 300 lines, stop and decompose first. No exceptions.
|
|
785
|
+
5. **Avoid \`any\`** — Prefer \`unknown\` + narrowing; if unavoidable, narrowest scope + rationale.
|
|
786
|
+
6. **Test pairing** — Every non-trivial module gets a \`*.test.ts\`.
|
|
787
|
+
7. **Open-source first** — Prefer established deps over home-grown solutions. Search npm/GitHub before building anything non-trivial.
|
|
788
|
+
|
|
789
|
+
## Module Design
|
|
790
|
+
|
|
791
|
+
- **Single Responsibility** applies to modules as well as functions.
|
|
792
|
+
- Prefer many small modules over a few large ones.
|
|
793
|
+
- Keep module boundaries explicit and cohesive; avoid "kitchen-sink" files.
|
|
794
|
+
- Co-locate tests with modules for discoverability.
|
|
795
|
+
|
|
796
|
+
## Config Surfaces
|
|
797
|
+
|
|
798
|
+
- Define config with **Zod schemas** — never bare TypeScript interfaces.
|
|
799
|
+
- Derive types: \`type MyConfig = z.infer<typeof myConfigSchema>\`
|
|
800
|
+
- Generate **JSON Schema** from Zod for IDE DX (\`\$schema\` pointer in config files).
|
|
801
|
+
- Validate at load time — fail fast with clear error messages.
|
|
802
|
+
- \`init\` commands generate config with \`\$schema\` pointer already in place.
|
|
803
|
+
|
|
804
|
+
## Testing
|
|
805
|
+
|
|
806
|
+
- **Unit tests** for pure services (no fs/process/network).
|
|
807
|
+
- **Integration tests** for adapters/seams (minimal end-to-end slices).
|
|
808
|
+
- Exercise happy paths AND representative error paths.
|
|
809
|
+
- Table-driven cases encouraged for exhaustive coverage.
|
|
810
|
+
- Keep coverage meaningful — prefer covering branches/decisions over chasing 100% lines.
|
|
811
|
+
|
|
812
|
+
## STAN-Enabled Repos
|
|
813
|
+
|
|
814
|
+
When working in a repo with \`.stan/\`:
|
|
815
|
+
- Run \`stan run --sequential --no-archive\` **before** each commit. Scripts must pass before you commit. Sequential runs are preferred to limit side effects. Archives are not needed (you won't use them).
|
|
816
|
+
- **Push after every commit.** Don't accumulate unpushed local commits. Jason needs to be able to see your work at any time.
|
|
817
|
+
- All scripts must pass before claiming work is complete.
|
|
818
|
+
- Read \`.stan/output/<script>.txt\` for evidence on failures.
|
|
819
|
+
- When creating stan scripts, eliminate colorized output where possible (e.g. \`--no-color\`, \`NO_COLOR=1\`) to reduce noise in script output files.
|
|
820
|
+
|
|
821
|
+
## Cross-Package Verification
|
|
822
|
+
|
|
823
|
+
When changes affect exports consumed by another repo:
|
|
824
|
+
- Standalone scripts passing ≠ "ready for review."
|
|
825
|
+
- Use \`npm link\` or equivalent to verify the consumer builds against your changes.
|
|
826
|
+
- Only claim completion when BOTH repos pass.
|
|
827
|
+
|
|
828
|
+
## Dependencies: Latest Versions Required (HARD GATE)
|
|
829
|
+
|
|
830
|
+
**NEVER use a superseded version of ANY dependency without direct human authorization.** When adding a new dependency — or creating a new project — ALWAYS check the latest stable version and use it. This applies to runtime deps, dev deps, and peer deps alike.
|
|
831
|
+
|
|
832
|
+
- Before \`npm install <package>\`: run \`npm view <package> version\` (or check npmjs.com) to confirm you're installing the current major.
|
|
833
|
+
- Before spawning sub-agents that install packages: include the latest version in the task prompt, or instruct the sub-agent to verify latest before installing.
|
|
834
|
+
- If the latest major has known breaking issues that block adoption, flag it to the human — don't silently pin an old major.
|
|
835
|
+
|
|
836
|
+
LLMs are trained on stale data. Your training cutoff means you will default to old versions of everything. **Assume your version knowledge is wrong** and verify before every install.
|
|
837
|
+
|
|
838
|
+
*Earned: 2026-05-12, created the jeeves-tools repo with Zod 3 despite Zod 4 being available since mid-2025. Shipped 84 commits on the old major before catching it.*
|
|
839
|
+
|
|
840
|
+
## Dependencies: Local Over Global
|
|
841
|
+
|
|
842
|
+
- **Dev dependencies belong in the project, not the global environment.** Install with \`npm install --save-dev\`, not \`npm install -g\`.
|
|
843
|
+
- This guarantees reproducibility across machines and CI. Global installs mask environment differences that cause "works on my machine" failures.
|
|
844
|
+
- **Rare exceptions:** Tools that are genuinely machine-level utilities (e.g. \`stan-cli\`). If in doubt, install locally.
|
|
845
|
+
## Dependency Failures
|
|
846
|
+
|
|
847
|
+
When a third-party dependency is broken:
|
|
848
|
+
1. Summarize the failure concisely.
|
|
849
|
+
2. Enumerate options: switch dependency → fix upstream → temporary pin → shim (last resort).
|
|
850
|
+
3. Recommend with rationale.
|
|
851
|
+
4. Do NOT immediately code around the problem.
|
|
852
|
+
|
|
853
|
+
## CHANGELOG
|
|
854
|
+
|
|
855
|
+
- **Do not manually update CHANGELOG.md** — it is generated as part of the release process (e.g. via \`standard-version\`, \`changesets\`, or equivalent). Conventional commit messages are the input; the tooling produces the output.
|
|
856
|
+
|
|
857
|
+
## Pre-PR Checklist (HARD GATE)
|
|
858
|
+
|
|
859
|
+
**Before creating ANY PR, run the full verification sequence. No exceptions.**
|
|
860
|
+
|
|
861
|
+
1. \`stan run --sequential --no-archive\` if \`.stan/\` exists — this is the canonical check suite
|
|
862
|
+
2. In monorepos: run checks **from each package directory**, not just the root. Root-level runs may mask package-level failures due to config resolution differences.
|
|
863
|
+
3. Exercise the release path: check \`release-it\` hooks (or equivalent) in each releasable package — run the same commands (\`lint\`, \`typecheck\`, \`test\`, \`build\`) from the same cwd the release process uses.
|
|
864
|
+
|
|
865
|
+
If any step fails, fix it before committing. Do NOT create the PR and "note" the failures. Do NOT claim pre-existing failures without having actually run the commands first. Skipping this sequence is how we ship broken code and fabricate diagnoses.
|
|
866
|
+
|
|
867
|
+
- **Compare against canonical template** (\`karmaniverous/npm-package-template-ts\`) before any npm package PR. If the project is behind the template, update it to conform. If the template is behind the project, raise the issue with Jason for template upkeep.
|
|
868
|
+
- **Run \`ncu --peer\`** before any PR. Review the output. Update safe patches/minors. **Flag major version bumps for discussion** — never auto-apply \`ncu -u\` without reading what changed. Peer dep conflicts must be resolved, not ignored.
|
|
869
|
+
- When spawning sub-agents, include \`ncu --peer\` in the quality gate commands: \`ncu --peer && npm run lint && npm run typecheck && npm run build && npm test\`. The sub-agent should report \`ncu\` output and only apply updates that don't involve major bumps or peer conflicts.
|
|
870
|
+
- **Resolve ALL script warnings.** It is NOT acceptable to release code with outstanding warnings. They exist for a reason — fix them.
|
|
871
|
+
- **Typecheck/lint rules apply to ALL authored code**, including configs at project root (\`eslint.config.ts\`, \`rollup.config.ts\`, \`vitest.config.ts\`, etc.). Only generated code (e.g. typedoc output) should be excepted from code quality checks.
|
|
872
|
+
- **Never disable lint/typecheck rules** without surfacing it for discussion first. Disabled rules are a major code smell. If a rule must be disabled, document the rationale inline at the point of suppression.
|
|
873
|
+
- **Multiple tsconfigs are a code smell.** Sometimes needed, but often they paper over poor configuration choices. Fix root causes rather than adding tsconfig variants.
|
|
874
|
+
- **In a TS repo, all scripts should be authored in TS** (not JS). Prefer execution with \`tsx\`.
|
|
875
|
+
- **Clean-room verify before claiming "all green."** Run \`rimraf node_modules && npm install && npm run build\` (or equivalent) to catch issues masked by cached state. If someone reports an error you can't reproduce, assume your cache is lying — not that they're wrong.
|
|
876
|
+
- Verify build, test, and lint pass after updates.
|
|
877
|
+
|
|
878
|
+
## Dev Workspace
|
|
879
|
+
|
|
880
|
+
- **Clone location:** \`D:\\repos\\{org-or-userid}\\{repo}\` (e.g. \`D:\\repos\\karmaniverous\\jeeves-watcher\`)
|
|
881
|
+
- D drive is the dev workspace. Do not clone repos elsewhere.
|
|
882
|
+
- Fresh clones are preferred over copying existing checkouts — \`npm install\` from registry is faster than disk-copying \`node_modules\`.
|
|
883
|
+
- D drive is NOT indexed by jeeves-watcher. Dev work stays off the archive.
|
|
884
|
+
|
|
885
|
+
## GitHub Auth (HARD GATE)
|
|
886
|
+
|
|
887
|
+
- **ALL GitHub operations use \`jgs-jeeves\` auth.** Set \`GH_TOKEN\` before any \`gh\` CLI command:
|
|
888
|
+
\`\`\`powershell
|
|
889
|
+
\$env:GH_TOKEN = (Get-Content "J:\\config\\credentials\\github\\jgs-jeeves.token" -Raw).Trim()
|
|
890
|
+
\`\`\`
|
|
891
|
+
- Never write to GitHub as \`karmaniverous\` — that's Jason's account.
|
|
892
|
+
- If \`jgs-jeeves\` lacks permissions, **escalate to Jason** rather than falling back to \`karmaniverous\`.
|
|
893
|
+
|
|
894
|
+
## Issue Hygiene
|
|
895
|
+
|
|
896
|
+
- **Always comment rationale when closing an issue without resolution** (duplicate, won't-fix, obsolete). The close action alone doesn't explain why.
|
|
897
|
+
- Reference the replacement issue/PR when closing as duplicate.
|
|
898
|
+
|
|
899
|
+
## Code Style
|
|
900
|
+
|
|
901
|
+
- Prettier is source of truth for formatting.
|
|
902
|
+
- Keep imports sorted per repo tooling.
|
|
903
|
+
- Avoid dead code.
|
|
904
|
+
- TSDoc \`@module\` or \`@packageDocumentation\` on every non-test module.
|
|
905
|
+
- First 160 chars of module doc should be high-signal: what it does, IO/side effects, traversal hints.
|
|
906
|
+
|
|
907
|
+
## eslint-disable is a HARD GATE
|
|
908
|
+
|
|
909
|
+
Never disable lint/typecheck rules without surfacing it for discussion first. Fix the code, don't suppress the warning. For test mocks, use properly typed partial objects (\`Partial<RealType>\`, typed \`MockReply\` interfaces) instead of \`any\`. Tests are code.
|
|
910
|
+
|
|
911
|
+
## Git Merge Policy
|
|
912
|
+
|
|
913
|
+
- **No squash merges.** Preserve commit history.
|
|
914
|
+
- **PR reviewer:** When creating a PR under \`jgs-jeeves\` auth, always add \`karmaniverous\` (Jason) as a reviewer.
|
|
915
|
+
`;
|
|
916
|
+
|
|
917
|
+
var jeevesContent = `---
|
|
755
918
|
name: jeeves
|
|
756
919
|
description: Jeeves platform architecture, data flow, component interaction, scripts repo, and coordination knowledge. Use when making architectural decisions, coordinating across components, checking platform health, managing service lifecycle, or working with the scripts repo.
|
|
757
920
|
---
|
|
@@ -875,26 +1038,304 @@ When a workspace file exceeds the warning threshold, a \`## {filename}\` alert a
|
|
|
875
1038
|
Each file heading follows the same declined/active lifecycle as component headings. Users can decline alerts by changing the heading to \`## {filename}: declined\` (e.g., \`## AGENTS.md: declined\`).
|
|
876
1039
|
`;
|
|
877
1040
|
|
|
1041
|
+
var operationsContent = `---
|
|
1042
|
+
name: operations
|
|
1043
|
+
description: Operational knowledge for a Jeeves installation. Covers date formatting utilities, email pipeline architecture, curation signal protocol, label taxonomy, and data flow patterns. Use when working with date formatting, email scripts, debugging email pipeline issues, or understanding how human email actions are interpreted.
|
|
1044
|
+
---
|
|
1045
|
+
|
|
1046
|
+
# Operations
|
|
1047
|
+
|
|
1048
|
+
Operational knowledge for the Jeeves platform. Covers email pipeline architecture, curation protocols, and operational conventions.
|
|
1049
|
+
|
|
1050
|
+
## Date Formatting
|
|
1051
|
+
|
|
1052
|
+
A \`date-fns\` wrapper lives at \`{configRoot}/jeeves-core/scripts/src/lib/dates.ts\`. It provides:
|
|
1053
|
+
|
|
1054
|
+
| Export | Purpose |
|
|
1055
|
+
|--------|---------|
|
|
1056
|
+
| \`dayOfWeek(dateStr)\` | Full weekday name for an ISO date string (e.g. \`'Monday'\`) |
|
|
1057
|
+
| \`formatDate(dateStr, fmt)\` | Format with any date-fns pattern |
|
|
1058
|
+
| \`relativeDays(dateStr, refStr?)\` | Human-friendly relative description (\`'today'\`, \`'tomorrow'\`, \`'3 days ago'\`) |
|
|
1059
|
+
| \`parseISO\` / \`format\` | Re-exported from date-fns for direct use |
|
|
1060
|
+
|
|
1061
|
+
### Gateway session usage
|
|
1062
|
+
|
|
1063
|
+
From a gateway session, call via \`exec\`:
|
|
1064
|
+
|
|
1065
|
+
\`\`\`
|
|
1066
|
+
node -e "import { dayOfWeek } from './src/lib/dates.js'; console.log(dayOfWeek('2026-05-11'));"
|
|
1067
|
+
\`\`\`
|
|
1068
|
+
|
|
1069
|
+
with \`workdir: {configRoot}/jeeves-core/scripts\`.
|
|
1070
|
+
|
|
1071
|
+
Or use the simpler inline form when the full wrapper isn't needed:
|
|
1072
|
+
|
|
1073
|
+
\`\`\`
|
|
1074
|
+
node -e "import { format, parseISO } from 'date-fns'; console.log(format(parseISO('2026-05-11'), 'EEEE'));"
|
|
1075
|
+
\`\`\`
|
|
1076
|
+
|
|
1077
|
+
with \`workdir: {configRoot}/jeeves-core/scripts\` (so date-fns resolves from \`node_modules\`).
|
|
1078
|
+
|
|
1079
|
+
### Hard gate
|
|
1080
|
+
|
|
1081
|
+
NEVER state a day of the week without computing it first. LLMs cannot do day-of-week arithmetic reliably.
|
|
1082
|
+
|
|
1083
|
+
## Email Curation Signal Protocol
|
|
1084
|
+
|
|
1085
|
+
Defines how human email actions in Gmail are interpreted by Jeeves email processes.
|
|
1086
|
+
|
|
1087
|
+
### Human Signals
|
|
1088
|
+
|
|
1089
|
+
| Signal | Meaning | Action |
|
|
1090
|
+
|--------|---------|--------|
|
|
1091
|
+
| Label added | Human is adjusting Jeeves classification | Update domain process inputs to reflect new classification |
|
|
1092
|
+
| Label removed | Human is adjusting Jeeves classification (removal) | Update domain process inputs to reflect removed classification |
|
|
1093
|
+
| Archived → Inbox | Human wants to keep this email in sight | Add \`watch\` label via update queue |
|
|
1094
|
+
| Starred / Flagged | Elevated attention — email is important in context | Domain processes should weight higher |
|
|
1095
|
+
| Moved to Spam | Confirmed spam — human classified as junk | Learn from classification for future triage |
|
|
1096
|
+
| Removed from Spam | False positive — human rescued from spam | Process as normal email, learn from false positive |
|
|
1097
|
+
|
|
1098
|
+
### Watch Label
|
|
1099
|
+
|
|
1100
|
+
The \`watch\` label has special semantics:
|
|
1101
|
+
- When present, never auto-archive the email
|
|
1102
|
+
- When a watched email lands in archive (by anyone), remove the watch label
|
|
1103
|
+
- Added automatically when a human moves an archived email back to inbox
|
|
1104
|
+
|
|
1105
|
+
### Label Taxonomy
|
|
1106
|
+
|
|
1107
|
+
Labels applied by Jeeves processes fall into two categories:
|
|
1108
|
+
|
|
1109
|
+
**Mechanical labels** (applied by domain extractors with high confidence):
|
|
1110
|
+
- \`meeting\` — meeting-related email (invite, notes, transcript)
|
|
1111
|
+
- \`finance\` — financial email (receipt, invoice, billing, statement)
|
|
1112
|
+
|
|
1113
|
+
**Reasoning labels** (applied by Update Email Meta, requiring cross-domain context):
|
|
1114
|
+
- \`project/<name>\` — associated with a known project
|
|
1115
|
+
- \`todo\` — requires action or work from the user
|
|
1116
|
+
- \`reply\` — someone is waiting on a response
|
|
1117
|
+
- \`alert\` — automated notification from a service
|
|
1118
|
+
- \`readme\` — newsletter or subscribed informational content
|
|
1119
|
+
|
|
1120
|
+
### Labeling Principles
|
|
1121
|
+
|
|
1122
|
+
1. Label at the earliest point where confidence is high enough
|
|
1123
|
+
2. Domain extractors label what they know with certainty
|
|
1124
|
+
3. Update Email Meta labels what requires cross-domain context
|
|
1125
|
+
4. A thread can have multiple labels
|
|
1126
|
+
5. Do not re-label threads that already have the label
|
|
1127
|
+
6. **Prefer false negatives over false positives**
|
|
1128
|
+
|
|
1129
|
+
### Poll Scope
|
|
1130
|
+
|
|
1131
|
+
Query: \`newer_than:1d in:anywhere\`
|
|
1132
|
+
|
|
1133
|
+
Must include spam and trash to detect human curation signals (e.g., moving to/from spam).
|
|
1134
|
+
|
|
1135
|
+
## Email Pipeline Architecture
|
|
1136
|
+
|
|
1137
|
+
### Directory Layout
|
|
1138
|
+
|
|
1139
|
+
\`\`\`
|
|
1140
|
+
{configRoot}/jeeves-core/email-config.json — pipeline configuration (accounts, buckets)
|
|
1141
|
+
{workspace}/../email/threads/{account}/ — canonical email archive (thread.json + per-message JSONs)
|
|
1142
|
+
\`\`\`
|
|
1143
|
+
|
|
1144
|
+
### Data Flow
|
|
1145
|
+
|
|
1146
|
+
1. **Poll** (\`email/poll.ts\`) — searches Gmail for recent threads, classifies, enqueues important ones for metadata fetch
|
|
1147
|
+
2. **Fetch** (\`email/email-fetch.ts\`) — fetches full thread metadata from Gmail, creates/updates \`thread.json\` cache, enqueues for body download
|
|
1148
|
+
3. **Download** (\`email/download.ts\`) — downloads full message bodies, writes per-message JSONs to \`threads/{account}/{threadId}/\`
|
|
1149
|
+
4. **Drain Updates** (\`email/drain-updates.ts\`) — applies label changes and other queued updates back to Gmail
|
|
1150
|
+
5. **Meta synthesis** — jeeves-meta synthesizes email archives into searchable summaries
|
|
1151
|
+
|
|
1152
|
+
### thread.json (Cache Format)
|
|
1153
|
+
|
|
1154
|
+
Each \`threads/{account}/{threadId}/thread.json\` contains:
|
|
1155
|
+
- \`threadId\`, \`account\`, \`subject\`, \`participants\`
|
|
1156
|
+
- \`messages\` — record of \`{ messageId → { from, to, cc, date, internalDateMs, labels, snippet, attachments } }\`
|
|
1157
|
+
- \`provenance\` — label change history
|
|
1158
|
+
- \`cachedAt\`, \`updatedAt\`
|
|
1159
|
+
|
|
1160
|
+
### Per-Message JSONs
|
|
1161
|
+
|
|
1162
|
+
Each \`threads/{account}/{threadId}/{messageId}.json\` contains full message data:
|
|
1163
|
+
- \`messageId\`, \`threadId\`, \`account\`, \`subject\`, \`from\`, \`to\`, \`cc\`
|
|
1164
|
+
- \`date\` (RFC 2822), \`internalDateMs\` (epoch ms)
|
|
1165
|
+
- \`labels\`, \`body\`, \`attachments\`, \`downloadedAt\`
|
|
1166
|
+
`;
|
|
1167
|
+
|
|
1168
|
+
var playbooksContent = `---
|
|
1169
|
+
name: playbooks
|
|
1170
|
+
description: >
|
|
1171
|
+
Reusable operational workflow patterns for the Jeeves platform. Use when asked to
|
|
1172
|
+
set up a daily briefing for a person or team, create standing meeting ops (notes +
|
|
1173
|
+
agenda generation), replicate an existing workflow pattern for a new context, or
|
|
1174
|
+
understand how recurring intelligence/ops workflows are structured. Covers the
|
|
1175
|
+
full stack: content directory, TASK files, standing orders, runner jobs, dispatcher
|
|
1176
|
+
scripts, Slack channel integration, and meta synthesis.
|
|
1177
|
+
---
|
|
1178
|
+
|
|
1179
|
+
# Playbooks
|
|
1180
|
+
|
|
1181
|
+
Proven, replicable operational patterns. Each playbook describes what it does, what
|
|
1182
|
+
infrastructure it needs, and how to instantiate a new instance.
|
|
1183
|
+
|
|
1184
|
+
## Common Infrastructure
|
|
1185
|
+
|
|
1186
|
+
All playbooks share these building blocks:
|
|
1187
|
+
|
|
1188
|
+
| Component | Purpose |
|
|
1189
|
+
|-----------|---------|
|
|
1190
|
+
| **Content directory** | \`{workspace}/../<silo>/<domain>/\` — stores output files, \`.meta/\`, standing orders |
|
|
1191
|
+
| **TASK file** | Markdown prompt that defines the LLM session's entire job |
|
|
1192
|
+
| **Standing orders** | \`standing-orders.md\` — append-only file for persistent stakeholder preferences |
|
|
1193
|
+
| **Dispatcher script** | TypeScript in \`{configRoot}/jeeves-core/scripts/src/\` — reads TASK, spawns worker |
|
|
1194
|
+
| **Runner job** | jeeves-runner job with cron schedule, timezone, and rrstack |
|
|
1195
|
+
| **Slack channel** | Delivery surface — summary posts, quick-link pins, feedback loop |
|
|
1196
|
+
| **Meta entity** | \`.meta/\` directory seeded so jeeves-meta synthesizes context over time |
|
|
1197
|
+
|
|
1198
|
+
### Dispatcher Pattern
|
|
1199
|
+
|
|
1200
|
+
All dispatchers use \`taskFileDispatcher\` from \`dispatchers/lib/task-file-dispatcher.ts\`:
|
|
1201
|
+
|
|
1202
|
+
\`\`\`typescript
|
|
1203
|
+
import { taskFileDispatcher } from '../dispatchers/lib/task-file-dispatcher.js';
|
|
1204
|
+
|
|
1205
|
+
taskFileDispatcher({
|
|
1206
|
+
scriptName: '<silo>/<job-name>',
|
|
1207
|
+
jobId: '<runner-job-id>',
|
|
1208
|
+
taskFile: '<path-to-TASK.md>',
|
|
1209
|
+
timeout: 600,
|
|
1210
|
+
injectDateContext: true,
|
|
1211
|
+
dateTimezone: '<IANA timezone>',
|
|
1212
|
+
});
|
|
1213
|
+
\`\`\`
|
|
1214
|
+
|
|
1215
|
+
\`injectDateContext: true\` prepends an authoritative date line so the LLM knows today's date.
|
|
1216
|
+
|
|
1217
|
+
### Standing Orders Convention
|
|
1218
|
+
|
|
1219
|
+
- Append-only — never modify existing entries
|
|
1220
|
+
- TASK files instruct the LLM to read standing orders at Step 0
|
|
1221
|
+
- TASK files instruct the LLM to append new persistent preferences from channel feedback
|
|
1222
|
+
- Include initial configuration section with participants, timezones, channel rules
|
|
1223
|
+
|
|
1224
|
+
## Available Playbook Patterns
|
|
1225
|
+
|
|
1226
|
+
| Pattern | Description |
|
|
1227
|
+
|---------|-------------|
|
|
1228
|
+
| **Daily Briefing** | Recurring intelligence or action-item report for a stakeholder |
|
|
1229
|
+
| **Standing Meeting Ops** | Post-meeting notes + next-day agenda generation for a recurring meeting |
|
|
1230
|
+
|
|
1231
|
+
## Instantiation Checklist
|
|
1232
|
+
|
|
1233
|
+
When creating a new playbook instance:
|
|
1234
|
+
|
|
1235
|
+
1. Choose the appropriate pattern from the table above
|
|
1236
|
+
2. Create the content directory with \`.meta/\` and \`standing-orders.md\`
|
|
1237
|
+
3. Write the TASK file(s) — adapt from an existing instance. Ensure Step 0 reads feedback from the *delivery channel* (where output is posted), not only a DM
|
|
1238
|
+
4. Write the dispatcher script(s) in \`{configRoot}/jeeves-core/scripts/src/<silo>/\`
|
|
1239
|
+
5. Register the runner job(s) with appropriate cron, timezone, rrstack
|
|
1240
|
+
6. Set up the Slack channel — pin a quick-links message if the pattern calls for it
|
|
1241
|
+
7. Seed \`.meta/\` so meta synthesis begins
|
|
1242
|
+
8. Test with \`--dry-run\` before going live
|
|
1243
|
+
`;
|
|
1244
|
+
|
|
1245
|
+
var slackBotProvisionerContent = `---
|
|
1246
|
+
name: slack-bot-provisioner
|
|
1247
|
+
description: Provision a new Slack bot identity for Clawdbot on a fresh server. Guides through Slack App creation steps, collects tokens, writes local config/env, and verifies connectivity.
|
|
1248
|
+
---
|
|
1249
|
+
|
|
1250
|
+
# Slack bot provisioner (per-bot server)
|
|
1251
|
+
|
|
1252
|
+
Use this when you are setting up **a new Clawdbot instance** that should have **its own Slack bot identity** (one Slack App per bot), and you want a repeatable guided setup.
|
|
1253
|
+
|
|
1254
|
+
This skill assumes:
|
|
1255
|
+
- The user is a Slack workspace admin.
|
|
1256
|
+
- Each bot runs on its own server with its own Gateway config.
|
|
1257
|
+
|
|
1258
|
+
## What can be automated vs not
|
|
1259
|
+
|
|
1260
|
+
**Automated (this skill):**
|
|
1261
|
+
- Create local folders.
|
|
1262
|
+
- Write a \`slack.env\` (bot token, signing secret).
|
|
1263
|
+
- Patch the Clawdbot gateway config to enable Slack for this instance (user approves).
|
|
1264
|
+
- Run a connectivity test (send a message to a channel).
|
|
1265
|
+
|
|
1266
|
+
**Not fully automatable (Slack-side):**
|
|
1267
|
+
- Creating/installing the Slack App and granting scopes (UI/OAuth).
|
|
1268
|
+
- Verifying event subscription URLs (requires public HTTPS endpoint).
|
|
1269
|
+
|
|
1270
|
+
## Recommended mode
|
|
1271
|
+
Start with **outbound-only** (post messages) and expand to event subscriptions later.
|
|
1272
|
+
|
|
1273
|
+
## Quick start
|
|
1274
|
+
|
|
1275
|
+
1) Have the user do the Slack UI steps in \`references/slack-app-checklist.md\`.
|
|
1276
|
+
2) Run the provisioning script:
|
|
1277
|
+
|
|
1278
|
+
- PowerShell:
|
|
1279
|
+
- \`powershell -NoProfile -ExecutionPolicy Bypass -File scripts/provision.ps1\`
|
|
1280
|
+
|
|
1281
|
+
The script will prompt for:
|
|
1282
|
+
- bot name
|
|
1283
|
+
- Slack bot token (\`xoxb-...\`)
|
|
1284
|
+
- Slack signing secret
|
|
1285
|
+
- (optional) test channel id
|
|
1286
|
+
|
|
1287
|
+
## Files
|
|
1288
|
+
- Script: \`scripts/provision.ps1\`
|
|
1289
|
+
- Reference checklist: \`references/slack-app-checklist.md\`
|
|
1290
|
+
- Reference scopes: \`references/scopes.md\`
|
|
1291
|
+
|
|
1292
|
+
## Secrets (best practices)
|
|
1293
|
+
- **Do not** store secrets inside the skill folder (skills are meant to be shareable/publishable).
|
|
1294
|
+
- Store secrets **per-instance** in the Clawdbot runtime directory (recommended):
|
|
1295
|
+
- \`C:\\Users\\Administrator\\.clawdbot\\credentials\\...\`
|
|
1296
|
+
- Prefer environment variables / local credential files loaded by the Gateway/service manager.
|
|
1297
|
+
- Never paste Slack secrets into public chats.
|
|
1298
|
+
|
|
1299
|
+
## Safety notes
|
|
1300
|
+
- Store secrets per-instance. Do not reuse tokens across bot identities.
|
|
1301
|
+
- Avoid bot-to-bot loops: bots should ignore messages from other bots by default.
|
|
1302
|
+
`;
|
|
1303
|
+
|
|
878
1304
|
/**
|
|
879
|
-
* Skill seeding: write
|
|
1305
|
+
* Skill seeding: write all bundled platform skills to the workspace.
|
|
880
1306
|
*
|
|
881
1307
|
* @remarks
|
|
882
|
-
*
|
|
883
|
-
* Every installer (core CLI and component plugins) writes
|
|
1308
|
+
* Skill files are entirely generated — no user-authored content (Decision 48).
|
|
1309
|
+
* Every installer (core CLI and component plugins) writes them unconditionally.
|
|
884
1310
|
* Content is inlined at build time via `rollup-plugin-md.ts`.
|
|
1311
|
+
*
|
|
1312
|
+
* @module
|
|
885
1313
|
*/
|
|
1314
|
+
/** Map of skill directory name to inlined content. */
|
|
1315
|
+
const BUNDLED_SKILLS = {
|
|
1316
|
+
jeeves: jeevesContent,
|
|
1317
|
+
coding: codingContent,
|
|
1318
|
+
'slack-bot-provisioner': slackBotProvisionerContent,
|
|
1319
|
+
operations: operationsContent,
|
|
1320
|
+
playbooks: playbooksContent,
|
|
1321
|
+
};
|
|
886
1322
|
/**
|
|
887
|
-
* Seed
|
|
1323
|
+
* Seed all bundled platform skills into the workspace.
|
|
1324
|
+
*
|
|
1325
|
+
* @remarks
|
|
1326
|
+
* Writes each skill to `{workspace}/skills/{name}/SKILL.md`, creating
|
|
1327
|
+
* directories as needed. Overwrites existing content unconditionally.
|
|
888
1328
|
*
|
|
889
1329
|
* @param workspacePath - Workspace root directory.
|
|
890
1330
|
*/
|
|
891
|
-
function
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
|
|
1331
|
+
function seedSkills(workspacePath) {
|
|
1332
|
+
for (const [name, content] of Object.entries(BUNDLED_SKILLS)) {
|
|
1333
|
+
const skillDir = join(workspacePath, SKILLS_DIR, name);
|
|
1334
|
+
if (!existsSync(skillDir)) {
|
|
1335
|
+
mkdirSync(skillDir, { recursive: true });
|
|
1336
|
+
}
|
|
1337
|
+
writeFileSync(join(skillDir, 'SKILL.md'), content, 'utf-8');
|
|
895
1338
|
}
|
|
896
|
-
const skillPath = join(skillDir, 'SKILL.md');
|
|
897
|
-
writeFileSync(skillPath, skillContent, 'utf-8');
|
|
898
1339
|
}
|
|
899
1340
|
|
|
900
1341
|
/**
|
|
@@ -1354,11 +1795,11 @@ function createPluginCli(options) {
|
|
|
1354
1795
|
console.log(' ⚠ Could not write HEARTBEAT entry');
|
|
1355
1796
|
}
|
|
1356
1797
|
try {
|
|
1357
|
-
|
|
1358
|
-
console.log(' ✓
|
|
1798
|
+
seedSkills(ws);
|
|
1799
|
+
console.log(' ✓ Platform skills seeded');
|
|
1359
1800
|
}
|
|
1360
1801
|
catch {
|
|
1361
|
-
console.log(' ⚠ Could not seed
|
|
1802
|
+
console.log(' ⚠ Could not seed platform skills');
|
|
1362
1803
|
}
|
|
1363
1804
|
}
|
|
1364
1805
|
}
|
|
@@ -48,31 +48,31 @@ var hasRequiredExtraTypings;
|
|
|
48
48
|
function requireExtraTypings () {
|
|
49
49
|
if (hasRequiredExtraTypings) return extraTypings.exports;
|
|
50
50
|
hasRequiredExtraTypings = 1;
|
|
51
|
-
(function (module, exports
|
|
51
|
+
(function (module, exports) {
|
|
52
52
|
const commander = require$$0;
|
|
53
53
|
|
|
54
|
-
exports
|
|
54
|
+
exports = module.exports = {};
|
|
55
55
|
|
|
56
56
|
// Return a different global program than commander,
|
|
57
57
|
// and don't also return it as default export.
|
|
58
|
-
exports
|
|
58
|
+
exports.program = new commander.Command();
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Expose classes. The FooT versions are just types, so return Commander original implementations!
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
-
exports
|
|
65
|
-
exports
|
|
66
|
-
exports
|
|
67
|
-
exports
|
|
68
|
-
exports
|
|
69
|
-
exports
|
|
70
|
-
exports
|
|
64
|
+
exports.Argument = commander.Argument;
|
|
65
|
+
exports.Command = commander.Command;
|
|
66
|
+
exports.CommanderError = commander.CommanderError;
|
|
67
|
+
exports.Help = commander.Help;
|
|
68
|
+
exports.InvalidArgumentError = commander.InvalidArgumentError;
|
|
69
|
+
exports.InvalidOptionArgumentError = commander.InvalidArgumentError; // Deprecated
|
|
70
|
+
exports.Option = commander.Option;
|
|
71
71
|
|
|
72
|
-
exports
|
|
73
|
-
exports
|
|
72
|
+
exports.createCommand = (name) => new commander.Command(name);
|
|
73
|
+
exports.createOption = (flags, description) =>
|
|
74
74
|
new commander.Option(flags, description);
|
|
75
|
-
exports
|
|
75
|
+
exports.createArgument = (name, description) =>
|
|
76
76
|
new commander.Argument(name, description);
|
|
77
77
|
} (extraTypings, extraTypings.exports));
|
|
78
78
|
return extraTypings.exports;
|
|
@@ -251,12 +251,26 @@ const COMPONENT_CONFIG_PREFIX = 'jeeves-';
|
|
|
251
251
|
* - `{configRoot}/jeeves-{name}/` for each component
|
|
252
252
|
*/
|
|
253
253
|
let state;
|
|
254
|
+
const WINDOWS_DRIVE_RE = /^[a-zA-Z]:/;
|
|
255
|
+
/**
|
|
256
|
+
* Throw if a path looks like a Windows drive letter on a non-Windows platform.
|
|
257
|
+
*
|
|
258
|
+
* @param label - Human-readable name for the path (used in error messages).
|
|
259
|
+
* @param value - The raw path string to validate.
|
|
260
|
+
*/
|
|
261
|
+
function rejectWindowsDrivePath(label, value) {
|
|
262
|
+
if (process.platform !== 'win32' && WINDOWS_DRIVE_RE.test(value)) {
|
|
263
|
+
throw new Error(`jeeves-core: ${label} "${value}" looks like a Windows drive-letter path and will not resolve correctly on this platform.`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
254
266
|
/**
|
|
255
267
|
* Initialize the core library with workspace and config root paths.
|
|
256
268
|
*
|
|
257
269
|
* @param options - Workspace and config root paths.
|
|
258
270
|
*/
|
|
259
271
|
function init(options) {
|
|
272
|
+
rejectWindowsDrivePath('configRoot', options.configRoot);
|
|
273
|
+
rejectWindowsDrivePath('workspacePath', options.workspacePath);
|
|
260
274
|
state = {
|
|
261
275
|
workspacePath: options.workspacePath,
|
|
262
276
|
configRoot: options.configRoot,
|