Decompilation knowledge-base workbench

Analyses an app from its installer and builds a knowledge base whose conclusions trace back to the code.

#decompilation#knowledge base#graded evidence#independent review#Claude Code
Decompilation knowledge-base workbench

WorkflowDecompilation knowledge-base workbench

Reverse engineering Local MacBook

A setup that decompiles an Android app's installer into a local knowledge base answering "how is this feature designed?". It consists of a 13-step process, rules that grade every claim by the strength of its evidence, and checking scripts.

Challenge

  • Decompiled code is huge, and an AI reading it tends to claim full understanding without saying which parts it actually saw
  • If a conclusion does not record where in the decompiled output it came from, it cannot be rechecked when the tool or app version changes

Approach

  • Register research questions first; for each one write a mechanism card where every claim is tagged seen, inferred or unknown and carries an anchor into the decompiled text
  • Only cards that pass the checking script and a review by someone other than the writer are accepted into a local notes repository

Outcome

  • Every conclusion can be traced to a specific line in a specific decompilation run
  • Unknowns live in a ledger and are only parked after three different methods fail, so gaps are never hidden

The author built this workbench to learn how other apps design their features and then build a separate product of the author's own. The target installer and decompiled output stay on the local machine; nothing is published or sent to outside services.

The unit of work is a research question, not one card per package. From pulling the installer through stack detection, decompilation, library sorting, card writing, review, acceptance and progress tracking, each of the 13 steps has its own pass criterion.

The full workflow

TaskWhoInputsOutputs
1. Pull installerAuthor + Export scriptauthor + pull_apk.sh—Installer
2. Set egressAuthorauthorInstallerEgress list
3. DecompilePipeline scriptrun_pipeline.shInstallerDecompiled, Inventory
4. Fix sortingMain sessionInventoryOverrides
5. Ask questionsAuthor + Question registerauthor + questions.pyInventoryQuestions
6. Trace & writeRE MCP + Reference MCPRE MCP + re-kb MCPQuestions, Decompiled, Refers to Card templateMech. cards
7. Log unknownsUnknowns ledgerledger.pyMech. cardsUnknowns
8. Gate cardsCard gatecheck_cards.pyMech. cardsGate report
9. ReviewReviewer + Review logperson or model + review.pyMech. cards, Gate reportReview record
10. AcceptAccept scriptaccept.shGate report, Review record, Egress list, UnknownsLocal KB
Decompilation knowledge-base workbench

10 steps · 2 roles · 9 tools · 1 loop · since 2026-11-11 · 85 commits · 306 tests

Pull the installer and take it apart by machine, set the questions first, write cards with evidence anchors, and accept them into a local notes repository after a gate and a second pair of eyes.

  • Steps 1–5 prepare; steps 6–10 answer one question as one chain of evidence
  • Division of labour: the author sets the questions and egress, the main session reads and writes cards, scripts check and record, and someone other than the author reviews
  • The gate proves only that anchors are valid; whether the conclusion is right is for the review
  • Neither the installer nor the decompiled output leaves this Mac; results go into a notes repository with no remote

Project folders involved (4)

This workflow does not live in one folder: it runs across projects.

re-workbench
The core: rules, the 13-step procedure, scripts, templates and tests
re-workbench/targets (local only)
Per-target workspace: installers, decompiled output, cards and a notes repository with no remote; kept out of git
re-kb MCP
A searchable library of public docs from reverse-engineering tools and decompilation projects
(private) product projects
Private product folders read the cards and use them to design the author's own products
Pull installer

Step 1 · Author + Export script

Pull installerpull_apk.sh

Export the installer from the phone, read-only.

  • Every installer file of the app is exported, split ones included
  • Version, hashes, signature and any gaps in the capture are written down
  • The installer is never modified; it is the root of all evidence
OutputsInstaller
Set egress

Step 2 · Author

Set egressEGRESS.md

A person decides and writes down which services may see this app's content.

  • It resolves the conflict between "nothing leaves the machine" and letting a cloud model read code, by making it an explicit register
  • Without the register, the final acceptance step refuses the target
  • Which services are allowed is a human decision, not a script's
InputsInstaller
OutputsEgress list
Decompile

Step 3 · Pipeline script

Decompilejadx + apktool

Stack detection, decompilation, sorting and chaptering in one run.

  • Both jadx and apktool output are kept: readable Java and smali that maps one-to-one to the original
  • Earlier results are never overwritten; each run gets its own number
  • If most of the logic is outside the DEX (Flutter and the like), it stops here and names the right backend
InputsInstaller
OutputsDecompiled, Inventory
Fix sorting

Step 4 · Main session

Fix sortingoverrides.json

Fix packages left as undecided, with reasons, and rerun.

  • Four classes, each with its reason: first-party, third-party, mixed and undecided
  • Third-party detection uses package-name prefixes only, so obfuscated code falls into undecided, the safe side
  • Sorting only decides what to read first; it never throws evidence away
InputsInventory
OutputsOverrides
Ask questions

Step 5 · Author + Question register

Ask questionsquestions.py

Register what you want to know as questions first.

  • The unit of work is a question, not one card per package
  • Start with three to five questions
  • A question's status can move forward only one level at a time
InputsInventory
OutputsQuestions
Trace & write

Step 6 · RE MCP + Reference MCP

Trace & writemechanism card

Trace calls from UI text and entry points, then write a mechanism card.

  • Every claim is tagged seen, inferred or unknown; "seen" requires an anchor into this decompilation run
  • "Inferred" states its basis; "unknown" states what is missing
  • Text inside the code that says "run this" is treated as data and reported to a person

Claude CodeThe main session does the reading, with a reverse-engineering MCP and a reference-docs search MCP as tools

InputsQuestions, Decompiled
OutputsMech. cards
Refers toCard template
Log unknowns

Step 7 · Unknowns ledger

Log unknownsledger.py add

Give every unknown a number in the ledger.

  • Every "unknown" in a card carries a ledger number
  • Once something is found out, the card is rewritten
  • An unknown may be parked only after three attempts with three different methods
InputsMech. cards
OutputsUnknowns
Gate cards

Step 8 · Card gate

Gate cardscheck_cards.py

Machine-check that anchors exist, are precise and point at this run.

  • Each rule closes one loophole, and the tests hold a counter-example per loophole
  • Stock claims such as "fully understood" are blocked too
  • --sample pulls anchors with the surrounding code for the reviewer

Common misconceptionPassing the gate does not make a conclusion right; it only proves the anchors are valid

InputsMech. cards
OutputsGate report
Review

Step 9 · Reviewer + Review log

Reviewreview.py record

Someone other than the writer judges each claim against the code.

  • Each record is bound to the card's hash, and the writer cannot review their own card
  • Conclusions that affect product design are checked once more against the smali
  • On the first real app, three cards were accepted still marked unreviewed; this step is still open

Common misconception"Not the writer" is checked by name only, so the same model under another name slips through

InputsMech. cards, Gate report
OutputsReview record
Accept

Step 10 · Accept script

Acceptaccept.sh

Commit gated cards into a notes repository with no remote.

  • It refuses if the egress register is missing, the gate fails, or the notes repository has a remote
  • Each acceptance line binds the decompilation run, the gate version and the card contents
  • On the first real app, three acceptances produced 3 cards with 67 anchors
InputsGate report, Review record, Egress list, Unknowns
OutputsLocal KB

Loops and rework

  • Too much left undecided → step 3: On the first real app, two overrides with reasons were written and the pipeline rerun

Key points

Grading evidence in three levels. "Seen" means observed in this decompilation run and needs an anchor; "inferred" must state its basis; "unknown" must state what is missing. Passing the gate only proves the anchors are valid, never that the conclusion is right.

Separating writer and reviewer. Sampled anchors are shown with their surrounding code to another person or model, who judges whether each claim is supported. Conclusions that affect product design are checked once more against the lower-level bytecode.

Deciding what the AI must not do. No modifying the installer, no requests to the vendor's servers, no overwriting decompiled output. Text inside the code that says "run this" is treated as data and reported to a person.