bereach-openclaw 1.6.11 → 1.6.12

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "bereach-openclaw",
3
3
  "name": "BeReach",
4
- "version": "1.6.11",
4
+ "version": "1.6.12",
5
5
  "description": "LinkedIn outreach automation — 75+ tools, hook-based enforcement, dynamic context",
6
6
  "configSchema": {
7
7
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bereach-openclaw",
3
- "version": "1.6.11",
3
+ "version": "1.6.12",
4
4
  "description": "BeReach LinkedIn automation plugin for OpenClaw",
5
5
  "license": "AGPL-3.0",
6
6
  "exports": {
@@ -0,0 +1,32 @@
1
+ /**
2
+ * agent:bootstrap internal hook — drops workspace bootstrap files (SOUL.md,
3
+ * AGENTS.md, IDENTITY.md, USER.md, TOOLS.md, BOOTSTRAP.md, HEARTBEAT.md,
4
+ * MEMORY.md) from every run.
5
+ *
6
+ * Why: the bereach plugin already injects its full soul template + live status
7
+ * via the before_prompt_build hook (appendSystemContext). Shipping the same
8
+ * 35K soul template again through workspace/SOUL.md doubles it in the system
9
+ * prompt and wastes ~5.2K cached tokens per turn (measured on Haiku 4.5).
10
+ *
11
+ * Mutating event.context.bootstrapFiles = [] drops every file without
12
+ * touching disk, so users' workspace directories stay intact.
13
+ *
14
+ * Proven on 2026-04-14 Docker test: restoring SOUL.md from template and
15
+ * enabling this hook gives 37,492 cached tokens/turn vs 42,690 without it.
16
+ */
17
+ export function registerBootstrapHook(api: any) {
18
+ if (typeof api?.registerHook !== "function") return;
19
+ api.registerHook(
20
+ "agent:bootstrap",
21
+ async (event: any) => {
22
+ if (event && event.context) {
23
+ event.context.bootstrapFiles = [];
24
+ }
25
+ },
26
+ {
27
+ name: "bereach-blank-bootstrap",
28
+ description:
29
+ "Drop workspace bootstrap files — bereach context ships via before_prompt_build already.",
30
+ },
31
+ );
32
+ }
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ import { registerContextHook } from "./hooks/context";
5
5
  import { registerEnforcementHook } from "./hooks/enforcement";
6
6
  import { registerTrackingHook } from "./hooks/tracking";
7
7
  import { registerLifecycleHook } from "./hooks/lifecycle";
8
+ import { registerBootstrapHook } from "./hooks/bootstrap";
8
9
  import { setTtl, isApiBaseConfigured } from "./hooks/cache";
9
10
  import { createSessionState, type PluginConfig } from "./hooks/types";
10
11
  import { errMsg, createLogger } from "./hooks/utils";
@@ -88,6 +89,7 @@ export default function register(api: any) {
88
89
  ["enforcement", () => registerEnforcementHook(api, apiKey, config, state)],
89
90
  ["tracking", () => registerTrackingHook(api, state)],
90
91
  ["lifecycle", () => registerLifecycleHook(api, apiKey, {}, state)],
92
+ ["bootstrap", () => registerBootstrapHook(api)],
91
93
  ];
92
94
 
93
95
  for (const [name, fn] of hooks) {
@@ -5,6 +5,28 @@ import { resolveApiKey } from "../index";
5
5
 
6
6
  const API_BASE = "https://api.bereach.ai";
7
7
 
8
+ // Drops short/redundant property descriptions before registration to shrink the
9
+ // cached tool-schema prefix (~3,400 tokens/turn on Haiku 4.5). Keeps any
10
+ // description that contains quoted enum hints, cross-refs to other tools, or
11
+ // format/range constraints — the agent still needs those to pick the right value.
12
+ function isDescriptionLoadBearing(desc: string): boolean {
13
+ if (desc.length > 90) return true;
14
+ if (/["'].+["']/.test(desc)) return true;
15
+ if (/\bresolve\b|bereach_|\brequired\b|\boptional\b|\bmax\b|\bdefault\b|\bmin\b|\bformat\b|\bISO\b|\bURN\b|\burn:/i.test(desc)) return true;
16
+ return false;
17
+ }
18
+
19
+ function compactSchemaDescriptions(schema: any): any {
20
+ if (!schema || typeof schema !== "object") return schema;
21
+ if (Array.isArray(schema)) return schema.map(compactSchemaDescriptions);
22
+ const out: Record<string, any> = {};
23
+ for (const [k, v] of Object.entries(schema)) {
24
+ if (k === "description" && typeof v === "string" && !isDescriptionLoadBearing(v)) continue;
25
+ out[k] = compactSchemaDescriptions(v);
26
+ }
27
+ return out;
28
+ }
29
+
8
30
  /**
9
31
  * Register all tools with OpenClaw.
10
32
  * Per-request filtering is handled via allowedTools in the before_prompt_build hook.
@@ -22,7 +44,7 @@ export function registerAllTools(api: any) {
22
44
  api.registerTool({
23
45
  name: def.name,
24
46
  description: def.description,
25
- parameters: def.parameters,
47
+ parameters: compactSchemaDescriptions(def.parameters),
26
48
  async execute(_id: string, params: Record<string, unknown>) {
27
49
  if (def.handler === "__set_api_key__") {
28
50
  const key = String(params.apiKey ?? "").trim();