Integrate Hackpert as a Prolog expert layer over canonical Hackmode state #51
Labels
No labels
bug
documentation
duplicate
enhancement
feature
good first issue
help wanted
invalid
question
refactor
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/hackmode#51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Outcome
Fold Hackpert into the canonical Hackmode monorepo as a SWI-Prolog expert/orchestration layer with two explicit engine modes: passive and active.
Hackpert must not become a second operation database or parallel source of truth. Hackmode/Tek9 remains canonical for operations, typed assets, graph persistence, KB lifecycle, and StarIntel synchronization. However, Hackpert does orchestrate tool runs, and in active mode it may intentionally drive canonical state changes through Hackmode's normal mutation APIs.
Source inspiration: https://github.com/lost-rob0t/hackpert
Engine modes
Passive mode
Passive Hackpert observes canonical Hackmode state, typed tool calls/results, and passive evidence such as IPX traffic.
Passive mode may:
Passive mode must not:
Active mode
Active Hackpert is an orchestrating expert engine. It is required for fuzzing, SQLi, OOB, XSS/blind-XSS, and other experts whose reasoning loop must take an action, inspect the result, update knowledge, and continue.
Active mode may:
Active mode does not get arbitrary mutation authority. Prolog emits typed actions/state deltas; the Common Lisp active-engine wrapper validates them and executes them through canonical Hackmode interfaces. No direct Prolog writes into Tek9 and no arbitrary shell primitive.
Tool orchestration
Hackpert already conceptually runs/orchestrates tools; the Hackmode adaptation must preserve that capability instead of reducing Hackpert to a recommendation service.
All active execution still uses Hackmode's registered provider/capability runtime so:
The active loop is roughly:
Graph model
Hackpert consumes canonical operation state plus typed tool calls/results. Its durable reasoning output/state transition is graph-shaped.
The graph covers:
Passive mode returns graph/advice deltas only. Active mode may return graph + typed action/state deltas for Common Lisp to accept and apply.
Knowledge-base model
Hackmode should have three explicit KB scopes:
Hackpert may propose promotions/exports. Common Lisp validates and persists them. Active mode may mutate operational state directly through the wrapper; long-term/global promotion remains an explicit lifecycle operation.
Learning requirements
Expert families / goals
Shared graph + KB substrate should support specialized experts rather than separate state silos:
Attack plans and playbooks are first-class graph structures with prerequisites, candidate capabilities, expected evidence, success/failure branches, and stop conditions.
SQLi/fuzzing-class experts are expected to run in active mode because they require iterative action -> evidence -> state mutation -> next action loops.
Possible Prolog-RLM integration comes later once stable and must reuse Hackmode's graph/KB/active-engine boundary.
LISH integration
Hackpert needs first-class LISH integration rather than a separate Hackpert REPL.
LISH should be able to:
Authority boundary
targets.txt,inscope.txt,outscope.txt,expert-state.prolog, or environment-variable operation authority.First slice in PR #25
hackmode-expertbridge using SWI-Prolog when installedswipl, quoting/injection safety, and no canonical-state mutation in the passive foundationPR #25 implemented the passive foundation only. Its "no mutation" property is not the final Hackpert architecture; active mode is the next major execution layer.
Next implementation slices
:passive/:active)Invariants
Acceptance proof for active mode
Common lisp wrapper around it for sure to mutate db
And def dont have expert system mutate db
Goals include:
Expert level fuzzing (web)
SQLI engine (also known as expert)
Out of band tsting (also known as expert)
XSS engine (also know nas expert)
Blind Xss engine (also known as expert)
recon engine (also known as expert)
Abilities to take wordlists/fuzz lists and import as expert KB
Working attacks promoted to expert KB
orchestration expert learns failed attack paths
Possible Prolog RLM integration once its stable
Also attack plans and playbooks.
IPX is now split into #26 as the passive traffic-intelligence consumer of this expert substrate.
Required dependency direction:
IPX capture proxy -> append-only evidence spool -> typed parser/exchange graph -> Hackpert passive reasoning -> typed graph delta -> Common Lisp acceptance -> Tek9/operational KB -> StarIntel projection/durable outboxThe expert system remains effect-free: it does not mutate the capture, DB, KB, or StarIntel and passive observation does not implicitly trigger active scanning/replay/exploitation.
docs/architecture/ipx.orgis now on PR #25 so the foundation branch records the contract.Database/graph worker merged PR #42 at
10fa9855449ea2be8d6ed047f457558bdebd0a4e.Completed database-owned prerequisite slice:
hackmode-databaseASDF system (it referenced missingobjects.lisp/encoding.lispand contained incomplete DB wrappers);RED:
e1190b25dbf720a72cbf02a727f2441ce3215a48— monorepo green, core failed at the newly required database load/test step.GREEN exact PR head:
03e649a2c3e535bade7578fb38f5d2840198194c— core + monorepo both green before expected-head squash merge.Next database-owned dependency is durable/replay-safe execution evidence semantics and the operational-KB mutation boundary. Hackpert consumer/orchestration work remains with the sibling worker.
Database/KB progress: explicit global-KB export lifecycle merged via #53 at
573b4c93c3f22be145d98734e9313efa9f8d481b.The original #51 head (
6baf48095d915f17add315d5bf785a3aba2463fa) was green but had diverged six commits behind current master after sibling #52, so it was not stale-merged. The same six-file database delta was forward-reconciled onto master7a9edae29772845f5a916df244cfee23246e5888as exact head0b7b74a507218530d8fcae34d7ab7ea752200845;core,monorepo, andagent-framework-boundaryall passed with zero review threads before expected-head squash merge.Completed contract:
Next database-owned dependency is conflict-safe replay/idempotency for deterministic graph/KB writes: identical retries should remain idempotent while same-ID/different-content collisions fail closed rather than silently rewriting evidence.
Database Auto-RAGE progress: merged #55 (
38b270e6b2f3ac2924068983b9d79afe469fc2cc) for conflict-safe deterministic replay across execution graph and KB persistence. Stable-ID first writes insert, identical retries replay idempotently, and same-ID/different-content node/edge writes fail closed without overwriting canonical evidence. The compare/write is serialized by Tek9's composable write transaction; Hackmode's CI Tek9 pin was advanced from the pre-transaction API SHA toa9f5b595f5d965163d2b7c518c72a2efd9be13fe. Exact PR headd0b8c40bff40cd4044138f1fe5ba83dc7a132a36passed core, monorepo, and agent-framework-boundary with zero review threads before expected-head merge.Database/graph progress: typed operation snapshot reads merged via #58 as
78d24647b52805bf47f172d17914651fce4e4ef4.Completed database-owned read contract:
RED:
02a8f98212baceb462f1b45c0f00c6b50ad2788e.GREEN exact head:
244eff751e366dd8d6e5993fe8cef7f2296d618e;core,monorepo, andagent-framework-boundarypassed with zero review threads before expected-head squash merge.Hackpert consumer-side wiring remains sibling-owned: merged #54 can now consume these typed database reads instead of requiring callers to enumerate Tek9 internals.
Database Auto-RAGE update: PR #61 merged the reusable-KB read side and fixed the provenance-edge persistence defect exposed by its RED tests.
Completed storage contract:
RED head:
4dcdd8d7698cd0d7480942e6a6220e6eef86249c.First implementation CI exposed the existing cross-graph edge defect at
82b88fa3881b497bc8f11df3108f0ef7eb0e2fe6.GREEN exact head:
6b3e1fcde997562047f005293b592a8450b5bb7d(core,monorepo, andagent-framework-boundaryall passed; zero review threads).Merged as #61.
Database/KB worker merged #65 at
b939c0bbcb2e9323940f2ae62ac406711a4ed0a8.Completed database-owned seed-import slice:
:wordlist/:fuzz-listimport into the operation-scoped operational KB;RED exact head:
878b27a10a3e3c9bc3523e85f1814afa641ad961— core failed on the intentionally absentMAKE-OPERATIONAL-KB-SEED-ASSERTIONS; monorepo + boundary gates passed.GREEN exact head:
c987aab426b5b6090634e517b626f61d546d70ba— core + monorepo + agent-framework-boundary all passed, zero review threads/reviews, mergeable against unchanged master, then expected-head squash merge.Hackpert handoff: imported seed assertions are available through the existing typed operational-KB read boundary; consumer/selection policy remains sibling-owned.
Database slice merged via #77 at master
c7753a5497.Completed contract: one validated typed tool call/result pair can now be deterministically projected to one operation-scoped operational-KB assertion carrying capability, terminal status, call identity, exact call/result evidence IDs, expert/version, and provenance. Provider output remains only in the execution graph; long-term/global promotion stays explicit.
Exact PR head
3a557c0d27passed core, monorepo, and agent-framework-boundary with no reviews or unresolved threads before expected-head squash merge.Database-side next dependency selected: deterministic effective operational-KB snapshot semantics (assertions minus valid retractions), so Hackpert/RLM consumers can read canonical effective knowledge without reimplementing retraction resolution. Consumer wiring remains sibling-owned.
Database/KB Auto-RAGE progress: merged #80 as
8b763bcc8c9e679663eb58427b44d3e709f8c108.Completed database-owned effective operational-KB read contract:
fetch-effective-operational-kb-assertionsover the canonical operation-scoped Tek9 KB graph;run-idfiltering, so a later-run retraction cannot resurrect stale earlier-run knowledge in a filtered snapshot;RED exact head:
40c77e55a3131c1c304cc7169fbb35398b48aca6—corefailed specifically becauseFETCH-EFFECTIVE-OPERATIONAL-KB-ASSERTIONSwas absent;monorepoandagent-framework-boundarywere green.GREEN exact implementation head:
e427e1372a32b2248504a3579a4c8ec579fbb63a—core,monorepo, andagent-framework-boundaryall green; PR mergeable with zero reviews/threads against unchanged master22d1dd98955990c7145798c939b7afe1230e9768; expected-head squash merge used.Hackpert/RLM handoff: consumers can now ask the database boundary for canonical effective operational knowledge instead of independently resolving assertion/retraction history. Consumer wiring remains sibling-owned.
Database worker update — PR #108 merged at
c51f029415eeb2b653a1b213ae78f14cdeef0a0b.Long-term KB promotion now fails closed unless the claimed source assertion is the exact canonical assertion persisted in that operation's operational KB and remains live (not retracted). Validation compares the immutable promotion snapshot (operation/run/expert/version/evidence/key/value) against the stored typed assertion and checks operation-wide retractions inside the same Tek9 write transaction as the promotion write.
RED:
9c8050bed75f711b0ce0759dfc365364b92ee84afailedcoreatnon-canonical assertion unexpectedly promoted; monorepo and framework-boundary passed. GREEN:adc4bcf663d3d67f38df1b7969c3b88098262156passed core, monorepo, and agent-framework-boundary.Consumer boundary: Hackpert/RLM may request promotion using typed operational assertions, but must not treat a stale in-memory assertion as promotable after retraction. Storage remains canonical authority for admission.
Database/KB handoff: merged #111 (
8d77cada9b6e38da5c1b3cab1d79fb98f5a06158). Global-KB export can no longer bypass the long-term lifecycle with a caller-constructed promotion.persist-global-kb-exportnow resolves the referenced promotion from the canonical long-term Tek9 graph and requires the exported source/provenance claim to match it exactly inside the same write transaction used for global persistence. Consumer-side rule: persist/accept a long-term promotion first, then explicitly export that canonical promotion; do not treat an in-memory promotion object as global-KB authority.Database/KB hardening merged via #113. Operational-KB retractions now fail closed unless the referenced target resolves to a canonical typed
:assertentry in the same operation graph. Validation and retraction persistence occur inside the same Tek9 write transaction, so an assertion-shaped ID alone is not mutation authority. RED head2aaa6365291cbbfe9197a9f351805d973b173229failedcorein the ASDF test step while monorepo/boundary passed; GREEN exact headd0679b03f0689902fc0f9072a9ba12b28c880720passed core, monorepo, and agent-framework-boundary before expected-head squash merge. Consumer handoff: use canonical persisted operational assertions as retraction targets; storage rejects corrupt/non-assertion targets.Database handoff: #115 merged.
persist-operational-kb-seed-valuesnow treats one bounded wordlist/fuzz-list seed import as a single canonical Tek9 write transaction. Hackpert/RLM consumers can rely on all-or-nothing persistence for one logical import: deterministic replay remains valid, while a conflicting assertion aborts the import without leaving earlier seed assertions durably committed.Database/KB handoff: PR #124 merged.
fetch-long-term-kb-promotionnow validates the stable record ID and returns a typedlong-term-kb-promotion(or NIL when absent) from the canonical Tek9 long-term-KB graph instead of leaking a raw Tek9 node. Hackpert/RLM consumers can use the singular read without depending on persistence internals; promotion identity and evidence remain available through the typed boundary.