@eyeauras/insight-cli 0.2.4 → 0.3.1

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 (100) hide show
  1. package/.cli-package-build.json +1 -1
  2. package/SKILL.md +9 -1
  3. package/dist/src/analysis-storage.d.ts +165 -0
  4. package/dist/src/analysis-storage.js +562 -0
  5. package/dist/src/cli.js +33 -8
  6. package/dist/src/contexts.js +8 -8
  7. package/dist/src/ghidra-processes.js +5 -4
  8. package/dist/src/initial-model.js +28 -6
  9. package/dist/src/initial-progress.d.ts +4 -0
  10. package/dist/src/initial-progress.js +64 -0
  11. package/dist/src/native-inputs.js +4 -3
  12. package/dist/src/runtime-manager.js +6 -5
  13. package/dist/src/runtime-selection.d.ts +2 -2
  14. package/dist/src/runtime-selection.js +13 -6
  15. package/dist/src/saved-materials.js +2 -1
  16. package/dist/src/server.js +14 -0
  17. package/dist/src/tool-runtime/installer.js +7 -6
  18. package/dist/src/tool-runtime/launch-worker.js +3 -1
  19. package/package.json +2 -2
  20. package/references/artifacts.md +1 -1
  21. package/references/managed-runtime.md +1 -1
  22. package/references/native/InsightImportProgress.java +42 -0
  23. package/references/native/InsightInitialImport.java +8 -2
  24. package/references/native/InsightSdkFiles.java +13 -10
  25. package/references/setup.md +31 -0
  26. package/references/storage.md +99 -0
  27. package/runtime/toolbox.json +10 -4
  28. package/skill-bundle/insight-artifacts/SKILL.md +1 -1
  29. package/skill-bundle/insight-artifacts/references/artifacts.md +1 -1
  30. package/skill-bundle/insight-artifacts/references/recovery.md +79 -0
  31. package/skill-bundle/insight-artifacts/references/storage.md +99 -0
  32. package/skill-bundle/insight-binary/SKILL.md +1 -1
  33. package/skill-bundle/insight-capture/SKILL.md +1 -1
  34. package/skill-bundle/insight-cli/SKILL.md +9 -1
  35. package/skill-bundle/insight-cli/references/archive.md +32 -0
  36. package/skill-bundle/insight-cli/references/managed-runtime.md +162 -0
  37. package/skill-bundle/insight-cli/references/recovery.md +79 -0
  38. package/skill-bundle/insight-cli/references/setup.md +98 -0
  39. package/skill-bundle/insight-cli/references/storage.md +99 -0
  40. package/skill-bundle/insight-die/SKILL.md +1 -1
  41. package/skill-bundle/insight-dnspy/SKILL.md +1 -1
  42. package/skill-bundle/insight-dotnet-dump/SKILL.md +1 -1
  43. package/skill-bundle/insight-dotnet-stack/SKILL.md +1 -1
  44. package/skill-bundle/insight-dotnet-trace/SKILL.md +1 -1
  45. package/skill-bundle/insight-frida/SKILL.md +1 -1
  46. package/skill-bundle/insight-ghidra/SKILL.md +27 -1
  47. package/skill-bundle/insight-ghidra/references/artifacts.md +1 -1
  48. package/skill-bundle/insight-ghidra/references/managed-runtime.md +1 -1
  49. package/skill-bundle/insight-ghidra/references/setup.md +31 -0
  50. package/skill-bundle/insight-ghidra/references/storage.md +99 -0
  51. package/skill-bundle/insight-ilspy/SKILL.md +1 -1
  52. package/skill-bundle/insight-interop/SKILL.md +1 -1
  53. package/skill-bundle/insight-lldb/SKILL.md +1 -1
  54. package/skill-bundle/insight-llvm/SKILL.md +1 -1
  55. package/skill-bundle/insight-managed-heap/SKILL.md +1 -1
  56. package/skill-bundle/insight-managed-metadata/SKILL.md +1 -1
  57. package/skill-bundle/insight-mitmproxy/SKILL.md +1 -1
  58. package/skill-bundle/insight-overview/SKILL.md +1 -1
  59. package/skill-bundle/insight-procmon/SKILL.md +1 -1
  60. package/skill-bundle/insight-re/SKILL.md +6 -1
  61. package/skill-bundle/insight-re/references/artifacts.md +1 -1
  62. package/skill-bundle/insight-re/references/storage.md +99 -0
  63. package/skill-bundle/insight-sevenzip/SKILL.md +1 -1
  64. package/skill-bundle/insight-strace/SKILL.md +1 -1
  65. package/skill-bundle/insight-tshark/SKILL.md +1 -1
  66. package/skill-bundle/insight-windbg/SKILL.md +1 -1
  67. package/skill-bundle/manifest.json +1 -1
  68. package/skills/insight-artifacts/SKILL.md +1 -1
  69. package/skills/insight-artifacts/references/artifacts.md +1 -1
  70. package/skills/insight-artifacts/references/recovery.md +79 -0
  71. package/skills/insight-artifacts/references/storage.md +99 -0
  72. package/skills/insight-binary/SKILL.md +1 -1
  73. package/skills/insight-capture/SKILL.md +1 -1
  74. package/skills/insight-die/SKILL.md +1 -1
  75. package/skills/insight-dnspy/SKILL.md +1 -1
  76. package/skills/insight-dotnet-dump/SKILL.md +1 -1
  77. package/skills/insight-dotnet-stack/SKILL.md +1 -1
  78. package/skills/insight-dotnet-trace/SKILL.md +1 -1
  79. package/skills/insight-frida/SKILL.md +1 -1
  80. package/skills/insight-ghidra/SKILL.md +27 -1
  81. package/skills/insight-ghidra/references/artifacts.md +1 -1
  82. package/skills/insight-ghidra/references/managed-runtime.md +1 -1
  83. package/skills/insight-ghidra/references/setup.md +31 -0
  84. package/skills/insight-ghidra/references/storage.md +99 -0
  85. package/skills/insight-ilspy/SKILL.md +1 -1
  86. package/skills/insight-interop/SKILL.md +1 -1
  87. package/skills/insight-lldb/SKILL.md +1 -1
  88. package/skills/insight-llvm/SKILL.md +1 -1
  89. package/skills/insight-managed-heap/SKILL.md +1 -1
  90. package/skills/insight-managed-metadata/SKILL.md +1 -1
  91. package/skills/insight-mitmproxy/SKILL.md +1 -1
  92. package/skills/insight-overview/SKILL.md +1 -1
  93. package/skills/insight-procmon/SKILL.md +1 -1
  94. package/skills/insight-re/SKILL.md +6 -1
  95. package/skills/insight-re/references/artifacts.md +1 -1
  96. package/skills/insight-re/references/storage.md +99 -0
  97. package/skills/insight-sevenzip/SKILL.md +1 -1
  98. package/skills/insight-strace/SKILL.md +1 -1
  99. package/skills/insight-tshark/SKILL.md +1 -1
  100. package/skills/insight-windbg/SKILL.md +1 -1
@@ -0,0 +1,42 @@
1
+ import com.google.gson.*;
2
+ import ghidra.util.task.TaskMonitorAdapter;
3
+ import insight.InsightInitialJournal;
4
+ import java.nio.file.*;
5
+ import java.time.Instant;
6
+ import java.util.*;
7
+
8
+ /** A bounded observation channel, never a completion receipt or an overall percentage. */
9
+ class InsightImportProgress extends TaskMonitorAdapter implements AutoCloseable {
10
+ private final Path root;
11
+ private final String target,started=Instant.now().toString();
12
+ private final Timer heartbeat=new Timer("insight-import-progress",true);
13
+ private String phase="starting",state="running";
14
+ private String message="";
15
+ private long completed,total;
16
+ private boolean indeterminate=true;
17
+ private volatile Throwable writeFailure;
18
+ InsightImportProgress(Path root,String target)throws Exception{
19
+ super(true);this.root=root;this.target=target;emit();
20
+ heartbeat.scheduleAtFixedRate(new TimerTask(){public void run(){try{emit();}catch(Throwable failure){writeFailure=failure;}}},2000,2000);
21
+ }
22
+ synchronized void phase(String value)throws Exception{phase=value;setMessage("");initialize(0);setIndeterminate(true);emit();}
23
+ public synchronized void setMessage(String value){message=Objects.toString(value,"");}
24
+ public synchronized String getMessage(){return message;}
25
+ public synchronized void initialize(long maximum){completed=0;total=maximum;indeterminate=maximum<=0;}
26
+ public synchronized void setProgress(long value){completed=value;}
27
+ public synchronized void incrementProgress(long value){completed+=value;}
28
+ public synchronized long getProgress(){return completed;}
29
+ public synchronized void setMaximum(long value){total=value;}
30
+ public synchronized long getMaximum(){return total;}
31
+ public synchronized void setIndeterminate(boolean value){indeterminate=value;}
32
+ public synchronized boolean isIndeterminate(){return indeterminate;}
33
+ synchronized void state(String value)throws Exception{state=value;emit();}
34
+ private synchronized void emit()throws Exception{
35
+ JsonObject p=new JsonObject();p.addProperty("schema",1);p.addProperty("target",target);p.addProperty("phase",phase);p.addProperty("state",state);
36
+ p.addProperty("pid",ProcessHandle.current().pid());p.addProperty("startedAt",started);p.addProperty("updatedAt",Instant.now().toString());
37
+ p.addProperty("indeterminate",isIndeterminate());String message=Objects.toString(getMessage(),"");p.addProperty("message",message.substring(0,Math.min(message.length(),1024)));
38
+ if(!isIndeterminate()&&getMaximum()>0){p.addProperty("completed",getProgress());p.addProperty("total",getMaximum());}
39
+ InsightInitialJournal.write(root.resolve("progress.json"),p);
40
+ }
41
+ public synchronized void close()throws Exception{heartbeat.cancel();if(state.equals("running"))state=isCancelled()?"cancelled":"failed";emit();if(writeFailure!=null)throw new java.io.IOException("Progress persistence failed",writeFailure);}
42
+ }
@@ -23,6 +23,8 @@ class InsightInitialImport {
23
23
  JsonObject s=new JsonObject();s.addProperty("intentHash",InsightInitialJournal.hash(root.resolve("intent.json")));
24
24
  s.addProperty("phase","importing");s.addProperty("pid",ProcessHandle.current().pid());s.addProperty("snapshot","attempt-"+UUID.randomUUID()+".gzf");
25
25
  Path attempt=root.resolve(InsightInitialJournal.text(s,"snapshot")+".json");InsightInitialJournal.write(attempt,s);InsightInitialJournal.write(journal,s);
26
+ try(var progress=new InsightImportProgress(root,InsightInitialJournal.text(p,"target"))){
27
+ progress.phase("runtime-initialization");
26
28
  Application.initializeApplication(new GhidraApplicationLayout(),new HeadlessGhidraApplicationConfiguration());
27
29
  JsonObject settings=p.getAsJsonObject("settings"),request=new JsonObject();
28
30
  request.addProperty("input",input.toString());request.addProperty("output",root.resolve(InsightInitialJournal.text(s,"snapshot")).toString());
@@ -31,10 +33,14 @@ class InsightInitialImport {
31
33
  if(settings.has("compilerSpec"))request.add("compiler_spec",settings.get("compilerSpec"));
32
34
  if(settings.has("imageBase"))request.add("image_base",settings.get("imageBase"));
33
35
  if(settings.has("loaderOptions"))request.add("options",settings.get("loaderOptions"));
34
- JsonObject metadata=new Gson().toJsonTree(InsightSdkFiles.importProgram(request)).getAsJsonObject();
36
+ JsonObject metadata;
37
+ try{metadata=new Gson().toJsonTree(InsightSdkFiles.importProgram(request,progress)).getAsJsonObject();}
38
+ catch(Throwable failure){progress.state(progress.isCancelled()?"cancelled":"failed");throw failure;}
39
+ progress.phase("snapshot-verification");
35
40
  Path file=root.resolve(InsightInitialJournal.text(s,"snapshot"));InsightInitialJournal.sync(file);
36
41
  s.add("metadata",metadata);s.addProperty("snapshotSha256",InsightInitialJournal.hash(file));s.addProperty("phase","prepared");InsightInitialJournal.write(attempt,s);InsightInitialJournal.write(journal,s);
37
- InsightInitialJournal.prepared(root);out.println("{\"state\":\"prepared\"}");
42
+ InsightInitialJournal.prepared(root);progress.state("prepared");out.println("{\"state\":\"prepared\"}");
43
+ }
38
44
  }
39
45
  System.exit(0);
40
46
  }catch(Throwable failure){failure.printStackTrace(System.err);out.println("{\"state\":\"failed\"}");System.exit(1);}
@@ -54,14 +54,17 @@ class InsightSdkFiles {
54
54
  return Map.of("supported",rows,"all_loader_names",LoaderService.getAllLoaderNames());
55
55
  }
56
56
  }
57
- static Object importProgram(JsonObject p) throws Exception {
57
+ static void phase(TaskMonitor monitor,String phase)throws Exception{if(monitor instanceof InsightImportProgress progress)progress.phase(phase);}
58
+ static Object importProgram(JsonObject p) throws Exception {return importProgram(p,TaskMonitor.DUMMY);}
59
+ static Object importProgram(JsonObject p,TaskMonitor monitor) throws Exception {
60
+ phase(monitor,"import");
58
61
  String selected=text(p,"loader");Object consumer=new Object();Loader loader=null;
59
62
  if(selected.isEmpty()){
60
63
  Language language=text(p,"language").isEmpty()?null:DefaultLanguageService.getLanguageService().getLanguage(new LanguageID(text(p,"language")));
61
64
  CompilerSpec compiler=language==null?null:text(p,"compiler_spec").isEmpty()?language.getDefaultCompilerSpec():language.getCompilerSpecByID(new CompilerSpecID(text(p,"compiler_spec")));
62
- var loaded=language==null?AutoImporter.importByUsingBestGuess(Path.of(text(p,"input")).toFile(),null,"/",consumer,new MessageLog(),TaskMonitor.DUMMY):
63
- AutoImporter.importByLookingForLcs(Path.of(text(p,"input")).toFile(),null,"/",language,compiler,consumer,new MessageLog(),TaskMonitor.DUMMY);
64
- try{if(loaded==null||loaded.size()!=1)throw new IllegalArgumentException("Expected one imported program");return saveImport(loaded.getPrimaryDomainObject(),p,"automatic");}
65
+ var loaded=language==null?AutoImporter.importByUsingBestGuess(Path.of(text(p,"input")).toFile(),null,"/",consumer,new MessageLog(),monitor):
66
+ AutoImporter.importByLookingForLcs(Path.of(text(p,"input")).toFile(),null,"/",language,compiler,consumer,new MessageLog(),monitor);
67
+ try{if(loaded==null||loaded.size()!=1)throw new IllegalArgumentException("Expected one imported program");return saveImport(loaded.getPrimaryDomainObject(),p,"automatic",monitor);}
65
68
  finally{if(loaded!=null)loaded.release(consumer);}
66
69
  }
67
70
  for(Loader candidate:ClassSearcher.getInstances(Loader.class))if(candidate.getClass().getName().equals(selected)||candidate.getClass().getSimpleName().equals(selected)||candidate.getName().equals(selected)){
@@ -77,24 +80,24 @@ class InsightSdkFiles {
77
80
  Language effectiveLanguage=language;if(effectiveLanguage==null&&selectedSpec.getLanguageCompilerSpec()!=null)effectiveLanguage=DefaultLanguageService.getLanguageService().getLanguage(selectedSpec.getLanguageCompilerSpec().languageID);
78
81
  var options=configured(loader.getDefaultOptions(provider,selectedSpec,null,false,false),optionValues(p),effectiveLanguage==null?null:effectiveLanguage.getAddressFactory());
79
82
  String error=loader.validateOptions(provider,selectedSpec,options,null);if(error!=null)throw new IllegalArgumentException("Native loader rejected options: "+error);
80
- var settings=new Loader.ImporterSettings(provider,"OwnedInput",null,"/",false,selectedSpec,options,consumer,new MessageLog(),TaskMonitor.DUMMY);
83
+ var settings=new Loader.ImporterSettings(provider,"OwnedInput",null,"/",false,selectedSpec,options,consumer,new MessageLog(),monitor);
81
84
  var result=loader.load(settings);
82
85
  if(result==null)throw new IllegalStateException("Native loader did not return a program");
83
86
  try {
84
87
  if(result.size()!=1||!(result.getPrimaryDomainObject() instanceof Program))throw new IllegalArgumentException("Loader must produce one program per explicit target");
85
- return saveImport((Program)result.getPrimaryDomainObject(),p,loader.getClass().getName());
88
+ return saveImport((Program)result.getPrimaryDomainObject(),p,loader.getClass().getName(),monitor);
86
89
  } finally {result.release(consumer);}
87
90
  }
88
91
  }
89
- static Object saveImport(Program program,JsonObject p,String loader)throws Exception{
92
+ static Object saveImport(Program program,JsonObject p,String loader,TaskMonitor monitor)throws Exception{
90
93
  boolean analyze=p.has("auto_analyze")&&p.get("auto_analyze").getAsBoolean();
91
- if(analyze){ghidra.app.script.GhidraScriptUtil.acquireBundleHostReference();int tx=program.startTransaction("Initial analysis");boolean success=false;
92
- try{AutoAnalysisManager analysis=AutoAnalysisManager.getAnalysisManager(program);analysis.initializeOptions();analysis.reAnalyzeAll(null);analysis.startAnalysis(TaskMonitor.DUMMY);success=true;}
94
+ if(analyze){phase(monitor,"analysis");ghidra.app.script.GhidraScriptUtil.acquireBundleHostReference();int tx=program.startTransaction("Initial analysis");boolean success=false;
95
+ try{AutoAnalysisManager analysis=AutoAnalysisManager.getAnalysisManager(program);analysis.initializeOptions();analysis.reAnalyzeAll(null);analysis.startAnalysis(monitor);monitor.checkCancelled();success=true;}
93
96
  finally{program.endTransaction(tx,success);ghidra.app.script.GhidraScriptUtil.releaseBundleHostReference();}}
94
97
  if(p.has("image_base")){int tx=program.startTransaction("Initial image base");boolean success=false;
95
98
  try{program.setImageBase(program.getAddressFactory().getDefaultAddressSpace().getAddress(new BigInteger(text(p,"image_base"),16).longValue()),true);success=true;}
96
99
  finally{program.endTransaction(tx,success);}}
97
- program.saveToPackedFile(Path.of(text(p,"output")).toFile(),TaskMonitor.DUMMY);
100
+ phase(monitor,"save");program.saveToPackedFile(Path.of(text(p,"output")).toFile(),monitor);monitor.checkCancelled();
98
101
  return Map.of("state","imported","loader",loader,"language",program.getLanguageID().toString(),"base_address",program.getImageBase().toString(),
99
102
  "compiler",program.getCompilerSpec().getCompilerSpecID().toString(),"sha256",program.getExecutableSHA256(),"auto_analyzed",analyze);
100
103
  }
@@ -1,5 +1,9 @@
1
1
  # Setup
2
2
 
3
+ Inspect `storage show --json` and read [analysis storage](storage.md) before moving databases.
4
+ Use `storage configure` for an empty profile or `storage migrate` for existing work. Factory
5
+ control metadata and keyring identity stay in their original locations.
6
+
3
7
  Use Node 24+ and `ghidra install` to deliver Ghidra 12.1.2, JDK 21, native components and
4
8
  server support. See [managed runtime](managed-runtime.md) for download/install/offline archives,
5
9
  external executable paths, status/doctor and safe removal. Existing Factory profile `java` and
@@ -65,3 +69,30 @@ After an import timeout, wait for the original worker to end, raise its budget a
65
69
  the original scope. Incomplete private analysis restarts; a completed receipt is reused.
66
70
  A save timeout reports `phase: save`, the effective budget and `saveSeconds`. Inspect
67
71
  `sessions status`; a native log or broken response stream cannot prove a saved snapshot.
72
+
73
+ ## Initial import and progress
74
+
75
+ New targets import **without automatic analysis**. Reuse existing selectors/projects before
76
+ opening another copy; `ghidra open --session <session> --target <target>` preserves its bound
77
+ load settings, including older analysis choices. `--no-analysis` makes the fast choice explicit;
78
+ `--analysis` opts into a full analysis only during the first import of a new target.
79
+ After a fast import, use scoped `ghidra analysis run` to process pending analysis, or
80
+ `ghidra analysis reanalyze` to deliberately queue full reanalysis. These are saved private
81
+ mutations; merge deliberately. For a narrow question prefer bounded function disassembly,
82
+ function creation and decompilation first; inspect help for the exact operation.
83
+
84
+ For long first opens, `ghidra progress --session <session> --target <target> --json`
85
+ reads retained progress without starting Java or repeating the operation. It reports the
86
+ current stage, elapsed time, heartbeat age and native task message/counters when available;
87
+ those counters belong to the current task, not the whole import. Human output also reports
88
+ progress through Factory; `--json` keeps one final JSON result on stdout and stays quiet.
89
+ If the execution host yields, keep its same running execution and inspect progress every
90
+ 5-10 seconds when useful; relay stage changes or meaningful stalls, and do other independent
91
+ work. Do not silently extend waits to minutes or start a second import. Until selectors are
92
+ returned, use the existing `sessions list/status` and `tools processes` inventory to locate the
93
+ reserved scope. A stale heartbeat, dead worker or unknown result is not completion: inspect
94
+ `sessions status` and recovery before continuing. Pre-upgrade workers have no progress record;
95
+ null progress means unavailable, never success. Progress is observational, not a completion receipt. This command tracks first open only;
96
+ its old complete record does not describe later `analysis run`/`reanalyze` operations.
97
+ `operation: initial-model` completes after verified shared-model publication; the private
98
+ session context can still be opening. Inspect `sessions status` for context readiness.
@@ -0,0 +1,99 @@
1
+ # Analysis storage and migration
2
+
3
+ `storage show --json` reports effective profile storage, availability, active file/byte usage,
4
+ exact included trees and retained migration. The default is Factory profile AppData. No
5
+ checkout, environment or automatic disk fallback changes it. The non-secret setting is
6
+ `analysisDirectory` in Factory's profile (`profile show` also displays it). Use storage commands
7
+ to change it safely.
8
+
9
+ ```sh
10
+ insight-cli permissions grant Update
11
+ insight-cli storage show --json
12
+ insight-cli storage configure --directory "/mnt/analysis volume" --json
13
+ ```
14
+
15
+ `configure` requires no existing analysis entries. With existing data use `migrate`.
16
+ The directory is a **base**: the effective root appends `insight-cli/<profile>`, preserving
17
+ profile isolation. Choose an ordinary empty destination profile directory on a mounted local
18
+ filesystem. Spaces and Unicode are supported. Factory restricts the dedicated destination root to the
19
+ current user, including a Windows ACL; a filesystem that cannot apply this protection fails
20
+ before copying.
21
+
22
+ The complete `workspace`, `materials`, `temp` and `runtime` trees move: immutable inputs,
23
+ artifact/candidate snapshots, workspace SQLite DB/WAL, native private project/context DBs,
24
+ local Ghidra Server repositories, operation/publication/import journals, debugger traces,
25
+ process captures, exports, native helper compilation and verification working data.
26
+ **Runtime installations, acquisition caches, selections and process receipts move too**;
27
+ installation staging and activation must share a filesystem. External tool installations and
28
+ user-selected outputs outside these trees keep their locations.
29
+
30
+ Factory keeps profiles, permissions, IPC election/socket, migration-control metadata and
31
+ application logs in current-user AppData. Secrets stay in the OS keyring. Credential/profile
32
+ identities do not change. Updating/installing npm never migrates a profile automatically.
33
+
34
+ ## Move an existing profile
35
+
36
+ Finish changing commands, close native contexts, and stop this profile's owned server/tool
37
+ processes through ordinary CLI commands. Inspect `tools processes --json`. Unverified lifetimes
38
+ also block migration. Do not kill guessed PIDs or stop other profiles to make preflight pass.
39
+ Factory retains IPC ownership and command admission; other profiles can keep working.
40
+
41
+ ```sh
42
+ insight-cli storage migrate --directory "/mnt/analysis volume" --dry-run --json
43
+ insight-cli storage migrate --directory "/mnt/analysis volume" --json
44
+ insight-cli storage show --json
45
+ ```
46
+
47
+ Dry-run checks separation, destination contents, access, conservative capacity and quiescence
48
+ without reserving/copying a migration. Source/destination/configuration roots cannot be equal
49
+ or nested. Destination symlink roots, escaping source links, special files, unresolved links
50
+ and inventories above one million entries or 128 directory levels are rejected. Internal
51
+ links retain their exact target strings. Preflight does not reserve space; concurrent disk use
52
+ can still cause a copy failure.
53
+
54
+ Migration durably reserves its journal, hashes stable source bytes, streams/syncs the copy,
55
+ independently hashes destination bytes and rechecks the source. Only then does it replace source
56
+ trees with permanent compatibility links and commit the Factory setting. Original trees are
57
+ renamed into `.storage-retained/<migration>` on their original volume. Copy/activation never
58
+ deletes them, including on failures. Existing IDs, requests, journals, candidate snapshots and
59
+ receipts retain exact bytes. Compatibility paths preserve old absolute references: do not remove
60
+ those links or their profile/source ancestors manually after migrating.
61
+
62
+ ## Interruptions, uncertainty and retention
63
+
64
+ ```sh
65
+ insight-cli storage resume --json
66
+ insight-cli storage rollback --json
67
+ ```
68
+
69
+ Ordinary research freezes during incomplete copy/activation/rollback/cleanup. `show` and Factory
70
+ profile inspection remain available. Resume verifies completed files, recopies an incomplete
71
+ file, rechecks capacity and finishes the retained transaction. Source and destination filesystem
72
+ anchor identities are bound durably. Missing/replaced volumes fail without creating a system-disk
73
+ fallback; mount the original volume before resuming.
74
+
75
+ Rollback restores retained source and the prior Factory setting. After activation it requires
76
+ an unchanged destination and a verified retained source. Native reopening or later findings can
77
+ make rollback unsafe, in which case it refuses and preserves both copies. Use forward migration
78
+ to another empty base after using the new location. A rolled-back destination remains for manual
79
+ inspection/removal and is never automatically adopted. Cleanup permanently disables rollback.
80
+
81
+ Unknown script/publication effects do **not** need abandonment before migrating a stopped
82
+ profile. Migration starts no worker, replays no script/check-in and marks no unknown outcome
83
+ applied. Inspect the original request after migrating; existing [recovery](recovery.md)
84
+ restrictions and independent readback requirements still apply.
85
+
86
+ After independent native reopen and saved-file readback, free retained source explicitly:
87
+
88
+ ```sh
89
+ insight-cli permissions grant Destructive
90
+ insight-cli storage cleanup --json
91
+ ```
92
+
93
+ Cleanup verifies retained bytes, records irreversible intent, then deletes only that owned
94
+ backup. Interrupted cleanup continues through `storage resume`; rollback is already disabled.
95
+ Compatibility links, receipts and manifests remain. Clean or roll back the current migration
96
+ before starting another. This release provides no nonempty-destination adoption, reverse
97
+ synchronization, live-DB snapshotting or network-filesystem guarantees. POSIX directory fsync
98
+ is used. Windows has file fsync and rename/junction semantics; Node cannot fsync directories
99
+ there, and internal symlinks can require OS privileges.
@@ -6,7 +6,9 @@
6
6
  "title": "insight-cli",
7
7
  "path": "SKILL.md",
8
8
  "resources": {
9
- "references/agent-execution.md": "references/agent-execution.md"
9
+ "references/agent-execution.md": "references/agent-execution.md",
10
+ "references/storage.md": "references/storage.md",
11
+ "references/recovery.md": "references/recovery.md"
10
12
  }
11
13
  },
12
14
  {
@@ -16,7 +18,8 @@
16
18
  "resources": {
17
19
  "references/recovery.md": "references/recovery.md",
18
20
  "references/artifacts.md": "references/artifacts.md",
19
- "references/agent-execution.md": "references/agent-execution.md"
21
+ "references/agent-execution.md": "references/agent-execution.md",
22
+ "references/storage.md": "references/storage.md"
20
23
  }
21
24
  },
22
25
  {
@@ -35,7 +38,8 @@
35
38
  "references/archive.md": "references/archive.md",
36
39
  "references/extensions-and-sync.md": "references/extensions-and-sync.md",
37
40
  "references/artifacts.md": "references/artifacts.md",
38
- "references/agent-execution.md": "references/agent-execution.md"
41
+ "references/agent-execution.md": "references/agent-execution.md",
42
+ "references/storage.md": "references/storage.md"
39
43
  }
40
44
  },
41
45
  {
@@ -53,7 +57,9 @@
53
57
  "path": "skills/insight-artifacts/SKILL.md",
54
58
  "resources": {
55
59
  "references/artifacts.md": "references/artifacts.md",
56
- "references/agent-execution.md": "references/agent-execution.md"
60
+ "references/agent-execution.md": "references/agent-execution.md",
61
+ "references/storage.md": "references/storage.md",
62
+ "references/recovery.md": "references/recovery.md"
57
63
  }
58
64
  },
59
65
  {
@@ -3,7 +3,7 @@ name: insight-artifacts
3
3
  description: Retain a completed reverse-engineering evidence file or directory as an ordinary checkpoint using insight-cli artifacts save. Use after Ghidra or any external tool; preserve existing project formats and source of truth.
4
4
  ---
5
5
 
6
- # Insight Artifacts 0.2.4
6
+ # Insight Artifacts 0.3.1
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -1,7 +1,7 @@
1
1
  # Save ordinary research materials
2
2
 
3
3
  `insight-cli artifacts save <path> --json` saves a file or a settled directory tree in
4
- the selected profile's AppData. It needs Factory Update permission and does not require
4
+ the selected profile's [analysis storage](storage.md), which defaults to AppData. It needs Factory Update permission and does not require
5
5
  Ghidra, Java, authentication, target/session selectors or evidence metadata. Relative input
6
6
  paths resolve against the caller's working directory. Use `--help` for generated syntax.
7
7
 
@@ -0,0 +1,79 @@
1
+ # Continue saved work
2
+
3
+ Retain the session/target returned by initial open. Continue the tuple through
4
+ `insight-cli ghidra open --session <id> --target <id> --json`. Saved private snapshots and
5
+ pending scalar comparisons persist independently of a backend process. Reopening preserves
6
+ private work; it does not silently receive a newer shared version.
7
+
8
+ First-import recovery uses the same scoped `ghidra open` or the original request ID/input.
9
+ Import/analysis writes a private snapshot and completion receipt before any initial publication.
10
+ If its worker is still running, continuation reports busy; wait and continue the same scope.
11
+ If that worker stopped before completing its receipt, continuation can repeat private analysis
12
+ from the immutable input while retaining previous attempts. A completed snapshot is reused.
13
+ Initial publication first creates a uniquely named staging object. A separate read-only process
14
+ verifies its complete saved DB buffers before a conditional server move to the absent canonical
15
+ path. It never checks in a new version of an existing canonical item. Lost promotion replies
16
+ are reconciled against the retained identity, one-version history and complete saved buffers.
17
+ Interrupted staging objects remain retained and can be replaced by another private stage;
18
+ they are not adopted as the canonical model. Foreign or mismatched canonical state stays blocked.
19
+ An older direct create that is provably owned and left only an incomplete `<Recovered>` entry
20
+ can be moved aside without deletion; its bytes and original receipt remain preserved.
21
+
22
+ Legacy first-import failures are also recoverable in the original profile. Continuation first
23
+ establishes that the old owned bootstrap worker has ended, then uses an authoritative repository
24
+ probe. An absent canonical item permits private preparation; an existing first version requires
25
+ independent readback. The old project, intent and original session/target remain preserved.
26
+
27
+ If a response was lost, inspect `sessions status <session> --target <target>`. Never infer
28
+ `applied` from a connection failure. A changing command's optional request ID binds one effective
29
+ intent inside the profile. Repeating the same ID/input retrieves its recorded outcome or
30
+ unresolved state; changing input under that ID fails. Without an ID, calls are new intentions.
31
+
32
+ An unknown or partial effect retains its request intent, snapshots and native stage. Open the
33
+ same tuple to reconcile supported outcomes. A committed merge is verified against its recorded
34
+ server version and complete saved buffers through independent read authority; it is never
35
+ checked in again merely because its response was lost. Until verification succeeds, publication
36
+ for this shared target is blocked across sessions. Saved private work remains retained.
37
+
38
+ Scalar reconciliation observes and saves an already present effect; it does not execute the
39
+ setter again. Supported structural/function edits retain a candidate snapshot after an incomplete
40
+ response; continuation can verify every requested effect in that immutable snapshot and adopt it
41
+ without replay. If the complete result cannot be established, the candidate and previous saved
42
+ private view remain retained. An unproved program/script/external outcome remains unresolved. Preserve the profile
43
+ storage and credential store. Do not delete another session's project, stop a process by guessed
44
+ PID/port, or blindly repeat a script/external action to turn uncertainty into success.
45
+
46
+ The older prototype's `workers`, `findings`, `integrate` and batch `recover` commands are not the
47
+ public facade API. Its coordinator journals remain separate and are never silently migrated.
48
+
49
+ A lost UI navigation response can be verified from the live authenticated cursor without another
50
+ goto. If its original owned GUI process has exited, continuation reports the uncertain UI action
51
+ as disconnected and retains saved program work. It does not recreate the old cursor or re-enable
52
+ a previous prompt policy. Other unproved live UI effects remain retained until their outcome is
53
+ established or the original process is known to have ended.
54
+
55
+ ## Abandon an uncertain private program attempt
56
+
57
+ A post-mutation save timeout does not repeat the script or issue another save in the
58
+ error handler. Status exposes the original request identity and retained phase/budget.
59
+ Arbitrary script effects are never inferred from metadata or from an unverified DB.
60
+ After inspecting the retained attempt, explicitly stop only its verified owned worker
61
+ (`tools processes`, then `tools processes kill <process>` if required). Resume the
62
+ last acknowledged private snapshot with:
63
+
64
+ ```sh
65
+ insight-cli permissions grant Destructive
66
+ insight-cli ghidra abandon --session <session> --target <target> \
67
+ --request-id <original-request> --acknowledge-unknown-effects --json
68
+ insight-cli ghidra open --session <session> --target <target> --json
69
+ ```
70
+
71
+ Abandon requires exactly one unresolved private program operation, an unchanged verified
72
+ previous snapshot/generation, a stopped original worker and no active publication or live
73
+ debugger. It retains the native project, candidate artifacts, original intent/execution and
74
+ previous diagnostic result. Its terminal request is `failed` / `state: abandoned` with
75
+ `outcome: unknown`; no effect is marked applied. Repeating abandonment retrieves the same
76
+ result. Earlier saved private edits remain pending. The original changing request ID cannot
77
+ execute again. Abandoning never undoes external effects or establishes what an arbitrary
78
+ script did; the acknowledgement explicitly accepts that uncertainty. Publication recovery,
79
+ initial import, UI and debugger attempts use their own protocols and cannot use this command.
@@ -0,0 +1,99 @@
1
+ # Analysis storage and migration
2
+
3
+ `storage show --json` reports effective profile storage, availability, active file/byte usage,
4
+ exact included trees and retained migration. The default is Factory profile AppData. No
5
+ checkout, environment or automatic disk fallback changes it. The non-secret setting is
6
+ `analysisDirectory` in Factory's profile (`profile show` also displays it). Use storage commands
7
+ to change it safely.
8
+
9
+ ```sh
10
+ insight-cli permissions grant Update
11
+ insight-cli storage show --json
12
+ insight-cli storage configure --directory "/mnt/analysis volume" --json
13
+ ```
14
+
15
+ `configure` requires no existing analysis entries. With existing data use `migrate`.
16
+ The directory is a **base**: the effective root appends `insight-cli/<profile>`, preserving
17
+ profile isolation. Choose an ordinary empty destination profile directory on a mounted local
18
+ filesystem. Spaces and Unicode are supported. Factory restricts the dedicated destination root to the
19
+ current user, including a Windows ACL; a filesystem that cannot apply this protection fails
20
+ before copying.
21
+
22
+ The complete `workspace`, `materials`, `temp` and `runtime` trees move: immutable inputs,
23
+ artifact/candidate snapshots, workspace SQLite DB/WAL, native private project/context DBs,
24
+ local Ghidra Server repositories, operation/publication/import journals, debugger traces,
25
+ process captures, exports, native helper compilation and verification working data.
26
+ **Runtime installations, acquisition caches, selections and process receipts move too**;
27
+ installation staging and activation must share a filesystem. External tool installations and
28
+ user-selected outputs outside these trees keep their locations.
29
+
30
+ Factory keeps profiles, permissions, IPC election/socket, migration-control metadata and
31
+ application logs in current-user AppData. Secrets stay in the OS keyring. Credential/profile
32
+ identities do not change. Updating/installing npm never migrates a profile automatically.
33
+
34
+ ## Move an existing profile
35
+
36
+ Finish changing commands, close native contexts, and stop this profile's owned server/tool
37
+ processes through ordinary CLI commands. Inspect `tools processes --json`. Unverified lifetimes
38
+ also block migration. Do not kill guessed PIDs or stop other profiles to make preflight pass.
39
+ Factory retains IPC ownership and command admission; other profiles can keep working.
40
+
41
+ ```sh
42
+ insight-cli storage migrate --directory "/mnt/analysis volume" --dry-run --json
43
+ insight-cli storage migrate --directory "/mnt/analysis volume" --json
44
+ insight-cli storage show --json
45
+ ```
46
+
47
+ Dry-run checks separation, destination contents, access, conservative capacity and quiescence
48
+ without reserving/copying a migration. Source/destination/configuration roots cannot be equal
49
+ or nested. Destination symlink roots, escaping source links, special files, unresolved links
50
+ and inventories above one million entries or 128 directory levels are rejected. Internal
51
+ links retain their exact target strings. Preflight does not reserve space; concurrent disk use
52
+ can still cause a copy failure.
53
+
54
+ Migration durably reserves its journal, hashes stable source bytes, streams/syncs the copy,
55
+ independently hashes destination bytes and rechecks the source. Only then does it replace source
56
+ trees with permanent compatibility links and commit the Factory setting. Original trees are
57
+ renamed into `.storage-retained/<migration>` on their original volume. Copy/activation never
58
+ deletes them, including on failures. Existing IDs, requests, journals, candidate snapshots and
59
+ receipts retain exact bytes. Compatibility paths preserve old absolute references: do not remove
60
+ those links or their profile/source ancestors manually after migrating.
61
+
62
+ ## Interruptions, uncertainty and retention
63
+
64
+ ```sh
65
+ insight-cli storage resume --json
66
+ insight-cli storage rollback --json
67
+ ```
68
+
69
+ Ordinary research freezes during incomplete copy/activation/rollback/cleanup. `show` and Factory
70
+ profile inspection remain available. Resume verifies completed files, recopies an incomplete
71
+ file, rechecks capacity and finishes the retained transaction. Source and destination filesystem
72
+ anchor identities are bound durably. Missing/replaced volumes fail without creating a system-disk
73
+ fallback; mount the original volume before resuming.
74
+
75
+ Rollback restores retained source and the prior Factory setting. After activation it requires
76
+ an unchanged destination and a verified retained source. Native reopening or later findings can
77
+ make rollback unsafe, in which case it refuses and preserves both copies. Use forward migration
78
+ to another empty base after using the new location. A rolled-back destination remains for manual
79
+ inspection/removal and is never automatically adopted. Cleanup permanently disables rollback.
80
+
81
+ Unknown script/publication effects do **not** need abandonment before migrating a stopped
82
+ profile. Migration starts no worker, replays no script/check-in and marks no unknown outcome
83
+ applied. Inspect the original request after migrating; existing [recovery](recovery.md)
84
+ restrictions and independent readback requirements still apply.
85
+
86
+ After independent native reopen and saved-file readback, free retained source explicitly:
87
+
88
+ ```sh
89
+ insight-cli permissions grant Destructive
90
+ insight-cli storage cleanup --json
91
+ ```
92
+
93
+ Cleanup verifies retained bytes, records irreversible intent, then deletes only that owned
94
+ backup. Interrupted cleanup continues through `storage resume`; rollback is already disabled.
95
+ Compatibility links, receipts and manifests remain. Clean or roll back the current migration
96
+ before starting another. This release provides no nonempty-destination adoption, reverse
97
+ synchronization, live-DB snapshotting or network-filesystem guarantees. POSIX directory fsync
98
+ is used. Windows has file fsync and rename/junction semantics; Node cannot fsync directories
99
+ there, and internal symlinks can require OS privileges.
@@ -3,7 +3,7 @@ name: insight-binary
3
3
  description: Query structured PE, ELF and thin Mach-O headers, sections, imports and exports, or make an explicitly guarded new PE subsystem copy through insight-cli binary. Use for scoped binary structure, linkage and copy-only header edits without target execution.
4
4
  ---
5
5
 
6
- # Insight Binary 0.2.4
6
+ # Insight Binary 0.3.1
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-capture
3
3
  description: Capture one explicitly authorized native program run, exact stdout/stderr and declared file snapshots through insight-cli capture, then inspect or compare retained reports without replay. Use for controlled input/output research, preserving original files and interrupted or unknown outcomes.
4
4
  ---
5
5
 
6
- # Insight Capture 0.2.4
6
+ # Insight Capture 0.3.1
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-cli
3
3
  description: Choose and prepare reverse-engineering capabilities from the insight-cli toolbox for binary, managed-code and runtime investigations. Use to discover the appropriate tool or its packaged skill before installing native runtimes.
4
4
  ---
5
5
 
6
- # insight-cli 0.2.4
6
+ # insight-cli 0.3.1
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -36,6 +36,14 @@ multi-agent guidance; `skill insight-ghidra`, `skill insight-ilspy` and
36
36
  installing npm binaries does not register them in an agent host. See
37
37
  [agent connection](references/agent-setup.md) for current setup and access requirements.
38
38
 
39
+ Inspect `storage show --json` before relocating a profile. Use the supported
40
+ [storage workflow](references/storage.md), preserving unknown operations and native folders.
41
+
42
+
43
+ New targets import without full auto-analysis; `--analysis` opts in at first import.
44
+ Reuse existing session/target selectors before opening another copy. Read [setup](references/setup.md)
45
+ for explicit later analysis and passive first-open progress (`ghidra progress`).
46
+
39
47
  Use generated help as the syntax authority. Catalog metadata describes shipped capabilities;
40
48
  profile runtime readiness comes from the selected tool's `status`. Unavailable profile/IPC
41
49
  access means execution readiness is unknown. Preserve work and diagnose access before trying
@@ -0,0 +1,32 @@
1
+ # Exchange private documentation with an archive
2
+
3
+ Archive exchange is disabled until the selected Factory profile has an explicit `archiveUrl`.
4
+ Use HTTPS for a remote service; local HTTP is supported for local services. URLs cannot contain
5
+ credentials, query parameters or fragments. An optional bearer token is stored with
6
+ `auth login --role archive --password-stdin`; it is a Factory secret and is never passed to
7
+ Ghidra or the debuggee. `auth logout` clears this token as well as external server credentials.
8
+
9
+ Use `ghidra archive ingest-function --address <entry>` or `ingest-program`, with the usual
10
+ `--session` and `--target`. Both export the selected private view. `--version-label` supplies
11
+ the archive version; its default is `unknown`. Internal project directories are not used as
12
+ version labels. Bulk selection skips default function names unless `--include-default-named`
13
+ is set; `--limit` bounds visited functions. Zero selects all, subject to the documented bound.
14
+ `--dry-run` validates payloads and returns would-be counts without a network request.
15
+
16
+ The service contract is `POST <archiveUrl>/v1/doc_archive/upsert` with JSON and an optional
17
+ `Authorization: Bearer ...` header. The payload matches the pinned GhidraMCP builder: binary
18
+ name, explicit version, function address, run/tool identity, name/prototype, calling convention,
19
+ flags, matching hash/shape metadata, tags, named locals and instruction comments when present.
20
+ The binary name is the logical target name. Each successful JSON response must contain a
21
+ boolean `created` and a nonnegative integer `conflicts_enqueued`. Redirects are refused.
22
+
23
+ Results retain created, updated, conflict, skipped and error counts. Archive conflict counts
24
+ describe the external service's decisions; they do not resolve program merge conflicts.
25
+ Use an optional stable `--request-id` when a response might be lost. A repeated ID returns
26
+ the saved successful result or the retained uncertain outcome, without sending again.
27
+ Each outbound payload identity and the source snapshot are retained before dispatch. Unknown
28
+ external outcomes stay observable and do not block unrelated private research. A new request ID
29
+ expresses another explicit submission; the facade does not assume the service can deduplicate it.
30
+
31
+ Archive requests do not publish the program or alter another session. Developing or deploying
32
+ the external archive service is outside this package; acceptance uses an owned contract fixture.