snipara-companion 1.1.21 → 1.1.23
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/README.md +38 -1
- package/dist/index.d.ts +74 -1
- package/dist/index.js +689 -146
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -448,9 +448,46 @@ Semantics:
|
|
|
448
448
|
- `snipara-companion code *` = direct access to the code graph tools without routing through `snipara_context_query`
|
|
449
449
|
- `snipara-companion recall` = direct durable memory lookup for decisions, learnings, preferences, and carryover
|
|
450
450
|
- `snipara-companion session-bootstrap` = durable memory first, optional weak session carryover second
|
|
451
|
-
- `snipara-companion task-commit` = durable outcomes only
|
|
451
|
+
- `snipara-companion task-commit` = durable task/phase/workflow outcomes only, not a mechanical mirror of every Git commit
|
|
452
|
+
- `snipara-companion memory-guard check` = forced memory/context recall before retries, commits, or finalization when a command failed or a publishable package surface is touched
|
|
453
|
+
- `snipara-companion memory-guard remember --guard-tag pre-commit --text "..."` = create a project/team memory in a guard category such as `pre-commit`, `commit`, `failure`, `pre-final`, or `workflow-policy`
|
|
452
454
|
- `--max-daily-tokens` is still accepted as a compatibility alias for `--max-context-tokens`
|
|
453
455
|
|
|
456
|
+
### Memory Guard Before Commit
|
|
457
|
+
|
|
458
|
+
Memory Guard is deterministic, not a user preference. It detects two global signals:
|
|
459
|
+
|
|
460
|
+
- failed or timed-out tool results emitted by Companion hooks
|
|
461
|
+
- changed files under publishable npm or PyPI package manifests
|
|
462
|
+
|
|
463
|
+
When triggered, it recalls project guard memories by category and also queries source context before
|
|
464
|
+
the agent retries, commits, or finalizes. Guard memories are just durable memories with a category tag:
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
snipara-companion memory-guard remember \
|
|
468
|
+
--guard-tag pre-commit \
|
|
469
|
+
--text "For npm packages, run npm login --auth-type=web in a TTY, publish, then verify dist-tags and npx help."
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
Run the check manually with:
|
|
473
|
+
|
|
474
|
+
```bash
|
|
475
|
+
snipara-companion memory-guard check --trigger pre-commit --staged --strict
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
### Commit Memory Policy
|
|
479
|
+
|
|
480
|
+
Companion separates two concepts:
|
|
481
|
+
|
|
482
|
+
- `git commit` is a version-control checkpoint.
|
|
483
|
+
- `snipara-companion task-commit`, `workflow phase-commit`, and `final-commit` call hosted
|
|
484
|
+
`snipara_end_of_task_commit` to persist meaningful task, phase, or workflow outcomes.
|
|
485
|
+
|
|
486
|
+
Do not call `snipara_end_of_task_commit` mechanically for every Git commit. For risky commits,
|
|
487
|
+
package releases, or retries after failures, run Memory Guard first so the agent sees relevant
|
|
488
|
+
project memory and context. If a team wants automatic lightweight checkpoints for every Git commit,
|
|
489
|
+
keep that in a separate hook or adapter; reserve `task-commit` for durable summaries worth recalling.
|
|
490
|
+
|
|
454
491
|
### Compaction-Safe LLM Plan Workflow
|
|
455
492
|
|
|
456
493
|
Use this when the user's LLM has already produced a plan and Snipara should enforce the workflow around it. For coding work, choose LITE, STANDARD, FULL, or FULL + ORCHESTRATED explicitly before editing: LITE is for small single-phase changes, STANDARD is for normal context/code-graph work, FULL managed workflow is for multi-file, risky, release/deploy, architectural, compaction-prone, or maintainer-sensitive work, and FULL + ORCHESTRATED is for production proof gates, drift checks, htasks, or explicit multi-agent coordination.
|
package/dist/index.d.ts
CHANGED
|
@@ -318,6 +318,12 @@ interface MemoriesResult {
|
|
|
318
318
|
total_count: number;
|
|
319
319
|
has_more: boolean;
|
|
320
320
|
}
|
|
321
|
+
interface RememberMemoryResult {
|
|
322
|
+
memory_id?: string;
|
|
323
|
+
stored?: boolean;
|
|
324
|
+
message?: string;
|
|
325
|
+
[key: string]: unknown;
|
|
326
|
+
}
|
|
321
327
|
interface MemoryInvalidateResult {
|
|
322
328
|
memory_id: string;
|
|
323
329
|
status: MemoryStatus;
|
|
@@ -527,6 +533,14 @@ declare class RLMClient {
|
|
|
527
533
|
includeInactive?: boolean;
|
|
528
534
|
warningThreshold?: number;
|
|
529
535
|
}): Promise<RecallResult>;
|
|
536
|
+
rememberMemory(args: {
|
|
537
|
+
text: string;
|
|
538
|
+
type?: MemoryType;
|
|
539
|
+
scope?: MemoryScope;
|
|
540
|
+
category?: string;
|
|
541
|
+
ttlDays?: number;
|
|
542
|
+
source?: string;
|
|
543
|
+
}): Promise<RememberMemoryResult>;
|
|
530
544
|
/**
|
|
531
545
|
* List stored memories with lifecycle filters.
|
|
532
546
|
*/
|
|
@@ -652,6 +666,65 @@ declare function buildToolResultPayload(options: ToolResultPayloadOptions): Reco
|
|
|
652
666
|
declare function getStuckGuardInjection(decision: StuckGuardDecision): string | null;
|
|
653
667
|
declare function formatStuckGuardDecision(result: StuckGuardEvaluationResult): string;
|
|
654
668
|
|
|
669
|
+
type MemoryGuardTrigger = "failure" | "pre-commit" | "commit" | "pre-final" | "manual";
|
|
670
|
+
interface ReleaseSurface {
|
|
671
|
+
ecosystem: "npm" | "pypi";
|
|
672
|
+
name: string;
|
|
673
|
+
version?: string;
|
|
674
|
+
manifestPath: string;
|
|
675
|
+
}
|
|
676
|
+
interface MemoryGuardFinding {
|
|
677
|
+
code: "recent_failure" | "release_surface" | "manual";
|
|
678
|
+
message: string;
|
|
679
|
+
}
|
|
680
|
+
interface MemoryGuardCheckOptions {
|
|
681
|
+
trigger?: MemoryGuardTrigger;
|
|
682
|
+
files?: string[];
|
|
683
|
+
staged?: boolean;
|
|
684
|
+
command?: string;
|
|
685
|
+
result?: string;
|
|
686
|
+
exitCode?: number;
|
|
687
|
+
status?: string;
|
|
688
|
+
strict?: boolean;
|
|
689
|
+
json?: boolean;
|
|
690
|
+
limit?: number;
|
|
691
|
+
categories?: string[];
|
|
692
|
+
includeContext?: boolean;
|
|
693
|
+
recentFailures?: boolean;
|
|
694
|
+
}
|
|
695
|
+
interface MemoryGuardCheckResult {
|
|
696
|
+
triggered: boolean;
|
|
697
|
+
shouldBlock: boolean;
|
|
698
|
+
trigger: MemoryGuardTrigger;
|
|
699
|
+
findings: MemoryGuardFinding[];
|
|
700
|
+
files: string[];
|
|
701
|
+
releaseSurfaces: ReleaseSurface[];
|
|
702
|
+
recentFailures: Array<{
|
|
703
|
+
createdAt: string;
|
|
704
|
+
command?: string;
|
|
705
|
+
classification?: string;
|
|
706
|
+
exitCode?: number;
|
|
707
|
+
status?: string;
|
|
708
|
+
}>;
|
|
709
|
+
query: string;
|
|
710
|
+
categories: string[];
|
|
711
|
+
memoryAvailable: boolean;
|
|
712
|
+
contextAvailable: boolean;
|
|
713
|
+
memories: RecalledMemory[];
|
|
714
|
+
contextSections: Array<{
|
|
715
|
+
title: string;
|
|
716
|
+
file: string;
|
|
717
|
+
relevanceScore: number;
|
|
718
|
+
preview: string;
|
|
719
|
+
}>;
|
|
720
|
+
warnings: string[];
|
|
721
|
+
}
|
|
722
|
+
declare function normalizeGuardTag(tag: string): string;
|
|
723
|
+
declare function categoryFromGuardTag(tag: string): string;
|
|
724
|
+
declare function detectReleaseSurfacesFromFiles(root: string, files: string[]): ReleaseSurface[];
|
|
725
|
+
declare function getStagedFiles(root: string): string[];
|
|
726
|
+
declare function runMemoryGuardCheck(options?: MemoryGuardCheckOptions): Promise<MemoryGuardCheckResult>;
|
|
727
|
+
|
|
655
728
|
type SyncDocumentKind = "DOC" | "BINARY";
|
|
656
729
|
type OnboardFolderMode = "auto" | "business_context" | "code_project" | "mixed";
|
|
657
730
|
type DetectedOnboardFolderMode = "business_context" | "code_project" | "mixed" | "unknown";
|
|
@@ -965,4 +1038,4 @@ declare function loadTeamSyncState(rootDir?: string): TeamSyncState;
|
|
|
965
1038
|
declare function saveTeamSyncState(state: TeamSyncState, rootDir?: string): void;
|
|
966
1039
|
declare function getTeamSyncStatePath(rootDir?: string): string;
|
|
967
1040
|
|
|
968
|
-
export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, TEAM_SYNC_STATE_RELATIVE_PATH, WORKFLOW_STATE_RELATIVE_PATH, buildAutomationInstallPlan, buildCanonicalEvent, buildOnboardFolderManifest, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildWorkflowPhaseCommitSummary, classifyToolResult, collectSyncDocuments, collectSyncDocumentsInput, createClient, createEmptyTeamSyncState, createLocalQueryCache, extractCommandFromToolInput, extractFilesFromToolInput, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getConfigPath, getPlanStepDisplayTitle, getStuckGuardInjection, getTeamSyncStatePath, installAutomationBundle, listProjectsForApiKey, loadAutomationManifest, loadConfig, loadTeamSyncState, normalizeWorkflowPlanInput, resolveQueryFromToolInput, saveConfig, saveTeamSyncState };
|
|
1041
|
+
export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, TEAM_SYNC_STATE_RELATIVE_PATH, WORKFLOW_STATE_RELATIVE_PATH, buildAutomationInstallPlan, buildCanonicalEvent, buildOnboardFolderManifest, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildWorkflowPhaseCommitSummary, categoryFromGuardTag, classifyToolResult, collectSyncDocuments, collectSyncDocumentsInput, createClient, createEmptyTeamSyncState, createLocalQueryCache, detectReleaseSurfacesFromFiles, extractCommandFromToolInput, extractFilesFromToolInput, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getConfigPath, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, installAutomationBundle, listProjectsForApiKey, loadAutomationManifest, loadConfig, loadTeamSyncState, normalizeGuardTag, normalizeWorkflowPlanInput, resolveQueryFromToolInput, runMemoryGuardCheck, saveConfig, saveTeamSyncState };
|