Skip to main content

mongotar (huMONGOus TAR)

Files to prompt, and back.

mongotar logo

Test (Linux, macOS, Windows) codecov PyPI version License: MIT

A simple tool for serializing and deserializing files (with permissions and .gitignore exclusion) into a human-readable text file.

Inspired by GNU tar, Go's txtar, and files-to-prompt. mongotar bundles files into a single, human-readable text file. Unlike most "codebase to prompt" tools, it can reliably turn that text file back into files.

To achieve that, and unlike other "plain-text archive" formats, it stores basic user file permissions (rw/rwx) together with the file paths.

mongotar 101

$ mongotar src/ config.txt project.mongotar
  Successfully serialized items to 'project.mongotar'

$ cat project.mongotar
  --- config.txt --- rw
  debug=true

  --- src/main.py --- rw
  print("hello")

$ mongotar -d -f project.mongotar .
  Successfully deserialized 'project.mongotar' to '.'

Why mongotar?

mongotar is at the intersection of two different tool categories:

  1. Dump a repo into one blob for sending to an LLM. This is the space of players such as: Repomix, gitingest, files-to-prompt, and code2prompt. Unlike the first two, mongotar is less "full repo serialization", and has good UX for hand picking which files to serialize. None of them round-trips like mongotar, which can be useful for some LLM workflows (see later).

  2. Plain-text archive formats. This is the space of tools like txtar and shar. mongotar's differentiator here is its simultaneous focus on round-tripping, human-readability, and .gitignore support.

mongotar follows UNIX-philosophy, and deliberately has no LLM-specific features baked in. Those features are to be built on top of this small core (700 LOC).

What motivated mongotar was agentic use cases. Say, a skill composes a problem description and appends relevant files to it without loading them into the agent's context, and sends them to another LLM. If the other LLM hands back a complete set of modified files, it can be deserialized back into the file system (rather than a diff that may not apply cleanly).

Indeed, diff formats are known to be fragile against LLM output, so whole-file output tends to be more reliable.

In short:

Tool Human readable Round-trip Selective files Permissions .gitignore
tar ❌ ✅ ✅ ✅ ✅
txtar ✅ ✅ limited ❌ ❌
repo-to-prompt tools ✅ generally ❌ varies ❌ ✅
mongotar ✅ ✅ ✅ simplified ✅ ✅

Some Features

  • Library: Besides CLI, mongotar can be imported and used directly in Python projects.
  • Safe Deserialization: By default, does not overwrite existing files. Use -f/--force to enable overwriting.
  • VCS Exclusion: Version-control directories (.git, .svn, .hg, CVS, ...) are always excluded. Optional -e/--exclude-vcs additionally respects .gitignore files, with git precedence.
  • Pattern Exclusion: --exclude=PATTERN skips paths matching a glob-style pattern, like GNU tar's --exclude.

The default file extension is .mongotar, but any extension can be used. You can even pipe to stdout.

Format

    Free text before the first file header is an optional comment section.

    --- path/to/file.txt --- rw
    This is the content of the first file.
    It can span multiple lines.

    --- path/to/another/script.sh --- rwx
    #!/bin/bash
    echo "Hello from the script!"

    --- empty_file.txt --- rw

    --- path/to/file2.txt --- rw
    Content of the second file.
  • Header format: --- <filepath> --- <permission>
  • Separator: Two newlines (\n\n) separates the content of one file from the header of the next.

Example

Suppose you have a directory structure like this:

my_project/
├── main.py
├── config.txt
└── scripts/
    └── run.sh       (executable)

Running mongotar my_project my_project.mongotar produces:

--- my_project/main.py --- rw
print("hello")

--- my_project/config.txt --- rw
debug=true

--- my_project/scripts/run.sh --- rwx
#!/bin/bash
echo "running"

Running mongotar -d -f my_project.mongotar . recreates the same tree, with run.sh restored as executable.

Installation

Requires Python 3.14+.

pip install mongotar

After installation, the mongotar command will be available in your PATH.

Or from source:

git clone https://github.com/sebastiancarlos/mongotar
cd mongotar
uv tool install .

Usage (mongotar CLI)

mongotar path/to/file_or_directory [path/to/another ...] output.mongotar

-d/--deserialize: Deserialize an archive back into a directory.

mongotar -d my_project.mongotar output_dir/

-e/--exclude-vcs: makes .gitignore rules apply.

mongotar -e src/ my_project.mongotar

--exclude PATTERN:

mongotar --exclude '*.log' --exclude '*/build' src/ my_project.mongotar

Output to stdout: use - as the output path.

mongotar src/ config.txt - > my_project.mongotar

Limitations

  • Permissions Model: Only user permissions are stored and restored (rw or rwx). Group/other permissions are ignored during serialization and not set during deserialization.
  • Binary Files: Not designed for binary files. Files with non-UTF-8 characters will be skipped.
  • Cross-platform: Windows supported, but everything serializes as rw (Windows has no concept of executable permissions).
  • No symlink support: Symlinks are not supported and will be ignored during serialization (with a warning).
  • Header collision: The archive format has no escaping (matching txtar behavior). Serialization will skip any file whose content contains a line matching the header format (--- path/to/file --- rw), logging a warning (rare case anyway).

Why not just use Repomix/gitingest/etc?

Those tools tend to encompass the entire pipeline of generating a prompt. mongotar's output is meant to be a component you embed inside a message, and which you can turn back into real files.

If you just want to paste your entire repo into ChatGPT once, use Repomix or gitingest. They're better at that.

mongotar's closest relative is files-to-prompt, which shares the simple, "Unix CLI" philosophy. The notable difference is deserialization.

License

MIT

Metadata

Release files for mongotar 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mongotar 0.1.2
File Size Uploaded Provenance Actions
mongotar-0.1.2.tar.gz 68.9 kB Without provenance Details for mongotar-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mongotar 0.1.2
File Interpreter ABI Platform Actions
mongotar-0.1.2-py3-none-any.whl Python 3 none any Details for mongotar-0.1.2-py3-none-any.whl

Total release size: 81.6 kB

Release files / mongotar-0.1.2.tar.gz

Download URL mongotar-0.1.2.tar.gz
Size 68.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0355a23fc4cd8b9e676234057fe8390efc660eb703a7f7de3f6c1633410bb5cd
BLAKE2b-256 checksum
How to use checksums
a7d34ad6c022615db3e115035271f91430cc53df164eb194341772a6d03b00c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mongotar-0.1.2-py3-none-any.whl

Download URL mongotar-0.1.2-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ab3d193cdf570e10ae10690147fd6f0548755aa32c352a7503b2d73379ac694
BLAKE2b-256 checksum
How to use checksums
2136074da720ed33d77ab3fcd180713b2d211013b6e3d5bf917aacf4bbd76c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for mongotar 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page