@jefuriiij/synthra 0.1.4 → 0.1.5

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.
@@ -1443,7 +1443,7 @@ import { mkdir as mkdir3, readFile as readFile7, stat as stat2, writeFile as wri
1443
1443
 
1444
1444
  // src/hooks/claude-md.ts
1445
1445
  import { readFile as readFile6, writeFile as writeFile2 } from "fs/promises";
1446
- var POLICY_VERSION = 1;
1446
+ var POLICY_VERSION = 2;
1447
1447
  var POLICY_BEGIN = `<!-- synthra-policy v${POLICY_VERSION} BEGIN -->`;
1448
1448
  var POLICY_END = `<!-- synthra-policy v${POLICY_VERSION} END -->`;
1449
1449
  var ANY_BLOCK_RE = /<!--\s*synthra-policy\s+v\d+\s+BEGIN\s*-->[\s\S]*?<!--\s*synthra-policy\s+v\d+\s+END\s*-->\s*/g;
@@ -1452,33 +1452,75 @@ function policyBlock() {
1452
1452
  POLICY_BEGIN,
1453
1453
  "## Synthra context policy",
1454
1454
  "",
1455
- "Synthra has pre-loaded a structured context pack into this session and",
1456
- "exposes the project's code graph through three MCP tools. **Prefer these",
1457
- "tools over Grep / Glob** \u2014 they are faster, cheaper, and already filtered",
1455
+ "Synthra has pre-loaded structured context into this session and exposes",
1456
+ "the project's code graph through MCP tools. **Prefer these tools over",
1457
+ "Grep / Glob / Read** \u2014 they are faster, cheaper, and already filtered",
1458
1458
  "to relevant files.",
1459
1459
  "",
1460
1460
  "### Tools",
1461
1461
  "",
1462
- "- **`graph_continue(query)`** \u2014 your default first move when you need",
1463
- " project context. Returns signatures + top function bodies + linked test",
1464
- ' files, with a `confidence` label. If `confidence === "high"`, **stop**:',
1465
- " do not call Grep/Glob for the same query.",
1466
- '- **`graph_read(target)`** \u2014 fetch source for a specific `"file/path.ts"`',
1467
- ' or `"file/path.ts::SymbolName"`. Use this once you know what you want.',
1462
+ "- **`graph_continue(query)`** \u2014 returns a `Confidence` label, the list",
1463
+ " of relevant `Files`, and signatures + top function bodies for those",
1464
+ " files. Your default first move when you need project context.",
1465
+ "- **`graph_read(target)`** \u2014 fetch source. Prefer the",
1466
+ ' `"file/path.ts::SymbolName"` form over a bare file path \u2014 reading one',
1467
+ " symbol is ~50 tokens, reading a whole file is thousands.",
1468
1468
  "- **`graph_register_edit(files)`** \u2014 after you edit files, call this so",
1469
- " Synthra ranks them higher and avoids surfacing stale snapshots.",
1469
+ " subsequent turns weight your changes and avoid stale snapshots.",
1470
1470
  "",
1471
- "### Rules",
1471
+ "### When to call `graph_continue` \u2014 and when to skip",
1472
1472
  "",
1473
- "1. Call `graph_continue` **before** Grep / Glob for any question about",
1474
- " project code. Grep / Glob calls for the same query may be blocked at",
1475
- " the hook layer when the graph already has a confident answer.",
1476
- '2. When `graph_continue` returns `confidence: "high"`, treat the pack as',
1477
- " authoritative \u2014 don't second-guess it with a Grep.",
1478
- "3. Use `graph_read` instead of `Read` when you only need a specific symbol",
1479
- " from a file (you get less noise + line numbers).",
1480
- "4. After editing files, call `graph_register_edit(files)` so subsequent",
1481
- " turns weight your changes correctly.",
1473
+ "**Call `graph_continue` only when you do NOT already know the relevant",
1474
+ "files.**",
1475
+ "",
1476
+ "Call it when:",
1477
+ "- This is the first message of a new task or conversation",
1478
+ "- The task shifts to a different area of the codebase",
1479
+ "- You need files you haven't seen yet in this session",
1480
+ "",
1481
+ "**Skip `graph_continue` when:**",
1482
+ "- You already identified the relevant files earlier in this conversation",
1483
+ "- You are doing follow-up work on files already read (verify, refactor,",
1484
+ " test, docs, cleanup, commit)",
1485
+ "- The task is pure text (commit message, explanation, summary)",
1486
+ "",
1487
+ 'If skipping, go directly to `graph_read("file.ts::symbol")` on what',
1488
+ "you already know.",
1489
+ "",
1490
+ "### Confidence caps",
1491
+ "",
1492
+ "When `graph_continue` returns:",
1493
+ "",
1494
+ "- **`Confidence: high`** \u2192 Stop. Do NOT Grep, Glob, or further explore",
1495
+ " for this query. The graph already has it.",
1496
+ "- **`Confidence: medium`** or **`low`** \u2192 You may use Grep / Glob",
1497
+ " sparingly, but the PreToolUse hook may still block redundant calls.",
1498
+ "",
1499
+ "### Reading code",
1500
+ "",
1501
+ "- **Always use `file::symbol` notation** with `graph_read`. Whole-file",
1502
+ " reads should be rare \u2014 only when you genuinely need the full file.",
1503
+ "- If `graph_continue`'s `Files` list contains a `::` entry, pass it",
1504
+ " verbatim to `graph_read`.",
1505
+ "",
1506
+ "### Don'ts",
1507
+ "",
1508
+ "- Don't Grep / Glob before calling `graph_continue` when required \u2014 the",
1509
+ " PreToolUse hook may block it.",
1510
+ "- Don't call `graph_continue` more than once per turn.",
1511
+ "- Don't read whole files when a symbol-level read would suffice.",
1512
+ "",
1513
+ "### Session-end resume note",
1514
+ "",
1515
+ `When the user signals they're done (e.g. "bye", "wrap up", "done"),`,
1516
+ "proactively update `.synthra/CONTEXT.md` with:",
1517
+ "",
1518
+ "- **Current Task**: one sentence on what was being worked on",
1519
+ "- **Key Decisions**: bullet list, max 3 items",
1520
+ "- **Next Steps**: bullet list, max 3 items",
1521
+ "",
1522
+ "Keep `CONTEXT.md` under 20 lines total. Don't summarise the conversation",
1523
+ "\u2014 write only what's needed to resume next session.",
1482
1524
  "",
1483
1525
  "_This block is managed by Synthra. Edits inside the BEGIN/END markers",
1484
1526
  "are overwritten on every `syn .` run._",