Skip to content

chore(repo): remove unused code - #3007

Merged
nicoloboschi merged 7 commits into
vectorize-io:mainfrom
Sanderhoff-alt:agent/remove-unused-code
Jul 29, 2026
Merged

chore(repo): remove unused code#3007
nicoloboschi merged 7 commits into
vectorize-io:mainfrom
Sanderhoff-alt:agent/remove-unused-code

Conversation

@Sanderhoff-alt

@Sanderhoff-alt Sanderhoff-alt commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Remove confirmed dead code across the API, CLI, control plane, developer tooling, embed package, and integrations.

Candidates were checked against package exports, framework registration, CLI dispatch, extension hooks, generated clients, documentation, and repository-wide references. Test-only symbols were removed only when their tests covered a production path that has already been superseded.

Zero-reference cleanup

Area Removed symbols or state
API bootstrap color_mid; start_embedded_postgres; stop_embedded_postgres; orphaned get_embedded_postgres; IdleTimeoutMiddleware.start_idle_checker; check_daemon_running
Retain and consolidation map_facts_to_chunks; _create_memory_links; BudgetedOperation.acquire_many; RetainBatch.get_facts_for_content; RetainBatch.get_chunks_for_content; ProcessedFact.is_duplicate; ExtractedFact.build_fact_text; Oracle _limit_to_rownum callback
Entity and reflect format_entity_summaries_for_prompt; EntityResolver.get_units_by_entity; EntityResolver.get_entity_by_text; build_delta_prompt; build_agent_prompt
Memory and search MemoryEngine._acquire_connection; SearchTracer.add_neighbor_link; SearchTrace.get_search_path_to_node; SearchTrace.get_nodes_by_link_type; SearchTrace.get_entry_point_nodes
Migrations check_migration_status
CLI App.toggle_auto_refresh; Config.from_env; Config.save_api_url; utils.get_client; utils.get_output_format; empty utils.rs module
Control plane ControlPlaneClient.regenerateEntityObservations; setBankMission; updateBankProfile; getObservation; unreachable directive-detail state and panel
Developer tooling BenchmarkRunner._agent_has_data; camel_to_snake; update_sidebars
Embed get_daemon_port
Integration state Unused get_turn_count implementations in Claude Code, Codex, Cursor, Cursor CLI, and Zcode
Other integrations Aider find_workdir; LiteLLM _check_pending_storage_errors; HindsightCallback._messages_to_query; Cursor HindsightClient.health_check; Cursor stop_daemon; Devin Desktop default_mcp_path

Superseded test-only paths

These implementations and their dedicated old-path tests are removed together.

# Removed implementation Reason
1 generate_embedding Production retain uses batch embedding
2 build_batch_consolidation_prompt Production consolidation uses the current prompt path
3 compute_temporal_query_bounds Retired temporal-link helper
4 compute_temporal_links Retired temporal-link helper
5 engine.utils.extract_facts Production uses retain/fact_extraction.py; empty module removed
6 Claude Code HindsightClient.health_check Internal client method has no production caller
7 Codex HindsightClient.health_check Internal client method has no production caller
8 Cursor CLI HindsightClient.health_check Internal client method has no production caller
9 Zcode HindsightClient.health_check Internal client method has no production caller
10 OpenClaw countUserTurns Export was consumed only by old tests
11 OpenClaw getRetentionTurnIndex Export was consumed only by old tests
12 OpenClaw defaultApiKeyEnvVar Export was consumed only by old tests
13 Rust OutputFormat::from_str Production uses Clap parsing

Impact

No public API, generated SDK surface, registered route, CLI command, extension hook, or documented integration contract is intentionally removed. This reduces maintenance surface without replacing current production paths.

Commit structure

Commit Scope
chore(api): remove unused code API and engine cleanup
chore(cli): remove unused code Rust CLI cleanup
chore(control-plane): remove unused code Control plane cleanup
chore(dev): remove unused code Developer tooling cleanup
chore(embed): remove unused code Embed cleanup
chore(integrations): remove unused code Integration cleanup

Validation

Check Result
Repository pre-commit hooks and lint Passed for every split commit
Python syntax and targeted Ruff checks Passed
Targeted API tests 65 passed; 158 affected tests collected
Rust CLI cargo check --all-targets; 66 binary tests passed
Rust output tests 7 passed
Claude Code 39 passed
Codex 1 passed
Cursor CLI 4 passed
Zcode 4 passed
OpenClaw setup library 39 passed

The unused-code hook still reports existing unused variables outside this change. Its Knip probe is advisory and cannot load the Astro plugin because the temporary npx environment lacks typescript; the repository lint hook itself completes successfully.

Remove confirmed unreferenced helpers from the API and engine.

Delete tests only where they cover superseded internal paths. Keep
active test helpers and public memory operations unchanged.
Remove dead CLI configuration, client, and output helpers.

Drop the parser implementation and tests used only by the retired
output path.
Remove unused ControlPlaneClient methods and unreachable directive
detail state from the think view.
Remove unreferenced benchmark and repository maintenance helpers.
Remove the unused daemon port lookup helper while preserving current
profile-based daemon discovery.
Remove unreferenced helpers across supported integrations.

Drop tests only for retired internal paths and retain active test and
lifecycle infrastructure.
@Sanderhoff-alt
Sanderhoff-alt force-pushed the agent/remove-unused-code branch from 9cd4fdb to ed2c8db Compare July 28, 2026 06:46
@Sanderhoff-alt
Sanderhoff-alt marked this pull request as ready for review July 28, 2026 06:53
The dead-code cleanup removed build_batch_consolidation_prompt and its tests,
but those tests guarded behaviors that are still live in the current
build_consolidation_system_prompt / build_consolidation_input path:

- brace-safety of a mission / capacity note containing literal { } (a lone
  brace would raise KeyError in the internal str.format() and crash
  consolidation)
- output-language directive injection into the cached system prompt
- the built-in default mission when none is supplied

Re-add these as regression tests against the current builders instead of
dropping the coverage. Also fix a stale comment referencing the removed
utils.extract_facts module.
@nicoloboschi
nicoloboschi merged commit feac397 into vectorize-io:main Jul 29, 2026
88 of 89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants