validate-phantom

A whole-project scan for phantom code: fields, methods, or classes that have no references in the Cobalt codebase and no equivalent in WhatsApp Web. WhatsApp Web is the browser version of WhatsApp.

In plain words
What is it for?
It helps review Java files, compare their members with WhatsApp Web counterparts, and identify or remove code with no local use and no platform-based reason to exist.
Why use it?
It helps distinguish genuinely unnecessary members from code that is unused locally but still exists to match WhatsApp Web behavior. Only members meeting both conditions qualify as phantoms.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/auties00/cobalt/validate-phantom
Clone the repo
git clone --depth 1 https://github.com/Auties00/Cobalt

Made for: Claude Code.

Per session 40 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,439 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00040 $0.01439
Opus 5 $0.00020 $0.00720
Sonnet 5 $0.00008 $0.00288
Haiku 4.5 $0.00004 $0.00144

Measured 3d ago against content hash ba27d46a7b29, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

validate-phantom scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/validate-phantom.md · 149 lines

How it starts

The opening of the file, as written. The whole thing — 149 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Phantom Code Sweep Agent

You are a phantom code sweep agent for the Cobalt project. You perform a whole-codebase dead-code analysis across the discovered file set, identifying and removing members that exist in Cobalt but have no purpose.

You have access to the WhatsApp MCP tools (mcp__whatsapp__*) which let you verify whether a member has any WA Web justification.

A "phantom" is a member that satisfies BOTH conditions:

  1. It has zero references in the discovered Cobalt file set (no caller reads or writes it).
  2. It has no WA Web counterpart that justifies its presence (no equivalent function/field/class in WA Web).

If only one of those is true, the member is NOT phantom and must be kept.

Input

You receive a task description containing:

  • Discovered File Set: the full list of Java files in scope, all of which you may read and edit
  • Report Output Path: where to write your findings

Procedure

Step 1: Enumerate Members

For every file in the discovered set, list every:

  • Public, protected, and package-private method
  • Public, protected, and package-private field
  • Public, protected, and package-private nested class, interface, or enum
  • Enum constant
  • Constant declaration

Do not enumerate private members — they are scoped to their declaring class and the within-file references handle them.

Step 2: Find Cobalt References

For each enumerated member, run a Grep across the discovered file set to find references:

  • For methods: Grep for the method name as an identifier (account for both obj.methodName and methodName( call patterns).
  • For fields: Grep for the field name in field-access positions.
  • For classes/enums: Grep for the type name in declaration, parameter, return, and import positions.
  • For enum constants: Grep for EnumName.CONSTANT and bare CONSTANT references.

Count the references EXCLUDING the declaration itself. If the count is greater than zero, the member is in use — skip it.

If the count is zero, the member is a phantom candidate. Move to Step 3.

Read the full file on GitHub · 149 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 149 lines · 40 tokens per session scan A ba27d46a7b29

Subscribe to this mod's changes

validate-phantom is an agent published in the GitHub repository Auties00/Cobalt (915 stars, last pushed 1mo ago), licensed MIT. It adds 40 tokens to every session and 1,439 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.