Skip to content

An agent-managed museum exhibit, built in Rust with Gajae-Code / LazyCodex — developed and maintained with no human intervention.

Rust

chore: additional AI slop cleanup and enforcer wiring from sessions 1/5

Jobdori8cc7d4c64121
diff --git a/rust/crates/api/src/client.rs b/rust/crates/api/src/client.rs
index 1147a845..8dae1d23 100644
--- a/rust/crates/api/src/client.rs
+++ b/rust/crates/api/src/client.rs
@@ -2,23 +2,9 @@ use crate::error::ApiError;
use crate::prompt_cache::{PromptCache, PromptCacheRecord, PromptCacheStats};
use crate::providers::anthropic::{self, AnthropicClient, AuthSource};
use crate::providers::openai_compat::{self, OpenAiCompatClient, OpenAiCompatConfig};
-use crate::providers::{self, Provider, ProviderKind};
+use crate::providers::{self, ProviderKind};
use crate::types::{MessageRequest, MessageResponse, StreamEvent};
-async fn send_via_provider<P: Provider>(
- provider: &P,
- request: &MessageRequest,
-) -> Result<MessageResponse, ApiError> {
- provider.send_message(request).await
-}
-
-async fn stream_via_provider<P: Provider>(
- provider: &P,
- request: &MessageRequest,
-) -> Result<P::Stream, ApiError> {
- provider.stream_message(request).await
-}
-
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone)]
pub enum ProviderClient {
@@ -89,8 +75,8 @@ impl ProviderClient {
request: &MessageRequest,
) -> Result<MessageResponse, ApiError> {
match self {
- Self::Anthropic(client) => send_via_provider(client, request).await,
- Self::Xai(client) | Self::OpenAi(client) => send_via_provider(client, request).await,
+ Self::Anthropic(client) => client.send_message(request).await,
+ Self::Xai(client) | Self::OpenAi(client) => client.send_message(request).await,
}
}
@@ -99,10 +85,12 @@ impl ProviderClient {
request: &MessageRequest,
) -> Result<MessageStream, ApiError> {
match self {
- Self::Anthropic(client) => stream_via_provider(client, request)
+ Self::Anthropic(client) => client
+ .stream_message(request)
.await
.map(MessageStream::Anthropic),
- Self::Xai(client) | Self::OpenAi(client) => stream_via_provider(client, request)
+ Self::Xai(client) | Self::OpenAi(client) => client
+ .stream_message(request)
.await
.map(MessageStream::OpenAiCompat),
}
diff --git a/rust/crates/commands/src/lib.rs b/rust/crates/commands/src/lib.rs
index ac7bab91..7f12a3f7 100644
--- a/rust/crates/commands/src/lib.rs
+++ b/rust/crates/commands/src/lib.rs
@@ -3285,22 +3285,6 @@ mod tests {
handle_slash_command("/debug-tool-call", &session, CompactionConfig::default())
.is_none()
);
- assert!(
- handle_slash_command("/bughunter", &session, CompactionConfig::default()).is_none()
- );
- assert!(handle_slash_command("/commit", &session, CompactionConfig::default()).is_none());
- assert!(handle_slash_command("/pr", &session, CompactionConfig::default()).is_none());
- assert!(handle_slash_command("/issue", &session, CompactionConfig::default()).is_none());
- assert!(
- handle_slash_command("/ultraplan", &session, CompactionConfig::default()).is_none()
- );
- assert!(
- handle_slash_command("/teleport foo", &session, CompactionConfig::default()).is_none()
- );
- assert!(
- handle_slash_command("/debug-tool-call", &session, CompactionConfig::default())
- .is_none()
- );
assert!(
handle_slash_command("/model claude", &session, CompactionConfig::default()).is_none()
);
diff --git a/rust/crates/runtime/src/lsp_client.rs b/rust/crates/runtime/src/lsp_client.rs
index 9ce0703d..92c0ed1a 100644
--- a/rust/crates/runtime/src/lsp_client.rs
+++ b/rust/crates/runtime/src/lsp_client.rs
@@ -1,8 +1,4 @@
//! LSP (Language Server Protocol) client registry for tool dispatch.
-//!
-//! Provides a stateful registry of LSP server connections, supporting
-//! the LSP tool actions: diagnostics, hover, definition, references,
-//! completion, symbols, and formatting.
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
diff --git a/rust/crates/runtime/src/mcp_tool_bridge.rs b/rust/crates/runtime/src/mcp_tool_bridge.rs
index 926819aa..f15a1025 100644
--- a/rust/crates/runtime/src/mcp_tool_bridge.rs
+++ b/rust/crates/runtime/src/mcp_tool_bridge.rs
@@ -62,7 +62,6 @@ pub struct McpServerState {
pub error_message: Option<String>,
}
-/// Thread-safe registry of MCP server connections for tool dispatch.
#[derive(Debug, Clone, Default)]
pub struct McpToolRegistry {
inner: Arc<Mutex<HashMap<String, McpServerState>>>,
@@ -82,7 +81,6 @@ impl McpToolRegistry {
self.manager.set(manager)
}
- /// Register or update an MCP server connection.
pub fn register_server(
&self,
server_name: &str,
@@ -105,19 +103,16 @@ impl McpToolRegistry {
);
}
- /// Get current state of an MCP server.
pub fn get_server(&self, server_name: &str) -> Option<McpServerState> {
let inner = self.inner.lock().expect("mcp registry lock poisoned");
inner.get(server_name).cloned()
}
- /// List all registered MCP servers.
pub fn list_servers(&self) -> Vec<McpServerState> {
let inner = self.inner.lock().expect("mcp registry lock poisoned");
inner.values().cloned().collect()
}
- /// List resources from a specific server.
pub fn list_resources(&self, server_name: &str) -> Result<Vec<McpResourceInfo>, String> {
let inner = self.inner.lock().expect("mcp registry lock poisoned");
match inner.get(server_name) {
@@ -134,7 +129,6 @@ impl McpToolRegistry {
}
}
- /// Read a specific resource from a server.
pub fn read_resource(&self, server_name: &str, uri: &str) -> Result<McpResourceInfo, String> {
let inner = self.inner.lock().expect("mcp registry lock poisoned");
let state = inner
@@ -156,7 +150,6 @@ impl McpToolRegistry {
.ok_or_else(|| format!("resource '{}' not found on server '{}'", uri, server_name))
}
- /// List tools exposed by a specific server.
pub fn list_tools(&self, server_name: &str) -> Result<Vec<McpToolInfo>, String> {
let inner = self.inner.lock().expect("mcp registry lock poisoned");
match inner.get(server_name) {
diff --git a/rust/crates/runtime/src/permission_enforcer.rs b/rust/crates/runtime/src/permission_enforcer.rs
index 90a6580f..03c63ab1 100644
--- a/rust/crates/runtime/src/permission_enforcer.rs
+++ b/rust/crates/runtime/src/permission_enforcer.rs
@@ -1,9 +1,5 @@
//! Permission enforcement layer that gates tool execution based on the
//! active `PermissionPolicy`.
-//!
-//! This module provides `PermissionEnforcer` which wraps tool dispatch
-//! and validates that the active permission mode allows the requested tool
-//! before executing it.
use crate::permissions::{PermissionMode, PermissionOutcome, PermissionPolicy};
use serde::{Deserialize, Serialize};
@@ -34,7 +30,7 @@ impl PermissionEnforcer {
}
/// Check whether a tool can be executed under the current permission policy.
- /// Uses the policy's `authorize` method with no prompter (auto-deny on prompt-required).
+ /// Auto-denies when prompting is required but no prompter is provided.
pub fn check(&self, tool_name: &str, input: &str) -> EnforcementResult {
let outcome = self.policy.authorize(tool_name, input, None);
diff --git a/rust/crates/runtime/src/task_registry.rs b/rust/crates/runtime/src/task_registry.rs
index 84745c3e..69f088c1 100644
--- a/rust/crates/runtime/src/task_registry.rs
+++ b/rust/crates/runtime/src/task_registry.rs
@@ -1,8 +1,4 @@
//! In-memory task registry for sub-agent task lifecycle management.
-//!
-//! Provides create, get, list, stop, update, and output operations
-//! matching the upstream TaskCreate/TaskGet/TaskList/TaskStop/TaskUpdate/TaskOutput
-//! tool surface.
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
@@ -10,7 +6,6 @@ use std::time::{SystemTime, UNIX_EPOCH};
use serde::{Deserialize, Serialize};
-/// Current status of a managed task.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum TaskStatus {
@@ -33,7 +28,6 @@ impl std::fmt::Display for TaskStatus {
}
}
-/// A single managed task entry.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Task {
pub task_id: String,
@@ -47,7 +41,6 @@ pub struct Task {
pub team_id: Option<String>,
}
-/// A message exchanged with a running task.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TaskMessage {
pub role: String,
@@ -55,7 +48,6 @@ pub struct TaskMessage {
pub timestamp: u64,
}
-/// Thread-safe task registry.
#[derive(Debug, Clone, Default)]
pub struct TaskRegistry {
inner: Arc<Mutex<RegistryInner>>,
@@ -75,13 +67,11 @@ fn now_secs() -> u64 {
}
impl TaskRegistry {
- /// Create a new empty registry.
#[must_use]
pub fn new() -> Self {
Self::default()
}
- /// Create a new task and return its ID.
pub fn create(&self, prompt: &str, description: Option<&str>) -> Task {
let mut inner = self.inner.lock().expect("registry lock poisoned");
inner.counter += 1;
@@ -102,13 +92,11 @@ impl TaskRegistry {
task
}
- /// Look up a task by ID.
pub fn get(&self, task_id: &str) -> Option<Task> {
let inner = self.inner.lock().expect("registry lock poisoned");
inner.tasks.get(task_id).cloned()
}
- /// List all tasks, optionally filtered by status.
pub fn list(&self, status_filter: Option<TaskStatus>) -> Vec<Task> {
let inner = self.inner.lock().expect("registry lock poisoned");
inner
@@ -119,7 +107,6 @@ impl TaskRegistry {
.collect()
}
- /// Mark a task as stopped.
pub fn stop(&self, task_id: &str) -> Result<Task, String> {
let mut inner = self.inner.lock().expect("registry lock poisoned");
let task = inner
@@ -142,7 +129,6 @@ impl TaskRegistry {
Ok(task.clone())
}
- /// Send a message to a task, updating its state.
pub fn update(&self, task_id: &str, message: &str) -> Result<Task, String> {
let mut inner = self.inner.lock().expect("registry lock poisoned");
let task = inner
@@ -159,7 +145,6 @@ impl TaskRegistry {
Ok(task.clone())
}
- /// Get the accumulated output of a task.
pub fn output(&self, task_id: &str) -> Result<String, String> {
let inner = self.inner.lock().expect("registry lock poisoned");
let task = inner
@@ -169,7 +154,6 @@ impl TaskRegistry {
Ok(task.output.clone())
}
- /// Append output to a task (used by the task executor).
pub fn append_output(&self, task_id: &str, output: &str) -> Result<(), String> {
let mut inner = self.inner.lock().expect("registry lock poisoned");
let task = inner
@@ -181,7 +165,6 @@ impl TaskRegistry {
Ok(())
}
- /// Transition a task to a new status.
pub fn set_status(&self, task_id: &str, status: TaskStatus) -> Result<(), String> {
let mut inner = self.inner.lock().expect("registry lock poisoned");
let task = inner
@@ -193,7 +176,6 @@ impl TaskRegistry {
Ok(())
}
- /// Assign a task to a team.
pub fn assign_team(&self, task_id: &str, team_id: &str) -> Result<(), String> {
let mut inner = self.inner.lock().expect("registry lock poisoned");
let task = inner
@@ -205,20 +187,17 @@ impl TaskRegistry {
Ok(())
}
- /// Remove a task from the registry.
pub fn remove(&self, task_id: &str) -> Option<Task> {
let mut inner = self.inner.lock().expect("registry lock poisoned");
inner.tasks.remove(task_id)
}
- /// Number of tasks in the registry.
#[must_use]
pub fn len(&self) -> usize {
let inner = self.inner.lock().expect("registry lock poisoned");
inner.tasks.len()
}
- /// Whether the registry has no tasks.
#[must_use]
pub fn is_empty(&self) -> bool {
self.len() == 0
diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs
index bab18cc9..5844e6b1 100644
--- a/rust/crates/rusty-claude-cli/src/main.rs
+++ b/rust/crates/rusty-claude-cli/src/main.rs
@@ -40,9 +40,8 @@ use plugins::{PluginHooks, PluginManager, PluginManagerConfig, PluginRegistry};
use render::{MarkdownStreamState, Spinner, TerminalRenderer};
use runtime::{
clear_oauth_credentials, generate_pkce_pair, generate_state, load_system_prompt,
- parse_oauth_callback_request_target,
- permission_enforcer::PermissionEnforcer,
- resolve_sandbox_status, save_oauth_credentials, ApiClient, ApiRequest, AssistantEvent,
+ parse_oauth_callback_request_target, resolve_sandbox_status, save_oauth_credentials,
+ ApiClient, ApiRequest, AssistantEvent,
CompactionConfig, ConfigLoader, ConfigSource, ContentBlock, ConversationMessage,
ConversationRuntime, MessageRole, OAuthAuthorizationRequest, OAuthConfig,
OAuthTokenExchangeRequest, PermissionMode, PermissionPolicy, ProjectContext, PromptCacheEvent,
@@ -3986,8 +3985,6 @@ fn build_runtime_with_plugin_state(
plugin_registry.initialize()?;
let policy = permission_policy(permission_mode, &feature_config, &tool_registry)
.map_err(std::io::Error::other)?;
- let mut tool_registry = tool_registry;
- tool_registry.set_enforcer(PermissionEnforcer::new(policy.clone()));
let mut runtime = ConversationRuntime::new_with_features(
session,
AnthropicRuntimeClient::new(
diff --git a/rust/crates/tools/src/lib.rs b/rust/crates/tools/src/lib.rs
index 9b02ad3a..4db65df0 100644
--- a/rust/crates/tools/src/lib.rs
+++ b/rust/crates/tools/src/lib.rs
@@ -242,11 +242,8 @@ impl GlobalToolRegistry {
}
pub fn execute(&self, name: &str, input: &Value) -> Result<String, String> {
- if let Some(enforcer) = &self.enforcer {
- enforce_permission_check(enforcer, name, input)?;
- }
if mvp_tool_specs().iter().any(|spec| spec.name == name) {
- return execute_tool(name, input);
+ return execute_tool_with_enforcer(self.enforcer.as_ref(), name, input);
}
self.plugin_tools
.iter()
@@ -904,13 +901,39 @@ pub fn enforce_permission_check(
}
pub fn execute_tool(name: &str, input: &Value) -> Result<String, String> {
+ execute_tool_with_enforcer(None, name, input)
+}
+
+fn execute_tool_with_enforcer(
+ enforcer: Option<&PermissionEnforcer>,
+ name: &str,
+ input: &Value,
+) -> Result<String, String> {
match name {
- "bash" => from_value::<BashCommandInput>(input).and_then(run_bash),
- "read_file" => from_value::<ReadFileInput>(input).and_then(run_read_file),
- "write_file" => from_value::<WriteFileInput>(input).and_then(run_write_file),
- "edit_file" => from_value::<EditFileInput>(input).and_then(run_edit_file),
- "glob_search" => from_value::<GlobSearchInputValue>(input).and_then(run_glob_search),
- "grep_search" => from_value::<GrepSearchInput>(input).and_then(run_grep_search),
+ "bash" => {
+ maybe_enforce_permission_check(enforcer, name, input)?;
+ from_value::<BashCommandInput>(input).and_then(run_bash)
+ }
+ "read_file" => {
+ maybe_enforce_permission_check(enforcer, name, input)?;
+ from_value::<ReadFileInput>(input).and_then(run_read_file)
+ }
+ "write_file" => {
+ maybe_enforce_permission_check(enforcer, name, input)?;
+ from_value::<WriteFileInput>(input).and_then(run_write_file)
+ }
+ "edit_file" => {
+ maybe_enforce_permission_check(enforcer, name, input)?;
+ from_value::<EditFileInput>(input).and_then(run_edit_file)
+ }
+ "glob_search" => {
+ maybe_enforce_permission_check(enforcer, name, input)?;
+ from_value::<GlobSearchInputValue>(input).and_then(run_glob_search)
+ }
+ "grep_search" => {
+ maybe_enforce_permission_check(enforcer, name, input)?;
+ from_value::<GrepSearchInput>(input).and_then(run_grep_search)
+ }
"WebFetch" => from_value::<WebFetchInput>(input).and_then(run_web_fetch),
"WebSearch" => from_value::<WebSearchInput>(input).and_then(run_web_search),
"TodoWrite" => from_value::<TodoWriteInput>(input).and_then(run_todo_write),
@@ -957,6 +980,17 @@ pub fn execute_tool(name: &str, input: &Value) -> Result<String, String> {
}
}
+fn maybe_enforce_permission_check(
+ enforcer: Option<&PermissionEnforcer>,
+ tool_name: &str,
+ input: &Value,
+) -> Result<(), String> {
+ if let Some(enforcer) = enforcer {
+ enforce_permission_check(enforcer, tool_name, input)?;
+ }
+ Ok(())
+}
+
#[allow(clippy::needless_pass_by_value)]
fn run_ask_user_question(input: AskUserQuestionInput) -> Result<String, String> {
let mut result = json!({
@@ -2816,11 +2850,7 @@ impl ToolExecutor for SubagentToolExecutor {
}
let value = serde_json::from_str(input)
.map_err(|error| ToolError::new(format!("invalid tool input JSON: {error}")))?;
- if let Some(enforcer) = &self.enforcer {
- enforce_permission_check(enforcer, tool_name, &value)
- .map_err(ToolError::new)?;
- }
- execute_tool(tool_name, &value).map_err(ToolError::new)
+ execute_tool_with_enforcer(self.enforcer.as_ref(), tool_name, &value).map_err(ToolError::new)
}
}
@@ -5868,6 +5898,9 @@ printf 'pwsh:%s' "$1"
#[test]
fn given_no_enforcer_when_bash_then_executes_normally() {
+ let _guard = env_lock()
+ .lock()
+ .unwrap_or_else(std::sync::PoisonError::into_inner);
let registry = super::GlobalToolRegistry::builtin();
let result = registry
.execute("bash", &json!({ "command": "printf 'ok'" }))
diff --git a/src/_archive_helper.py b/src/_archive_helper.py
new file mode 100644
index 00000000..8a4a271d
--- /dev/null
+++ b/src/_archive_helper.py
@@ -0,0 +1,17 @@
+"""Shared helper for archive placeholder packages."""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+
+
+def load_archive_metadata(package_name: str) -> dict:
+ """Load archive metadata from reference_data/subsystems/{package_name}.json."""
+ snapshot_path = (
+ Path(__file__).resolve().parent
+ / "reference_data"
+ / "subsystems"
+ / f"{package_name}.json"
+ )
+ return json.loads(snapshot_path.read_text())
diff --git a/src/assistant/__init__.py b/src/assistant/__init__.py
index a41389e0..f5606fea 100644
--- a/src/assistant/__init__.py
+++ b/src/assistant/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'assistant.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("assistant")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/bootstrap/__init__.py b/src/bootstrap/__init__.py
index 133345eb..e710d131 100644
--- a/src/bootstrap/__init__.py
+++ b/src/bootstrap/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'bootstrap.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("bootstrap")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/bridge/__init__.py b/src/bridge/__init__.py
index 43f54f0c..e14d93a4 100644
--- a/src/bridge/__init__.py
+++ b/src/bridge/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'bridge.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("bridge")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/buddy/__init__.py b/src/buddy/__init__.py
index 88ce77d1..ffbccf0e 100644
--- a/src/buddy/__init__.py
+++ b/src/buddy/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'buddy.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("buddy")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/cli/__init__.py b/src/cli/__init__.py
index 9142899e..bf419d73 100644
--- a/src/cli/__init__.py
+++ b/src/cli/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'cli.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("cli")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/components/__init__.py b/src/components/__init__.py
index 68bd81d3..ec533091 100644
--- a/src/components/__init__.py
+++ b/src/components/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'components.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("components")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/constants/__init__.py b/src/constants/__init__.py
index 4d1f46d7..943ea964 100644
--- a/src/constants/__init__.py
+++ b/src/constants/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'constants.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("constants")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/coordinator/__init__.py b/src/coordinator/__init__.py
index 65a77d32..32c2c3d8 100644
--- a/src/coordinator/__init__.py
+++ b/src/coordinator/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'coordinator.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("coordinator")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/entrypoints/__init__.py b/src/entrypoints/__init__.py
index 3b0a5900..9afea8f6 100644
--- a/src/entrypoints/__init__.py
+++ b/src/entrypoints/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'entrypoints.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("entrypoints")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/hooks/__init__.py b/src/hooks/__init__.py
index 4379bbd9..08a43b00 100644
--- a/src/hooks/__init__.py
+++ b/src/hooks/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'hooks.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("hooks")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/keybindings/__init__.py b/src/keybindings/__init__.py
index 6d26f3c5..44b4dbe4 100644
--- a/src/keybindings/__init__.py
+++ b/src/keybindings/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'keybindings.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("keybindings")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/memdir/__init__.py b/src/memdir/__init__.py
index f8f2e8ad..5a764593 100644
--- a/src/memdir/__init__.py
+++ b/src/memdir/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'memdir.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("memdir")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/migrations/__init__.py b/src/migrations/__init__.py
index 54f3005c..46b08014 100644
--- a/src/migrations/__init__.py
+++ b/src/migrations/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'migrations.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("migrations")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/moreright/__init__.py b/src/moreright/__init__.py
index 79f34ad3..b5668fc6 100644
--- a/src/moreright/__init__.py
+++ b/src/moreright/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'moreright.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("moreright")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/native_ts/__init__.py b/src/native_ts/__init__.py
index e3d22f5a..b2941b82 100644
--- a/src/native_ts/__init__.py
+++ b/src/native_ts/__init__.py
@@ -1,16 +1,14 @@
-"""Python package placeholder for the archived `native-ts` subsystem."""
+"""Python package placeholder for the archived `native_ts` subsystem."""
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'native_ts.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("native_ts")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/outputStyles/__init__.py b/src/outputStyles/__init__.py
index 563f7016..22e429e0 100644
--- a/src/outputStyles/__init__.py
+++ b/src/outputStyles/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'outputStyles.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("outputStyles")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/plugins/__init__.py b/src/plugins/__init__.py
index 83b22933..a61600f8 100644
--- a/src/plugins/__init__.py
+++ b/src/plugins/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'plugins.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("plugins")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/remote/__init__.py b/src/remote/__init__.py
index ae9ac1ee..9abbd6da 100644
--- a/src/remote/__init__.py
+++ b/src/remote/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'remote.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("remote")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/schemas/__init__.py b/src/schemas/__init__.py
index 16b84b01..bdff2b54 100644
--- a/src/schemas/__init__.py
+++ b/src/schemas/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'schemas.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("schemas")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/screens/__init__.py b/src/screens/__init__.py
index 2b1ef0d6..88d10fb8 100644
--- a/src/screens/__init__.py
+++ b/src/screens/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'screens.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("screens")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/server/__init__.py b/src/server/__init__.py
index b391d1d3..44607cb0 100644
--- a/src/server/__init__.py
+++ b/src/server/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'server.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("server")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/services/__init__.py b/src/services/__init__.py
index a7efae18..714ef472 100644
--- a/src/services/__init__.py
+++ b/src/services/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'services.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("services")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/skills/__init__.py b/src/skills/__init__.py
index 1dc4c96a..4d9c7a64 100644
--- a/src/skills/__init__.py
+++ b/src/skills/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'skills.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("skills")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/state/__init__.py b/src/state/__init__.py
index d1bde5ad..23cb1344 100644
--- a/src/state/__init__.py
+++ b/src/state/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'state.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("state")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/types/__init__.py b/src/types/__init__.py
index 55375d23..d9afb3b7 100644
--- a/src/types/__init__.py
+++ b/src/types/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'types.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("types")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/upstreamproxy/__init__.py b/src/upstreamproxy/__init__.py
index d4c36751..bf8ea6d8 100644
--- a/src/upstreamproxy/__init__.py
+++ b/src/upstreamproxy/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'upstreamproxy.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("upstreamproxy")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/utils/__init__.py b/src/utils/__init__.py
index 5774ef51..fc3f766c 100644
--- a/src/utils/__init__.py
+++ b/src/utils/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'utils.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("utils")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/vim/__init__.py b/src/vim/__init__.py
index fed972f3..c272c8d3 100644
--- a/src/vim/__init__.py
+++ b/src/vim/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'vim.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("vim")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]
diff --git a/src/voice/__init__.py b/src/voice/__init__.py
index ef3c9290..a50e5c16 100644
--- a/src/voice/__init__.py
+++ b/src/voice/__init__.py
@@ -2,15 +2,13 @@
from __future__ import annotations
-import json
-from pathlib import Path
+from src._archive_helper import load_archive_metadata
-SNAPSHOT_PATH = Path(__file__).resolve().parent.parent / 'reference_data' / 'subsystems' / 'voice.json'
-_SNAPSHOT = json.loads(SNAPSHOT_PATH.read_text())
+_SNAPSHOT = load_archive_metadata("voice")
-ARCHIVE_NAME = _SNAPSHOT['archive_name']
-MODULE_COUNT = _SNAPSHOT['module_count']
-SAMPLE_FILES = tuple(_SNAPSHOT['sample_files'])
+ARCHIVE_NAME = _SNAPSHOT["archive_name"]
+MODULE_COUNT = _SNAPSHOT["module_count"]
+SAMPLE_FILES = tuple(_SNAPSHOT["sample_files"])
PORTING_NOTE = f"Python placeholder package for '{ARCHIVE_NAME}' with {MODULE_COUNT} archived module references."
-__all__ = ['ARCHIVE_NAME', 'MODULE_COUNT', 'PORTING_NOTE', 'SAMPLE_FILES']
+__all__ = ["ARCHIVE_NAME", "MODULE_COUNT", "PORTING_NOTE", "SAMPLE_FILES"]