Skip to content
aarafat-devPublic

About

ByteTrace: local-first Firefox + terminal companion that turns TryHackMe sessions into structured, privacy-aware Obsidian notes (optional AI layer).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 ByteTrace

Capture once. Review clearly. Keep the evidence.

Turn TryHackMe browser activity and terminal commands into structured, Obsidian-ready Markdown notesβ€”with an optional privacy-aware AI layer.

Development preview Version 0.7.0 Python 3.11+

Firefox Obsidian Cloudflare Tests License

Features Β· How it works Β· Quick start Β· AI layer Β· Security Β· Roadmap

Important

ByteTrace is a development preview. Always review generated notes before publishing or treating them as authoritative.

✨ Features

Capability What it does
🌐 Firefox capture Captures room metadata, task headings, selected text, findings, lessons, and objectives.
⌨️ Terminal link Pairs a local Bash session and records commands, working directories, exit codes, phases, and optional output.
🧠 ByteTrace AI Reorganizes the complete sanitized draft, proposes better classifications, and produces a polished final note.
πŸ” Local-first privacy Keeps raw evidence and secret-placeholder mappings on your machine; only sanitized content can reach the AI provider.
πŸ“ Obsidian-ready notes Generates Markdown with frontmatter, callouts, code blocks, task sections, and graph links.
πŸ§ͺ Future training path Exports only user-approved examples for later evaluation or LoRA fine-tuning.

Three generation modes

Mode AI used? Best for
Template No Fast, deterministic notes with no external AI request.
AI Summary Yes Keeps the deterministic structure and adds an AI-written summary.
Full Draft Yes Lets ByteTrace inspect the entire sanitized Markdown draft and reorganize it into a final note.

🧭 How it works

flowchart LR
    subgraph LOCAL["πŸ”’ Your local machine"]
        FX["🌐 Firefox extension"]
        SH["⌨️ Bash terminal"]
        API["πŸ”— Local companion"]
        DB[("πŸ“¦ Session store")]
        RED["πŸ›‘οΈ Secret redaction"]
        VERIFY["Policy verification"]
        MD["πŸ“ Markdown renderer"]

        FX --> API
        SH --> API
        API --> DB
        DB --> RED
        VERIFY --> MD
    end

    subgraph OPTIONAL["☁️ Optional hosted inference"]
        AI["🧠 ByteTrace AI"]
    end

    RED -- "sanitized draft" --> AI
    AI -- "structured plan" --> VERIFY
    MD --> OUT["πŸ“₯ Reviewed .md note"]

    classDef input fill:#EA580C,stroke:#FDBA74,color:#FFFFFF;
    classDef local fill:#0F766E,stroke:#5EEAD4,color:#FFFFFF;
    classDef ai fill:#7C3AED,stroke:#C4B5FD,color:#FFFFFF;
    classDef output fill:#2563EB,stroke:#93C5FD,color:#FFFFFF;
    class FX,SH input;
    class API,DB,RED,VERIFY,MD local;
    class AI ai;
    class OUT output;
Loading

ByteTrace never receives the local secret-placeholder map. Its returned plan is validated before rendering, and the Firefox extension asks for confirmation before classifications are saved or the note is downloaded.

πŸš€ Quick start

Requirements

  • Linux or another Unix-like environment
  • Python 3.11 or newer
  • Firefox
  • Bash for terminal capture
  • Optional: an Obsidian vault and a Cloudflare account for AI generation

After cloning the repository, enter the project directory:

cd bytetrace

1. Start the local companion

PYTHONPATH=src python3 -m bytetrace --data-dir .data serve

The companion listens on 127.0.0.1:8765 by default. Leave this terminal running while you use the extension.

2. Create a pairing token

In a second terminal:

PYTHONPATH=src python3 -m bytetrace --data-dir .data token

Copy the token.

3. Load the Firefox extension

  1. Open about:debugging#/runtime/this-firefox.
  2. Select Load Temporary Add-on.
  3. Open extension/manifest.json from this repository.
  4. Open the extension settings.
  5. Keep the companion URL as http://127.0.0.1:8765.
  6. Paste the pairing token and click Save settings.
  7. Click Test connection.

Note

Temporary Firefox add-ons disappear after Firefox restarts. Load extension/manifest.json again when needed.

4. Capture and generate

  1. Open a TryHackMe room.
  2. Open the extension popup and start a session.
  3. Capture selected context, findings, objectives, and lessons as you work.
  4. Optionally pair a terminal using the instructions below.
  5. Choose Template, AI Summary, or Full Draft.
  6. Review ByteTrace's proposed changes.
  7. Confirm and download the Markdown note.

⌨️ Pair a local terminal

With the companion still running, select Pair terminal in the extension. It displays a command containing a short-lived pairing code, similar to:

./bytetrace-terminal ABCD-1234

Run the displayed command from a new terminal. The wrapper loads a Bash integration that sends command events to the active browser session.

Command Purpose
bytetrace-task Enumeration Change the phase assigned to later commands.
bytetrace-output FILE Attach selected output to the preceding command.
bytetrace-pause Pause terminal event capture.
bytetrace-resume Resume terminal event capture.
exit A leading space keeps a sensitive command private and unrecorded.
exit Leave the paired shell.

Command text, working directory, exit status, and phase are recorded. Output is opt-in and truncated before storage.

Warning

Do not paste passwords, tokens, private keys, or other secrets into captured output. Redaction is a safety layer, not a guarantee.

Terminal portability

The current wrapper targets a local Bash terminal. Kali Linux and a TryHackMe AttackBox can use the same event protocol, but portable remote bundles are still on the roadmap. Never expose the local companion directly to the public internet.

🧠 ByteTrace AI

ByteTrace is the AI layer responsible for understanding the whole sanitized draftβ€”not just one captured field. In Full Draft mode it can:

  • separate the real room objective from explanatory context;
  • group evidence under appropriate tasks and phases;
  • turn raw findings into concise conclusions;
  • preserve terminal commands and important supporting evidence;
  • identify missing information without inventing steps;
  • return structured classifications with confidence scores and reasons.

The verifier accepts automatic reclassification only when confidence is at least 80%. Auto-detected tasks and terminal commands remain locked to protect source evidence.

Zero-cost baseline with Cloudflare Workers AI

Cloudflare Workers AI currently provides a free daily allocation suitable for development and personal testing. Provider pricing and policies can change, so verify the current limits in the official Workers AI pricing documentation.

Create a Cloudflare API token with Workers AI permissions, then configure it in the Firefox extension under Settings β†’ AI provider:

  • Provider: Cloudflare Workers AI
  • Account ID: your Cloudflare account ID
  • API token: your Workers AI token
  • Model: the configured default or another compatible text-generation model

Credentials are sent only to the local companion and stored in .data/config.json with restrictive file permissions. They are never placed in generated notes.

Useful official references:

Configure Cloudflare from the CLI
PYTHONPATH=src python3 -m bytetrace \
  --data-dir .data \
  configure-ai YOUR_ACCOUNT_ID

The command asks for the Workers AI API token using a hidden prompt.

Check the stored configuration without revealing the token:

PYTHONPATH=src python3 -m bytetrace --data-dir .data ai-status

πŸ“ Obsidian style profile

You can learn structural preferences from an existing Obsidian vault without training a model. The scanner extracts safe formatting signals such as headings, tags, callout types, and code-block languages.

Build and save the local style profile:

PYTHONPATH=src python3 -m bytetrace \
  --data-dir .data \
  profile-vault "/path/to/your/Obsidian/Vault"

The style scanner does not copy vault content into the profile.

Use the CLI-only recording workflow

Start a session:

PYTHONPATH=src python3 -m bytetrace --data-dir .data start "Example Room" \
  --url "https://tryhackme.com/room/example" \
  --difficulty Easy

Record an event using the returned session ID:

PYTHONPATH=src python3 -m bytetrace --data-dir .data add SESSION_ID command \
  "nmap -sV 10.10.10.10" \
  --task Enumeration

Render a note:

PYTHONPATH=src python3 -m bytetrace --data-dir .data generate SESSION_ID \
  --output example-room.md

πŸ§ͺ Training dataset and future fine-tuning

Fine-tuning is intentionally not the first step. ByteTrace should first collect high-quality, user-corrected examples that can be evaluated.

Approve a reviewed session:

PYTHONPATH=src python3 -m bytetrace --data-dir .data approve-pair SESSION_ID corrected-note.md

Export only approved examples:

PYTHONPATH=src python3 -m bytetrace --data-dir .data export-dataset \
  .data/approved-training.jsonl

The export contains sanitized structured events and reviewed Markdown targets. It excludes raw secret mappings.

πŸ” Privacy and security

Data Location
Raw captured events Local companion store
Secret-placeholder map Local machine only
Sanitized draft Sent to AI only when an AI mode is selected
Provider credentials Local config with restrictive permissions
Final Markdown Downloaded only after user confirmation

Additional safeguards:

  • The companion binds to loopback by default.
  • Bearer-token authentication protects local API requests.
  • Cloud inference is optional; Template mode remains fully deterministic.
  • AI output is treated as untrusted and validated against a schema and local policy.
  • ByteTrace has no browser, shell, or autonomous tool access.
  • Generated notes clearly warn that AI content may be inaccurate.

Never commit or force-add .data/ or generated/. They can contain credentials, captured room evidence, terminal history, and personal notes.

Use this project only for rooms and systems you are authorized to access.

πŸ§ͺ Run the tests

The runtime uses only the Python standard library. Run the full test suite with:

PYTHONPATH=src python3 -m unittest discover -s tests -v

πŸ—ΊοΈ Roadmap

Available now

  • Local companion and authenticated event API
  • Firefox room and selection capture
  • Bash terminal pairing
  • Deterministic Obsidian Markdown renderer
  • Cloudflare Workers AI integration
  • Full-draft ByteTrace classification and verification
  • Approved-dataset export

Planned

  • Portable Kali Linux and AttackBox terminal bundles
  • Signed Firefox release package
  • Quality evaluations over reviewed notes
  • Optional LoRA fine-tuning after enough approved examples exist

🀝 Contributing

Issues and pull requests are welcome. For code changes:

  1. Create a focused branch.
  2. Keep secrets and personal vault content out of commits.
  3. Add or update tests for behavioral changes.
  4. Run the full test suite before opening a pull request.

πŸ“œ License

Released under the MIT License.

βš–οΈ Disclaimer

ByteTrace is an independent community project. It is not affiliated with or endorsed by TryHackMe, Mozilla, Obsidian, or Cloudflare. Product names and trademarks belong to their respective owners.

Built for learners who would rather spend their time understanding the room than formatting the notes.

About

ByteTrace: local-first Firefox + terminal companion that turns TryHackMe sessions into structured, privacy-aware Obsidian notes (optional AI layer).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages