When an agent writes most of the code, the question is whether it still has the structure you intended. The Architecture tab answers that without digging through files. It shows the structure CodeLynq reads from the code itself, and it puts your intended architecture next to it.
The map
Open the project and go to the Architecture tab. The map shows your code and the dependencies inside it. An arrow points from code that imports something to the code it uses. A thicker arrow stands for more imports.
- Components: once you have named the parts of your architecture (see below), the map starts here, with one box per component.
- Folders: one box per folder or file in the current folder. Folders and files outside it that it depends on, or that depend on it, appear as dashed boxes.
- Classes: double-click a file to see what it declares (classes, interfaces, enums, functions), UML-style, with inheritance.
Click a box to see what it contains, what it depends on and what uses it. Click an arrow to see the imports behind it. Double-click a box to zoom in, and use the path above the map to zoom out. Find a file or class jumps straight to it. Tests are hidden by default.
CodeLynq reads Python, JavaScript, TypeScript, Go, Java, C# and PHP. It reads imports and declarations exactly, as they are written. Dependencies that only exist at runtime, such as dependency injection or dynamic calls, are not shown.
One UML diagram for the whole project
UML shows every repository of the project in one class diagram, like the one you would draw on a whiteboard:
- each repository is a frame, with a coloured frame per package: its components, or its top-level folders if you have not named components;
- each class, interface, enum, struct or record shows its fields and methods with their types;
- the lines are UML's: a solid line with a hollow triangle for extends, a dashed one for implements, an open arrow for an association (a field of that type,
*for a collection) and a dashed open arrow for a dependency (used in a method's signature); - a thick purple dashed line means one repository imports another by its package name.
A real codebase has hundreds of classes, so each package shows its most connected ones. Choose Classes per package, pick Packages or repositories, and set Members to keep the diagram readable. Click a class to see its members and relations, and Open in the map to jump to its file. PlantUML and Mermaid download the diagram as text, to keep in your repository or render in your own tools.
A repository appears once it has a map. The diagram is redrawn from the latest maps every time you open it, so it stays current as runs change the code.
Always up to date
You never draw the map. CodeLynq makes a new one:
- at the start of every run, from the code the run starts from;
- when a pull request is merged into the default branch;
- every night, when the default branch has changed;
- when you click Refresh.
For an organization on self-hosted runners, CodeLynq never clones the repository: the runner makes the map at the start of every run and sends its structure, so the merge, nightly and Refresh updates do not apply.
History lists every map of the default branch. Pick an earlier one to see what changed since: new dependencies between components, new classes, new files and new external packages.
Components and rules
The map shows what the code is. Under Components and rules you record what it should be:
- A component is a part of your architecture, such as API, Domain or Persistence, defined by the paths it covers. A path is a folder (
backend/app/domain) or a pattern (src/**/ui). A file belongs to the component with the most specific matching path. - A rule says one component must not depend on another, for example Domain must not depend on Persistence. Tests are exempt.
Click Propose from the code to have CodeLynq suggest components and rules based on the folders and the dependencies between them. The proposal shows how often each rule is broken today. Nothing is saved until you review the proposal and click Save. Each rule also shows whether it is respected today.
You can also add a rule from the map: in the Components view, click an arrow between two components and choose Forbid this dependency.
Only organization admins and the project owner can change components and rules. Everyone in the organization can see them.
What runs do with it
Every run gets the components and rules along with its instructions. After the agent has made its change, CodeLynq maps the code again and compares it with the map from before the run. On runs decides what happens next:
- Fix: if the change adds a dependency that breaks a rule, the run goes back to the agent to restructure it. The tests run again after each attempt. Anything still broken is listed in the pull request.
- Report: broken rules are listed in the pull request. The agent is not asked to fix them.
- Off: rules are shown on the map, but runs do not check them.
Only dependencies the change adds count against it. Existing violations are not the run's doing.
The same check runs when CodeLynq works on review or CI feedback on an open pull request: the pull request as a whole is compared with its target branch, so a broken rule left by the first pass can still be fixed. If one remains, CodeLynq says so in a comment on the pull request.
Runs on a self-hosted runner are checked too, from runner version 2.0.0. The runner reads the structure of the files its agent changed on your machine and sends only that - paths, imports and declared names, never the code.
Every pull request gets a Structure changes section. It lists broken rules, new dependencies between components, new declarations and new external packages. The same section appears on the run's page under Structure changes.
Write a change on the map
You can describe a change to the structure right where you see it, and CodeLynq turns it into a task with a spec.
- Click a component, folder, file, class or arrow and choose Add to change. Add as many parts as the change is about; zooming in and out keeps them. On an arrow, Write a change: remove this dependency adds it with a first sentence written for you.
- Under Write a change, describe what should change and why. Move, Split, Merge, Decouple and Rename give you a sentence to start from.
- Optionally tick Add the rule this change must make true, for example API must not depend on Core. Runs of the task are checked against that rule, even if the repository's checks are off. When all of the task's pull requests are merged, the rule becomes part of the architecture. Only organization admins and the project owner can attach a rule.
- Click Create task and spec. CodeLynq creates a refactor task for the repository with what you wrote, the rule, and the facts of your selection as the code has them today: the files, what they declare, what they depend on and what depends on them. It then drafts the spec with the structure in hand and opens the task. The spec is a draft and goes through the normal review.
If the spec cannot be drafted, for example because the AI provider is unavailable, the task is still created and you can draft the spec on the task page.
Specs drafted for any task also take the structure into account, so their affected components and risks name real files and dependencies.