Importing an Existing Project
If you have an existing codebase you want to manage with Trinity, use Import project instead of greenfield setup in Architect. Open it from New thread on the Threads page, choose the workspace the project joins (it defaults to the one you are in), and add the project: its import thread opens on the Threads page.
Overview
When you import an existing project, Trinity validates the link or path and detects the repository structure. An import agent then reads your folder, or the repo the link names, tells you what it found and asks which repos come in. Once they are cloned it hands the reading to three helpers that you can watch under Agents: the Scanner, the Docs writer and Business details. Trinity clones only the repos you confirm, from their GitHub remotes, into its own workspace in the projects folder of your storage location (~/.trinity unless you changed it) — your original working directory is never modified.
The import is a conversation of its own, an import thread, with one card for each step. The steps are:
- Scan → 2. Files → 3. Repos → 4. Docs → 5. Report → 6. Apply
The import page is the import agent's conversation. It starts by telling you where you are: the agent talks here, the step cards sit in the same thread (reach them from Progress), and it walks you through the rail. The agent says what each step will do before it runs, and what changed after, naming the rail item where the result shows. Each step appears as a card in the import thread the moment you reach it, and the card of the step you are on is the one you work in. The cards behind it show a check; a card you have not reached reads Not reached yet. To go back to a step, tell the import agent ("go back to Files"): it moves the import there, keeps the work on the steps after it, and takes you to the card. Beside the thread, a rail keeps Progress (the steps, done, current or ahead), Found (the repos and packages the scan found, with the paths you skipped) and Landed (what Apply did, empty until you have applied).
Progress is saved automatically, on the thread, so any member of the project can open the import and see where it stands. You can leave at any step, or close the app, and come back: the thread opens scrolled to the card of the step you were on. Nothing is created in your project until you apply: no repo, package or target exists before the Apply step. Until you apply, the project lives in the import: its sidebar shows an Import entry that takes you back, and opening the project from the project selector or its dashboard lands you there too. Architect isn't available until the import is applied — opening it brings you back to the import.
If an import was interrupted before its conversation was created, the page says "This import has no thread yet." and offers Resume import, which opens a fresh one at the Scan step. To start an import over, delete the project with Delete on the Danger tab of its settings; an imported project has no Reset card.
Before You Start: Link and Path Validation
The import field takes a link to a repo or a folder path, and tells them apart by what you type: a path starting with / or ~ is a folder, and an https or ssh clone URL, a git@host:owner/name address or a repo page URL is a link. Browse picks a folder.
For a link, Validate reads the repo under the git account connected for the workspace you chose and fills the project name from the repo's name. It refuses a link that names no repo, a host with no connected account, a repo your account cannot read, and an archived repo, each with a sentence saying why, and Add Project stays off. If a project in the workspace already holds the repo, adding it says so and offers Open for that project. Nothing is cloned to your device: Trinity clones the repo into its own workspace after you confirm it in the import thread. A link names one repo, so it is never read as a polyrepo or a monorepo; the Scanner finds the structure after the clone.
When you enter a folder path, Trinity validates it and detects the repository structure:
- Monorepo — a single git repo with everything in one place. The simplest case.
- Turborepo — a single git repo with declared workspace tooling (Turborepo, Nx, Lerna, or pnpm workspaces). Trinity shows the detected tool and the workspace directories it found.
- Polyrepo — a parent directory containing multiple child git repos, each with their own remote. Trinity lists the discovered repos and their remote URLs.
If the path isn't a git repo or has no remote, Trinity shows the exact commands to fix it.
Pasting a link in the import thread
You can also paste a repo link into the import thread, in any words. The agent reads the repo under your connected git account and makes it the import's source, with nothing cloned until you confirm which repos come in. It turns a link down, with the reason, when the text is not a repo link, the repo is archived, your account cannot read it or cannot push to it, another project already holds the repo (it names that project), or the link would repoint a repo this project already has. After Apply the project's repos are settled, so only a link to one of them is accepted.
Reading another repo for ideas
Import is for making a repo a project of its own. To get ideas from another repo, or to try something from it, ask the Architect to read it: give it the link and it brings the repo in as a read-only reference. A reference repo never joins your project. The agent can read and run its code in a scratch copy that has no connection back to the repo's remote, so nothing it does there can be pushed, and Trinity removes the copy when the conversation ends or after a day without use. A private repo comes in only for a link you wrote in the conversation. When the agent uses something from it, it says which repo, commit and file the idea came from, and checks the repo's license before copying code.
To add a repo to the project you are already in, tell the Architect which repo the project needs; that is a separate step from reading one.
Talking to the import agent
The agent reads your folder or the repo your link names, explains the import and stages what you decide, and its helpers do the long steps. It never applies the import: Apply stays yours. Ask it anything about the rail or the steps, and tell it what to change: "skip the docs" adds them to Skipped, "treat <repo> as external" marks the repo External, and a package you call external is skipped (dropped from packages and targets and listed under Skipped). "Rescan" makes the Scanner read the code again. It will not open a .env file; it reads environment variable names only.
The message box under the conversation is always on. The agent runs on the machine that started the import and inspects your folder through Trinity. Anyone on the project can open the import on another device, read the conversation and write to it; the agent answers on the machine that holds the folder, so that machine has to be running Trinity.
Step 1: Scan
The import agent inspects your folder first. It lists the git repos in it, each repo's remote, what is changed but not committed and any commits your remote does not have, then asks which repos come in. A repo with no remote cannot be cloned, and the agent tells you to push it first. The Found panel shows the repos left out under Not in the project and your unpushed work under Local work. Only after you confirm does Trinity clone, and only what you confirmed. It then analyses its copy of your codebase:
- Directory tree — maps the full project structure
- Git info — each repo's current branch, remote URL and recent commits
- Framework detection — identifies languages, frameworks, and libraries from package files, including cross-platform setups (React Native Web, Capacitor, Tauri) where one codebase ships to more than one place
- Quality tools — detects linters, formatters, test frameworks already configured
- Environment files — finds
.envfiles and identifies required variables - CI/CD — detects GitHub Actions, GitLab CI, or other pipeline configs
- Security signals — flags potential vulnerabilities or security issues
- Agent guidance — checks whether your
AGENTS.mdfiles have grown into one long file every story has to load
The agent then opens files itself to settle each package and target, and stages what it read. The Scan card says where it is: reading your folder, reading Trinity's copy, or "Your codebase is read" with Review files to carry on. The card runs no scan of its own; to scan again, ask the agent.
Step 2: Files
Before Trinity snapshots your ambient project files, you can mark anything it should skip — typically large build artifacts, local dumps, vendored archives, or anything you simply don't want travelling with the workspace. The file picker lets you select individual files and entire folders; folder exclusions skip the folder and everything beneath it.
Nested git repositories are already handled automatically (Trinity stops at each .git boundary and clones those from GitHub), so you don't need to exclude them. This step is about the loose files and directories that live around the repos.
You can also skip this step entirely if you're happy with Trinity capturing everything ambient in the project root.
Step 3: Repos
The import agent's reading of your code is presented as a summary for your review:
- Project summary — what the project does, its architecture
- Packages & Targets — the code Trinity found and what it ships. A package is one dependency manifest — the folder holding a
package.json,Cargo.toml,composer.json, or equivalent. A target is one thing you ship from it, picked from the target kinds (Web App, Website, Mobile, Desktop, CLI, API, Library, Extension), each with a short description so you can tell them apart. Targets are listed underneath the package they build from, so you can see at a glance which folder produces what. - Repository structure — single repo, monorepo, or polyrepo, and the repos in it. Each repo is listed under the name Trinity gave it when it created the project:
mainfor a single repo, and each repo's folder name for a polyrepo. The Docs step and Apply find each repo by that name, so those repos keep their name and folder and can't be removed here. A repo you add yourself can be named and removed freely. - Branches — each repo's production branch and, if you ship through a staging flow, its merge chain (the same model as the Multi-Repo card in Project Settings)
One folder can ship more than one thing. A React Native codebase that also builds for the browser is a single package with two targets (Mobile and Web App), and Trinity detects that from the cross-platform library in your dependencies. Going the other way, an internal workspace package that other packages depend on but never ships on its own — a shared library, a common utils folder — can still turn up from the scan with no targets attached: it has its own dependencies and its own .env, but nothing to release yet. That's editable, not final: add a target to it (Library is the usual fit for shared internal code), drag an existing target onto it with the package dropdown, or remove the package if it shouldn't be tracked at all. Every package needs at least one target before you can continue — the review step flags any package still shipping nothing, and Trinity won't apply the import until it's resolved.
If the scan finds that your agent guidance needs a split, the review shows Agent guidance needs a split above the risks, even when there are none. Each row names what it found and the file: rules for a topic written into the AGENTS.md itself, a description of the code, a CLAUDE.md holding more than a pointer to AGENTS.md, or one rule written in two files. Every story loads the whole of this guidance, so what does not belong in it costs every story. The notice blocks nothing, and the text between Trinity's markers is never counted. Once the project is imported, Agent Guidance in Project Settings can open a pull request that splits it.
Give each target a clear label — so a project with two mobile apps reads as "Mobile (Client)" and "Mobile (Driver)" rather than one ambiguous entry.
Monorepos and turborepos: workspace members are packages, not repos. Keep one repo entry; list apps/web, packages/ui, and the rest as packages. Trinity keeps the folder paths exactly as it found them, so nothing moves on disk.
Polyrepo projects: package → repo mapping. When the structure is polyrepo, each package shows which repo it lives in. Trinity's analyzer picks a best guess (matching the folder against repo contents), but the mapping is editable — if Trinity put the core package in the web repo by mistake, pick the right repo from the dropdown. Targets follow their package, so you only place each folder once. Paths are normalized to the canonical path model (repo.path + package.path) on save — a target locates through the package it ships from — so downstream planning and execution agents know exactly where to look.
Read-only dependencies. Each repo row carries a Managed / Read-only dep toggle. Use Read-only dep for upstream forks, vendored libraries, or any repo you don't have write access to — Trinity still clones it into the workspace so agents can read it, but it won't branch, commit, open PRs, merge, or tag it. Use Managed (the default) for every repo Trinity should drive end-to-end. You can change this later in Project Settings if you mis-classify a repo.
You can edit any field the AI got wrong. This is your chance to correct misinterpretations before they propagate into the project configuration.
Step 4: Docs
The Docs writer writes four starter pages for each package in your project, from the scan results and from the package's own AGENTS.md, README, docs/ and .agents/ folders:
- Architecture — how the package is built and how its pieces fit together
- Tech stack — the technologies it uses
- Features — what it ships, as the person using it sees it
- Setup and development — how to install, run, test and build it
The step lists each package with its four pages. Each page appears as it finishes, and you can refine any of them before moving on. A page that fails to generate is marked Failed and the other pages still stand; ask the import agent to regenerate it. The step starts nothing itself, so it also says when the Docs writer has not run yet.
A package that already has a .trinity/docs/ folder, from an earlier import of the same repo, is marked Existing docs kept: Trinity leaves that folder as it is and writes no starter pages for it.
Step 5: Report
The Report gathers what the Scanner flagged into one list you can pick from. It does not find anything new: the risks are the ones the Repos step already shows, and the Quality gaps and Overlaps with Trinity appear only here. Each row has a checkbox, grouped under Risks, Quality gaps and Overlaps with Trinity, and every high-severity risk and every overlap starts ticked. An overlap is tooling in your repo that does a job Trinity does, such as merge-gate scripts, worktree setup, per-pull-request CI, release scripts or agent orchestration, and its row says what Trinity does instead. For CI the row recommends narrowing it to the final merge and shows the replacement file on the row, so you can read it before you apply. Tick what you want to carry forward: a ticked overlap is removed in the starter-docs pull request when you apply (see Starter docs pull requests), and the ticked risks, quality gaps and overlaps go to the Architect as its first brief; your ticks are saved with the import as you make them, so they are still there when you come back.
Continuing without touching anything keeps the defaults and changes nothing else about the import. After you have applied, the report card stays on the thread, read-only, with your choices as you left them.
Step 6: Apply
Apply waits while any of the import agent's helpers is still running, and says which.
Apply is the one approval that lands everything you staged. It stays disabled, with the reason shown, until at least one repo, one package and one target is staged, and the business details are not being extracted. Trinity then runs these steps in order and shows what each one did (done, failed, or nothing to do):
- Repos, packages and targets are created
- Per-repo branch settings and staging targets are saved
- Project settings are updated, and the tools the scan found your project needs set up are saved
- Packages, targets and builds are synced from the structure your repos declare, where they declare one
- The project's
AGENTS.mdis seeded - The starter docs are opened as pull requests
- Setup is stamped complete
If a step fails, Apply stops there and the card shows where. The tool setup, the structure sync and the starter docs are the exceptions: a failure in any of them is reported and the rest carries on, since your project has already been imported. Apply again runs the whole sequence once more, safely: it reconciles to what you staged and the final stamp is applied once. The details of what Apply does:
- Project configuration is updated with scan results
- The workspace trunk gets an
AGENTS.mdthat lists every repo, every package in it, and where each package's documentation starts (.trinity/docs/index.mdinside the package). Trinity's own skills materialize into every story worktree when it is created, and your repos' own skills, commands and hooks stay in the repos - Nothing is committed to your repos' branches directly. Each repo whose packages got starter pages gets one pull request, Add Trinity starter docs, into its dev branch (see Starter docs pull requests)
- A repo without a starter-docs pull request gets its
AGENTS.mdsections pointing at its documentation when the first story that works in that repo runs, committed with the story's work (see Routing sections in your AGENTS.md) - Only the tools the scan found your project needs set up, a command-line tool to install or a service that needs keys, are saved, scoped to each package, so they show up in the project's requirements and in setup. The rest of the technologies the scan saw are not saved: your project's stack comes from its repo and from the stories you build
Starter docs pull requests
For each repo, Trinity opens one pull request from the branch trinity/starter-docs into the repo's dev branch. It carries each package's starter pages in that package's .trinity/docs/ folder, an index.md linking them, and the repo's AGENTS.md sections pointing at that index. It is committed and opened as you, with the account you connected for that repo's host.
- Your repo's checkout in Trinity is left exactly as it was; the pull request is made on a separate branch.
- If Trinity cannot work out which account and commit email to use for the repo's host, it writes nothing for that repo, and the Apply card says which one is missing.
- If a
trinity/starter-docsbranch from an earlier import is still on the remote, Trinity writes nothing new for that repo and leaves that branch as it is. The Apply card links its open pull request, or says the branch has none and can be deleted. - If the repo has no dev branch yet, Trinity creates it from your production branch first, so the pull request has a branch to target. If it can't create the branch, it writes nothing for that repo and the Apply card says why.
- A package whose pages fail Trinity's documentation check is left out of the pull request and listed with what the check found; the repo's other packages are still included.
- If the repo's
.gitignoreholds a Trinity block that ignores.trinity/, the pull request removes that block so the docs can be committed. Every other line stays as it is. - The tooling you left ticked under Overlaps with Trinity is part of the same pull request: the files are deleted, and a narrowed CI file is replaced by the file the report showed. The description lists each removal with what Trinity does instead. Nothing is removed that you did not tick, and a repo with tooling to retire but no pages to add still gets its pull request. A file that is no longer on the dev branch is left out of the list.
- If a rule of your own ignores
.trinity/, Trinity writes nothing for that repo, and the Apply card names a file the rule hides. Remove the rule, and the docs can land.
Routing sections in your AGENTS.md
Trinity writes one section into the AGENTS.md at the workspace trunk, at each repo root and in each package folder, so an agent working anywhere reaches the documentation for the code it is in. The section sits between two markers, <!-- TRINITY-MANAGED-START --> and <!-- TRINITY-MANAGED-END -->:
- Trinity rewrites only what is between the markers. The workspace trunk's section follows your packages as soon as they change (an import, a package added, moved or merged into another repo); a repo's or package's section follows the next time a story works in that repo, and is committed with that story's work. A story that changes nothing else in a repo leaves the section out of it, so it never opens a change for the section alone. Everything else in the file is yours and stays exactly as you wrote it, however long it is.
- A repo or package with no
AGENTS.mdgets one holding just the section, and aCLAUDE.mdpointing at it if it has none. - Your repo's own
docs/and.agents/folders are never touched.
After you apply
The Apply card confirms the import succeeded. The import is finished now (Trinity only ends setup once the import has actually been applied): Import leaves the sidebar, Architect takes its place, and opening the project lands on its dashboard. The import thread stays readable, and its Apply card keeps the record: what each step did, and each repo's starter docs, a link to its pull request or why no docs were written for it. The import agent then opens an Architect thread with a brief of what came in and the risks, quality gaps and overlaps you ticked in the report, and lists the import thread under Related. The Apply card shows each build's gate config and gives you one shortcut:
- Gate config — each build's proposed commands and domains, with Confirm and Edit. Confirming means a story runs only the tests its change touches; until you confirm, it runs the full suite. The rules and map check sit behind a fold. A build with no proposal says its stories run the full suite and offers Set up, which opens Project settings → Gate.
- Create first plan — jumps straight into Architect, which auto-creates your first release and fills it with its plan
Tips for Importing
- Your original repo is untouched — Trinity clones from the remote URL into its own workspace (the
projectsfolder of your storage location (~/.trinityunless you changed it)). All execution, branching, and worktree operations happen in Trinity's copy. - Push before importing — Trinity clones from the GitHub remote, so only what is pushed comes in. The agent tells you what is not pushed (commits ahead of the remote, branches with no remote, changed files) before it clones, and Local work keeps the list. Push them, or they won't be in the project.
- Clean git state — make sure your working tree is clean before scanning. Uncommitted changes won't cause problems, but a clean state gives the most accurate scan.
- Use the Files step to keep the workspace tidy — exclude large build outputs, local databases, or any
data/dump you don't want Trinity snapshotting. Exclusions stick; what you skip here never lands in the workspace asset store. - Check the review step carefully — the AI interpretation is usually good but can misidentify packages or targets. Corrections here save time later. Worth a second look in a workspace: whether a shared internal package needs a Library target added (or should be dropped from the import), and whether a cross-platform app got both of its targets.
- Set up secrets after importing — the import flow doesn't collect secrets. If your project needs API keys to build or test, add them from Project Settings → Secrets before your first run to prevent runs waiting on you for them later.
- Confirm the proposed gate — for each package where Trinity can read its test and lint commands and its feature folders, the import saves a proposed gate configuration. It waits for your Confirm, on the finished import card or in Project settings → Gate, and nothing uses it until you do. Until a build has a gate config, its stories run the full test suite.
- Review generated docs — the starter pages are AI-generated summaries. They're good starting points, and the pull request is the place to correct them before they reach your dev branch.