๐ฑ mongotar: files to prompt, and back.
3
stars
1
commits
Python
primary language
Sep 6, 2026
updated
mongotar (huMONGOus TAR)Files to prompt, and back.
A simple tool for serializing and deserializing files (with permissions and
.gitignore support) into human-readable text files.
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 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 '.'
mongotar?mongotar is at the intersection of two different tool categories:
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).
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:
| Format | Human readable | Round-trip | Selective files | AI-friendly | Permissions | .gitignore |
|---|---|---|---|---|---|---|
| tar | โ | โ | โ | โ | โ | โ |
| txtar | โ | โ | limited | โ | โ | โ |
| repo-to-prompt tools | โ | generally โ | varies | โ | โ | โ |
| mongotar | โ | โ | โ | โ | simplified โ | โ |
mongotar can be imported and used directly in
Python projects.-f/--force to enable overwriting..git, .svn, .hg,
CVS, ...) are always excluded. Optional -e/--exclude-vcs additionally
respects .gitignore files, with git precedence.--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.
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!"
Make sure to include a blank line after the content
--- empty_file.txt --- rw
--- path/to/file2.txt --- rw
Content of the second file.
--- <filepath> --- <permission>\n\n) separates the content of one file
from the header of the next.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.
git clone https://github.com/sebastiancarlos/mongotar
cd mongotar
uv tool install .
After installation, the mongotar command will be available in your PATH.
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
Suppose you want a skill that gets a second opinion from another model without loading the relevant files into the calling agent's own context. The skill might tell the agent to do something like this:
# Build the archive to attach, without ever reading the files into context
mongotar src/auth.py src/session.py tests/test_auth.py - > /tmp/review.mongotar
The agent then composes its own problem description and appends the archive's contents verbatim.
If the downstream LLM is asked to propose changes rather than just an
opinion, it can return a .mongotar archive instead of a diff, and the agent
restores it deterministically.
rw
or rwx). Group/other permissions are ignored during serialization and not
set during deserialization.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).These 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.
MIT
1 commits
Python
100.0%
๐ฑ mongotar: files to prompt, and back.
3
stars
1
commits
Python
primary language
Sep 6, 2026
updated
mongotar (huMONGOus TAR)Files to prompt, and back.
A simple tool for serializing and deserializing files (with permissions and
.gitignore support) into human-readable text files.
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 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 '.'
mongotar?mongotar is at the intersection of two different tool categories:
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).
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:
| Format | Human readable | Round-trip | Selective files | AI-friendly | Permissions | .gitignore |
|---|---|---|---|---|---|---|
| tar | โ | โ | โ | โ | โ | โ |
| txtar | โ | โ | limited | โ | โ | โ |
| repo-to-prompt tools | โ | generally โ | varies | โ | โ | โ |
| mongotar | โ | โ | โ | โ | simplified โ | โ |
mongotar can be imported and used directly in
Python projects.-f/--force to enable overwriting..git, .svn, .hg,
CVS, ...) are always excluded. Optional -e/--exclude-vcs additionally
respects .gitignore files, with git precedence.--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.
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!"
Make sure to include a blank line after the content
--- empty_file.txt --- rw
--- path/to/file2.txt --- rw
Content of the second file.
--- <filepath> --- <permission>\n\n) separates the content of one file
from the header of the next.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.
git clone https://github.com/sebastiancarlos/mongotar
cd mongotar
uv tool install .
After installation, the mongotar command will be available in your PATH.
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
Suppose you want a skill that gets a second opinion from another model without loading the relevant files into the calling agent's own context. The skill might tell the agent to do something like this:
# Build the archive to attach, without ever reading the files into context
mongotar src/auth.py src/session.py tests/test_auth.py - > /tmp/review.mongotar
The agent then composes its own problem description and appends the archive's contents verbatim.
If the downstream LLM is asked to propose changes rather than just an
opinion, it can return a .mongotar archive instead of a diff, and the agent
restores it deterministically.
rw
or rwx). Group/other permissions are ignored during serialization and not
set during deserialization.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).These 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.
MIT
1 commits
Python
100.0%