Skip to content

Tradecraft Lookup

Samuele Giampieri edited this page Nov 19, 2026 · 14 revisions

📖 Canonical version: read this page on the official docs site — https://www.redamon.org/docs/tradecraft-lookup. The GitHub wiki is a mirror.

Tradecraft Lookup

Interactive walkthrough: How Tradecraft works

Tradecraft gives the agent your own library of trusted offensive-security knowledge: HackTricks, PayloadsAllTheThings, CVE PoC archives, tool documentation, vendor research blogs, PDFs. You add the sites; RedAmon ingests each one in the background; during an engagement the agent searches the library and reads exactly the section it needs, mid attack chain.

Three things make it different from the agent's other reference tools:

  • You curate the sources. The agent reads only the sites in your library, and only those turned on for the project. There is no open-web crawl at run time.
  • The library describes itself. Each resource has a summary written from its own pages, and the agent's prompt carries your resource list and a map of what the library covers, so the agent knows when the library can help and when to use web_search instead.
  • Searching and reading call no model. Only the librarian does, when the agent asks and you allowed it. The library still adds to every step's prompt: your resource list, the coverage map and Library now.

You build the library in Global Settings → Tradecraft, per account: every button, form field, dialog and setting of that tab is in Tradecraft Library. This page covers what the agent does with it. For the implementation, see README.TRADECRAFT.md.


When the agent uses it

The tradecraft tools are offered in the phases the project's Tool Matrix gives tradecraft_lookup, all three phases by default (they read only your library and its sites, never the target); tradecraft_search and tradecraft_ask follow the same row. A project whose resources are all off, or an account with none, gets no tradecraft tool and no Tradecraft text in the agent's prompt. At each step, Library now shows the agent the pages that fit what it is about to do, when some fit; its prompt tells it how to choose:

The need What the agent does
Clearly outside what your resources cover Doesn't call them; uses web_search
A page Library now shows, or an earlier result, fits the step tradecraft_lookup(page="patt:412")
A technique, CVE or product it can name tradecraft_search, then tradecraft_lookup on the best page
It cannot tell what fits, or search finds only related pages ("the WAF blocks SLEEP") tradecraft_ask, the librarian (when you allow it)

Typical calls:

User question What the agent does
"Escalate from a low-privilege domain user to Domain Admin." Searches kerberoast, reads the Kerberoasting section of the HackTricks page the search returned
"Find a public PoC for CVE-2021-41773." Searches the CVE id (an exact entity match; a CVE archive's entry for it comes first), or reads the CVE archive with cve_id="CVE-2021-41773"
"The WAF blocks SLEEP on this PostgreSQL injection; find another delay." Asks the librarian, which reads the time-based sections of your SQL injection pages and answers with the exact payloads it found

The library

A resource is one site, repository or PDF. When you add it, a background ingestion builds its map: the pages it keeps, each with a card (its title, its place in the site, its headings, a one-line description and tags by topic, content kind and technology). Every page has a page ID such as patt:412 (the resource's ID and a number) that stays the same across refreshes.

Site type How the map is built
Wiki (MkDocs, mdBook) the sitemap, else mkdocs.yml's navigation, else the site's menu
Docs site (Sphinx, Docusaurus) the search index, else its own sitemaps inside the docs folder, else a crawl of that folder (a map of the start page alone fails the refresh)
GitBook the sitemap, else the menu
GitHub repository the repository tree (chosen branch, folders, file types)
CVE archive with a GitHub token, an index of its CVE files (no text); one CVE's file is read live by its path at each lookup
PDF its pages, or its chapters
Website a crawl: LLM-guided, rule-based, or the site's sitemap (Auto)

Live or Stored. A Live resource (the default) keeps the map and the cards, and the agent's reads download the page from the site at that moment. A Stored resource also keeps a cleaned copy of every page in your database (up to your limits), so a read is instant and search reaches the text inside the pages, not only the cards. PDFs are always Stored (give a PDF the site type PDF: one that Auto detects is recorded as a website, see Known limits); CVE archives are never stored.

What a resource keeps is up to you: everything, only the pages about chosen topics and content kinds (the ingestion focus), and your own curation in the Map view (pin, block, rename, restore).

CVE archives

A CVE archive (a GitHub repository of PoCs laid out by year, such as trickest/cve) is read one CVE at a time, live: tradecraft_lookup(resource_id="trickest-cve", cve_id="CVE-2021-41773"). When the resource or your account has a GitHub token (Global Settings → API Keys → GitHub Access Token, sent only to GitHub), its ingestion also lists the archive's CVE files into an index: one entry per CVE, with no text, up to the 20,000 largest files. Search and Library now then find a CVE the archive holds when a query or a step names its id: one row per CVE, however many archives hold it (from the one of the highest priority), ahead of the other pages naming that CVE. Its page ID reads that CVE like cve_id does.

  • No token, no index. GitHub allows 60 calls an hour without one, and an index takes about one per year folder: the archive is then read by CVE id only, and its report says cve index: add a GitHub token to index this archive. An archive whose path patterns name no year folder has no index either (cve index: none, no path pattern names a year folder): it is read by CVE id only, and its card shows no notice.
  • An archive from the previous version gets its index at its first Refresh (or Save & refresh all), when it or your account has a token; until then its card reads Ingested before 2.0. After a refresh with no token (and none on the resource) the card reads Add a GitHub token to index this archive: the GitHub Access Token in Global Settings > API Keys, or the GitHub token override in Edit > Access, then refresh; an archive whose last ingestion did not reach the index reads Refresh to index this archive.
  • A refresh that missed a year folder (a GitHub error or limit, or the time budget) fails and keeps the previous index (unless the resource's When a refresh fails or comes back empty is Replace it); a listing the time budget cuts again goes live, so an archive too big for the budget is not left on an old index. A CVE outside the 20,000 largest files is still read by cve_id. A file you block in the Map is never read, by page ID or by cve_id.
  • Browsing an archive lists no CVE ids, and the librarian does not read archives.

The tools

The agent has three tools for the library, which it calls like any other tool: one to search it, one to read a page (one section at a time), and one to ask the librarian when it cannot say exactly what it needs. Searching and reading cost no model call, and none of them sends anything to the target: they read only your library and its sites.

tradecraft_search

tradecraft_search(query, resource?, topic?, kind?, technology?, path?)

Searches the cards (and, for Stored resources, the text of every section) with no model call. One search runs up to six wordings of the need: the agent's words, their synonyms and acronyms (sqli and SQL injection, plus My synonyms from Configure search), the words within the current attack skill's topic, within the target's technologies, the exact entities named (CVE ids, products, tools) and a fuzzy match on titles. Pages that match the current skill, phase and target technologies, and resources of high priority, rank higher; nothing is filtered out by them.

search: "postgres time based sqli" · FOUND · 8 of 23 results
 1. patt:412  PayloadsAllTheThings › SQL Injection › PostgreSQL Injection — time-based blind payloads (payloads)
 2. hacktricks:88  HackTricks › Pentesting Web › SQL Injection › PostgreSQL — heavy-query delays (methodology)
 ...
read: tradecraft_lookup(page="patt:412", section="Time based")

The verdict (FOUND, RELATED, NOT FOUND) follows Configure search → Match strictness. With a path (the query is then ignored), or a resource and no query, it browses one level of a resource's tree instead: its folders with page counts and descriptions, then its pages. A CVE id in the query also finds a CVE archive's entry for it, first.

The filters take the library's own names: topic one of the focus topics, kind a content kind (payloads, bypasses, techniques, tool_commands, poc, writeups, theory, detection, or a word such as exploit, write-up, tool, methodology), technology a technology name. An unknown value is refused with the list of the valid ones, and the agent tries again. Search terms are read as ASCII letters and digits: an accented letter splits a word in two, and a word in another script is dropped.

tradecraft_lookup

tradecraft_lookup(page="patt:412", section?, part?)
tradecraft_lookup(resource_id="hacktricks", query="kerberoast")      # no page ID yet
tradecraft_lookup(resource_id="trickest-cve", cve_id="CVE-2021-41773")
tradecraft_lookup(resource_id="hacktricks", section_path="pentesting-web/ssrf/")   # a path of its map

Reads one section of one page (12,000 characters at most by default, Configure search → Characters per read; a longer section is split into parts, never inside a code block). The answer names the page, the section it returns, the page's other sections and where the text came from: stored copy from <date>, live, or live (not stored) (a Stored resource's page past its storage limits). force_refresh reads a Stored page from its site instead of its copy. A blocked page is never read, and a deleted resource says so.

section_path skips the pick and reads a given page of the resource: a path of its map, its start page, or page=N of a PDF. It reads only the resource's own pages: any other address (another site, a path that climbs out of the resource) is refused before any request is made, and the refusal tells the agent to read the resource's pages by page ID from tradecraft_search.

Every read keeps that limit, a whole text too (one CVE of an archive, a PDF page, a page found by its title): a longer text comes in parts, and each part says part: N of M and gives the exact call that reads the next one (next: tradecraft_lookup(…, part=N+1)). One exception: a code block is never split, so a part holding a code block longer than the limit is longer too, up to 38,000 characters; a longer code block is cut there. An error names a page by its page ID or its address, never by its title (a CVE archive's, by its page ID).

The librarian: tradecraft_ask

tradecraft_ask(need, context?, want?, scope?)

For a vague need, the librarian searches, opens the most promising pages, reads the 1-2 sections of each that match, and answers FOUND, PARTIAL or NOT FOUND with up to three pages, each with an exact excerpt and a one-line reason. RedAmon checks every answer before the agent sees it: a page must be one the librarian read, and an excerpt must appear word for word in it.

  • It runs on your Tradecraft librarian model (Models by feature), only while Configure search → Librarian use is Agent decides (the default). With Search only, the agent has no tradecraft_ask and no model is needed.
  • Its limits are in Configure search: model calls per question (5), pages per question (4), a time limit (30 s; then it answers with the best it has), questions per agent run (10).
  • When it cannot use a model (none chosen, a model error, an Agent in the Loop run), it answers the plain search results and says why.
  • In the chat, a librarian result shows a trail line: Librarian: searched 3 queries, inspected 4 pages, picked 2.

Library now

The agent does not always think of looking something up. Library now does it for the agent: before each step, it looks in your library for pages about what the agent is about to do, and puts the best ones in front of it.

At every step of an attack where a page fits, the agent's prompt ends with Library now: up to 3 pages of your library that fit what it is about to do, found with no model call. They are searched for the todo item in progress and the next one (the objective before the agent has a todo list) and for a CVE a finding confirmed, and each page is labelled by the step it fits:

An example (the id is a random value at each step, and matches: lists the step's words the page's card holds):

Library now (pages for the steps at hand):
<<<UNTRUSTED_TRADECRAFT_RESULT id=…>>>
  step in progress: "Probe the search parameter for PostgreSQL time-based blind SQL injection"
    patt:412       PayloadsAllTheThings › SQL Injection › PostgreSQL Injection   matches: postgresql, time, blind, sql, injection
  next step: "Extract the users table with PostgreSQL stacked queries"
    hacktricks:88  HackTricks › Pentesting Web › SQL Injection › PostgreSQL injection   matches: postgresql, stacked
<<<END_UNTRUSTED_TRADECRAFT_RESULT id=…>>>
If one fits your next step, read it with tradecraft_lookup(page=…) before acting.

The steps and the page titles sit inside the untrusted wrapping, so they reach the model as data, never as instructions.

  • What fits. A page fits a step when search finds enough of the step on it (Configure search → Match strictness) and the page names the step in its own title, breadcrumb or file name, or names a topic the step names ("Directory Traversal" for "path traversal"); a page whose headings alone mention the step's words does not. A page naming a CVE id of the step exactly, or whose title is a close match of the step, fits too.
  • When it searches. A step is searched once, and again when the attack skill's topic, the phase or the target's technologies (a new one found) change, when the project's resources change, or when the agent has read all six pages kept for it. Each step of the agent waits at most 8 seconds in all for these searches; a round that did not answer is tried again at the next two steps. If a step cannot be searched, a notice after the block says so (use tradecraft_search for it yourself) once that step has no unread page left. A page the agent read never comes back; one it was shown and did not read stays in the block while its step is current. Nothing fits: no block.
  • The rules. Where Library now runs, the agent's Important Rules gain two (see Anatomy of a Think Step): rule 6, Your library: if a page there fits what it is about to do, reading it is that step (its decision calls tradecraft_lookup(page=…)), before its own knowledge or a web search, and its thought says Library: read <page id>. or Library: nothing fit.; rule 7, Name each step: each todo item names only the technique, the vulnerability's public identifier when known, and the target's technology it is about, and leaves the target's own details (paths, parameters, values, file names, tokens, proof strings) to the tool calls, because Library now searches with the item's words and no page holds those details; an active skill's own instructions for the todo list come first.
  • An announced read that did not happen. If the agent's thought said Library: read <page id>. and the read did not follow, the next step carries a short notice asking it to make that read its action, once per page.
  • Where it runs. In the phases where tradecraft_lookup is allowed, while the project uses at least one of your resources and Configure search → Hints during the attack is on. It is part of the agent's main think step only: LATS and Deep Think never see it, and Fireteam members get the three tools but no block and no rules 6 and 7.
  • In the agent's log, [tradecraft] library_now lines record what was shown and read, with page IDs and counts only.

What the agent sees in its prompt

  • Your resources. With Auto (Configure search → Resource list), each resource's full summary while the project uses at most 10 resources, then one line each (name, type and a short scope cut from the summary); Full and One line force either.
  • The coverage map. Page counts by topic, content kind and technology, with what is Not covered, so the agent does not look for what the library does not hold.
  • The skill line. When the run's attack skill is a topic your library covers, how many pages it has on it, just before the skill's playbook.
  • Library now when a page fits, and its two rules wherever it runs (above).

Projects and sharing

A resource is used in a project when it is Enabled in Global Settings and not turned off in the project's Agent Skills & Tradecraft tab (or the chat drawer's window of the same name). The chat's phase bar counts the resources the next message will use.

On a shared project, a collaborator's chats use the owner's library, with two differences from the owner's own chats:

  • No site logins. A resource with a site login is used only in the owner's own chats: a collaborator's chat, or a chat an administrator runs while acting as the owner, does not get it at all.
  • No GitHub token. Only the owner's own chats read with a GitHub token (the resource's override, else the owner's GitHub Access Token), and then only for requests inside the resource's own repository. Any other chat reads public GitHub pages with no token: a private repository resource left Live cannot be read there (make it Stored, so its pages come from the owner's database), and a CVE archive's lookups count against GitHub's 60 unauthenticated calls an hour.

A collaborator sees the owner's resources by name and on/off only, and a login resource as Owner only. Who sees what, in detail: Tradecraft Library → Who sees what.


Upgrading from the previous version

The previous Tradecraft picked a page by matching titles (optionally with a section picker model) and cached downloaded pages for a while. After the update:

  • your resources are converted at the agent's first start, from the maps they already had: no page is downloaded and no model is called (a PDF is downloaded once and stored). They work at once, with title-only cards, and read Ingested before 2.0; Global Settings → Tradecraft offers Save & refresh all once, to give them headings, descriptions and search inside pages. The conversion waits for the webapp to create the new tables, trying again for about 13 minutes; if the webapp's first start takes longer, it runs at the next agent start (docker compose restart agent), and until then the resources are read by title as before;
  • the page cache, its TTL and the section picker are gone; ./redamon.sh update deletes the old cache volume once (see the CHANGELOG for how to keep it);
  • adding or turning on a resource asks for a librarian model while Librarian use is Agent decides;
  • the three tools are allowed in every phase by default: a project whose tradecraft_lookup row still held the old default (exploitation and post-exploitation) gets all three phases once, at the webapp's first start; a row you changed is kept;
  • a CVE archive gets its index at its next refresh, when it or your account has a GitHub token.

Safety

  • Every request goes through the SSRF guard: private, loopback, link-local and cloud-metadata addresses are refused, judged on every redirect hop at the moment of connecting; a page rendered in the browser is guarded by a script that refuses internal addresses, and a refused page is never retried in the browser.
  • Library text is data, never instructions. Everything the tools return is wrapped as untrusted content, and the ingestion's model calls see page text the same way. Library now shows page IDs and titles, never page text, inside the same untrusted wrapping, with the steps it searched for.
  • Reads stay in the library. A read reaches only a page of the resource it names: a page ID, a path of its map, its start page. An address in section_path that is not one of its pages is refused before any request, so neither the agent nor text planted in a page can point a read at another site, the target included.
  • Your library is yours. Every read is keyed by the resource's owner; there is no cache shared between accounts.
  • Logins stay with their site: sent only to the resource's own host, never through the browser, only in the owner's chats, never shown back.
  • A GitHub token stays in its repository: used only in the owner's own chats, and sent only to requests inside the resource's own repository, never to the rest of the token's GitHub account.

Known limits

  • Library now follows the todo list of the previous step. Its steps are the todo items as the agent's last decision left them, so a step the agent is about to write gets its pages one step later.
  • Library now drops numbers from its searches. Version numbers and bare numbers (Apache 2.4.49 is searched as Apache), http(s):// URLs, e-mail addresses and IPv4 addresses are taken out of a step before it is searched.
  • One generic word can make a page fit. A word of the step in a page's title, breadcrumb or file name is enough, so a planning step can be shown an off-topic page.
  • Only the main think step sees Library now. LATS and Deep Think never see it; Fireteam members get the tools, but no block and no rules 6 and 7.
  • Dotted names (Node.js, ASP.NET) are one word in the index but several in a query, so they match less well. Search terms are ASCII: accented letters and other scripts are not matched.
  • Rules of Engagement. A Rules of Engagement document that forbids tradecraft_lookup does not forbid tradecraft_search or tradecraft_ask. To keep the library out of an engagement, turn its resources off in the project, or untick tradecraft_lookup's phases in the Tool Matrix (the three tools share that row).
  • Incremental refresh still requests every page. It saves storing and model calls, not requests.
  • The daily model budget is an administrator's quota on instance-shared providers; there is no daily stop for your own providers.
  • robots.txt is ignored by default (Respect robots.txt off in Configure ingestion).
  • CVE archives have an index only when their last ingestion had a GitHub token, holding at most the 20,000 largest files; a CVE outside it is read by cve_id only, never found by search or Library now.
  • The limits of the library itself (storage, crawl costs, logins, the form) are in Tradecraft Library → Known limits.

Comparison with other reference tools

Tool When to use Source freshness Model cost Curation
web_search General research, open-web context, recent news Real-time (Tavily) + pre-ingested KB none Open web
Knowledge Base (inside web_search) Pre-ingested security corpora (gtfobins, lolbas, owasp, nvd, exploitdb, nuclei) As fresh as its last ingestion none Curated at install time
tradecraft_search / tradecraft_lookup A specific technique, payload or PoC from your trusted sources Live pages read live; Stored pages as of the last refresh none Curated by you
tradecraft_ask A vague need your library may answer as above your librarian model Curated by you

Troubleshooting

Symptom What to check
The agent never uses the library The project's Tool Matrix row of tradecraft_lookup (the phases it allows), the resources' Enabled and the project's switches, and Configure search → Hints during the attack (Library now)
Library now shows nothing for a step No page names the step in its title, breadcrumb or file name: the step may not name its technique or technology, or the library has no page on it. Try Match strictness loose, or add a resource that covers it
Search does not find a CVE a CVE archive holds The archive has no index: refresh it, with a GitHub token on the resource or in API Keys (its card says which). The agent can still read it with cve_id
Adding a resource opens Choose a model for Tradecraft librarian Choose one there (or in Models by feature), or set Configure search → Librarian use to Search only
Search finds only titles The resource is Live, or was converted from the previous version: refresh it, or make it Stored
A card reads Not refreshed: the daily model budget is used up Save & refresh all stopped because an administrator's daily quota on an instance-shared provider ran out, to keep your chats' calls; the previous version is kept. Refresh it later. With your own providers there is no such stop
A card reads Failed (<code>): the previous version is kept The code is the agent's: fetch_failed (the site could not be reached), blocked_private_address (the URL or a redirect leads to an internal address), homepage_http_error (the start page answered an error), timeout (the time budget ran out), model_unavailable or loop_model_not_supported_here (the resource's model cannot be used: choose another in its form), llm_budget_exhausted (an administrator's daily quota), agent_restarted or agent_lost (the agent stopped during the job), agent_unreachable (the webapp could not reach the agent), resource_changed (its URL or storage changed during the job), internal_error; every code is in Tradecraft Library → Error codes. Fix the cause, then Refresh
A collaborator's chat cannot read a private GitHub resource Only the owner's own chats use a GitHub token. Make the resource Stored, so its pages are read from the owner's database
The agent gets refusing to read that URL: it is not a page of resource '…' It gave section_path an address that is not one of the resource's pages. It reads the resource's pages by page ID from tradecraft_search, or a path of the resource's map

Glossary

Term Meaning
Resource One site, repository or PDF in your library
Resource ID The slug the agent names a resource by (patt, hacktricks); fixed once saved
Ingestion The background job that builds a resource's map
Map The pages a resource keeps
Card A page's title, place in the site, headings, description and tags
Page ID <resource ID>:<n>, stable across refreshes
Live / Stored Read from the site at each read / a copy kept in your database
Focus What an ingestion keeps: Everything, Focused or Tag only
Librarian tradecraft_ask, on your Tradecraft librarian model
Library now Up to 3 library pages for the agent's steps at hand, at the end of its prompt whenever one fits
CVE archive index A CVE archive's list of CVE files, made with a GitHub token, so search finds a CVE it holds

Home


Getting Started

Core Workflow

Scanning & OSINT

AI & Automation

Plugins

HackLab

Analysis & Reporting

Contributing

Reference & Help

Clone this wiki locally