Git Is The Truth: Everything Must Be Possible By Hand
Klok.dev (the admin GUI) should make it easy to create and maintain tenants, data models, integration projects, documentation, and dependencies. But the GUI is a convenience layer on top of Git, not a prerequisite. Everything that can be done through klok.dev must also be possible by updating code and projects in GitLab directly, and the framework must work equally well either way.
This is one of Klok's most important design principles. It applies to the framework, klok.dev, CI/CD pipelines, documentation flows, and every AI agent (Kloker, Claude, IDE agents) working in the ecosystem.
The Principle In Three Sentences
- The Git repository on
mainis the only source of truth for code, data models, the dependency catalog, project metadata, templates, and documentation sources. - Everything klok.dev can do must be possible by hand by creating or changing a repository according to documented conventions, without anything in the platform breaking.
- Nothing may rely on a stale copy of what lives in Git. Caches, database rows, local clones, and graph nodes are derived data that must always be rebuildable from Git and must be refreshed when Git changes, whether the change came from the GUI or from a person in a terminal.
What This Means In Practice
| Scenario | Expected behavior |
|---|---|
Someone updates klok-gradle-dependency-catalog manually and pushes to main. |
The next build in every integration project uses the new catalog. Klok.dev shows the new versions without anyone "syncing" through the GUI. No flow fails because a cached copy of the catalog no longer matches. |
| Someone creates a data model project by hand in the correct GitLab group with the correct template structure. | The project appears in klok.dev under Build → Datamodels, the CI/CD pipeline runs, documentation is generated, and Integration Context is updated. The GUI treats it like any other project. |
| Someone updates an existing integration project manually (new route, changed metadata, new dependency version). | Klok.dev shows the updated state. Generated documentation, the context graph, and any impact analyses are based on the new main, not on what the GUI last wrote there. |
| Klok.dev needs to write to a project (for example, open a merge request from a person's draft). | It writes through the GitLab API, on a branch started from the commit the draft was made on, and opens a merge request; GitLab refuses the push if the branch has moved since. klok.dev holds no clone of any repository. Settings that are not Git's, such as the documentation generation settings, are kept in the ODL instead. |
| An automated flow (documentation, build, context ingestion) starts. | The flow reads its input from Git (or from artifacts CI published from Git), never from a copy klok.dev keeps in the database or in a workspace on disk. |
What Is Truth And What Is Derived
Klok deliberately separates durable truth from derived convenience. See also Ecosystem Overview.
| Truth (may be changed manually) | Derived (must be rebuilt automatically) |
|---|---|
Git repositories on main: code, data models, dependency catalog, templates, .gitlab-project.json, documentation sources |
Klok.dev database project lists, metadata, and thumbnails |
GitLab group structure /<tenant>/integration/..., /<tenant>/datamodel/..., /<tenant>/documentation/... |
The Integration Context Graph |
| Keycloak (identity), Vault (secrets); broker topics and grants as described in Git (the tenants' Pulsar files in klok-environment-setup), which klok.dev and Ansible apply to Pulsar | Generated documentation on docs.klok.dev |
| CI-published artifacts (Maven, npm, context snapshots) | Clones in people's and agents' own workspaces |
| Search indexes, skills indexes, and summaries used by Kloker |
A derived copy may exist for speed and for a coherent UI, but it is always a cache. It must have a known freshness, be rebuildable from Git, and never be the only path to a feature.
Rules For Klok.dev
- Read Git, write Git, through the API. klok.dev reads and writes repositories through the GitLab API and keeps no clone; every write names the commit it starts from, so it never writes on top of a stale copy. A clone in a person's or an agent's workspace is a workspace, not a source. What klok.dev writes, action by action, is on What klok.dev Does In Git.
- The database is a cache. Rows about projects, catalog versions, models, and documentation must be refreshable from GitLab through webhooks, scheduled reconciliation, or a manual refresh action. No feature may require that the row was created by the GUI.
- Discover manually created projects. Reconciliation against the GitLab groups must find repositories that are not in the database and register them. Repositories removed in GitLab must be marked as removed.
- Show freshness. Views built on derived data must show when the data was last fetched and offer a way to refresh it.
- Write in Git, not around Git. Changes that represent a real project change are made as ordinary commits against the right repository, never only in the database. See Publishing And Release Flow.
- Conventions before registries. If a feature needs to know something about a project (type, domain, tenant, template), it must be derivable from the repository content and its location in GitLab, not only from a database flag the GUI set.
Rules For The Framework, Templates, And CI/CD
- The template repositories (
project-template-integration,project-template-datamodel,project-template-documentation) must be complete and documented enough that a person can clone them and create a project by hand. - Builds resolve dependencies against published artifacts and against
mainin the dependency catalog, never against a copy provided by klok.dev. - Pipelines generate documentation and publish Integration Context from what is actually in the repository, so a manually updated project gets correct documentation without manual intervention.
- Every convention klok.dev relies on (file names,
.gitlab-project.json, group structure, naming) must be documented in the guide so it can be followed manually.
Rules For Agents
AI agents (Kloker, Claude, Cursor, Codex, and others) must:
- Start from fresh
mainin Git when analyzing or changing a project. Always fetch before reading or writing. - Never build a feature that makes the GUI the only path. If an agent adds something to klok.dev it must also make sure the same result can be achieved by changing Git, and that klok.dev detects the manual change.
- Never introduce a cache, copy, or database record that lacks a mechanism for refreshing from Git.
- Treat a mismatch between Git and klok.dev as a bug in klok.dev, not as an error by the person who changed Git.
Review Questions
Ask these questions when a new feature, flow, or pipeline is reviewed:
- What happens if someone makes the equivalent change directly in GitLab? Does it show in klok.dev? Do builds and documentation still work?
- Is there a copy of Git content anywhere? How and when is it refreshed? What happens if it is stale?
- Can a project created by hand be used fully, including by Kloker?
- If klok.dev were down, could developers still deliver integrations through Git and CI/CD?
If the answer to any of these is no, the principle has been broken and the feature must not ship until it is fixed.