Skip to content

The open-source app everyone uses to manage agents at work

docs: track chat channel rules and Greptile configuration (#16172)

Dotta7ac0354b5166
diff --git a/.greptile/README.md b/.greptile/README.md
new file mode 100644
index 0000000000..0065727039
--- /dev/null
+++ b/.greptile/README.md
@@ -0,0 +1,71 @@
+# Greptile configuration
+
+This directory tracks the supported review configuration for
+`paperclipai/paperclip`. It was prepared from a read-only dashboard inventory
+on 2026-10-13. No dashboard settings or custom context were changed.
+
+- `config.json` records the observed review settings supported by Greptile's
+ documented file schema.
+- `files.json` loads repository context and scopes architectural rule files.
+- `rules.md` explains how to apply the canonical Markdown rules in `rules/`.
+
+## Settings migrated to Git
+
+| Dashboard setting | Repository configuration |
+| --- | --- |
+| Automatic reviews on all events | `autoReview: ["open", "push", "rebase"]` |
+| Exclude `dependabot[bot]`; remaining reviews use Base | `excludeAuthors`, `effort: "base"` |
+| High strictness (dashboard says it does not comment on P2s) | `strictness: 3` |
+| Do not replace the PR description | `shouldUpdateDescription: false` |
+| Include PR summary, confidence score, and findings; no sequence diagram | The four section settings in `config.json` |
+| Summary is not collapsible; default-open option is off | `summarySection.collapsible` and `defaultOpen` are `false` |
+| Include a prompt to fix findings | `fixWithAI: true` |
+| Status checks and status comments enabled | `statusCheck` and `statusCommentsEnabled` are `true` |
+| Auto-approval disabled; stored risk ceiling is Low | `autoApprove.enabled: false`, `riskCeiling: "low"` |
+
+The existing PR-description and 1,000-line growth guidance is in
+`rules/pull-request-review.mdc`. That file also preserves the active,
+repository-specific rule not to request UI screenshots. This resolves the
+contradiction with the older organization instruction asking for screenshots.
+
+The active dashboard pattern `**/[Aa][Gg][Ee][Nn][Tt][Ss].md` reported two files:
+`AGENTS.md` and `docs/api/agents.md`. Both are explicit references in
+`files.json`; the latter remains API context, not contributor policy. Future
+context files need explicit manifest entries. The inactive Contribution
+guidelines context remains inactive; it is not added as a separate context
+file. Rules scoped to other repositories are not copied here.
+
+## Settings still managed in Greptile
+
+The following observed controls do not have equivalents in the published
+`.greptile/` schema used for this migration. They remain dashboard settings:
+
+- Review draft pull requests: enabled.
+- Required confidence to pass the status check: 5/5.
+- Image badges: enabled.
+- Comment header: empty.
+- Default coding-agent badges: no agents shown.
+
+Repository enablement, provider authentication, billing, integrations, and
+learned memory also remain service settings. Auto-approval risk instructions,
+if used later, are explicitly dashboard-only in Greptile's reference. Do not
+invent config keys for unsupported controls.
+
+## Cutover and maintenance
+
+Greptile reads committed configuration from the reviewed branch. No reindex is
+required. Local changes alone are not visible to the hosted reviewer.
+
+File-based review settings override dashboard defaults, but dashboard rules
+and instructions are additive. The existing dashboard copies are still active.
+This is a staged migration, not a completed dashboard cleanup. After a hosted
+review verifies the configuration, an authorized maintainer can retire duplicate
+dashboard context scoped to this repository. Do not remove shared organization
+instructions while other repositories still depend on them.
+
+Keep each policy's body in `rules/`; update the `files.json` scope together with
+the rule's MDC frontmatter. The chat-channel rule includes both the directory
+and its sibling service entry point. See `rules/README.md` for authoring steps.
+
+References: [configuration and precedence](https://www.greptile.com/docs/code-review/greptile-config),
+[supported fields and file references](https://www.greptile.com/docs/code-review/greptile-config-reference).
diff --git a/.greptile/config.json b/.greptile/config.json
new file mode 100644
index 0000000000..696d62f3cc
--- /dev/null
+++ b/.greptile/config.json
@@ -0,0 +1,28 @@
+{
+ "autoReview": ["open", "push", "rebase"],
+ "excludeAuthors": ["dependabot[bot]"],
+ "effort": "base",
+ "strictness": 3,
+ "shouldUpdateDescription": false,
+ "summarySection": {
+ "included": true,
+ "collapsible": false,
+ "defaultOpen": false
+ },
+ "confidenceScoreSection": {
+ "included": true
+ },
+ "issuesTableSection": {
+ "included": true
+ },
+ "sequenceDiagramSection": {
+ "included": false
+ },
+ "fixWithAI": true,
+ "statusCheck": true,
+ "statusCommentsEnabled": true,
+ "autoApprove": {
+ "enabled": false,
+ "riskCeiling": "low"
+ }
+}
diff --git a/.greptile/files.json b/.greptile/files.json
new file mode 100644
index 0000000000..3738fce829
--- /dev/null
+++ b/.greptile/files.json
@@ -0,0 +1,24 @@
+{
+ "files": [
+ {
+ "path": "AGENTS.md",
+ "description": "Repository contributor instructions and routing to scoped architecture rules."
+ },
+ {
+ "path": "docs/api/agents.md",
+ "description": "Agent API documentation retained from the existing Greptile agent-file context. This is API reference material, not contributor instructions."
+ },
+ {
+ "path": "rules/pull-request-review.mdc",
+ "description": "Existing Paperclip review guidance for PR descriptions, UI evidence, and growth of large source files."
+ },
+ {
+ "path": "rules/chat-channel-platform-boundaries.mdc",
+ "description": "Architecture requirements and review criteria for separating chat channel platform implementations from shared orchestration.",
+ "scope": [
+ "server/src/services/chat-channels/**",
+ "server/src/services/chat-channels.ts"
+ ]
+ }
+ ]
+}
diff --git a/.greptile/rules.md b/.greptile/rules.md
new file mode 100644
index 0000000000..f6b4ff9cf8
--- /dev/null
+++ b/.greptile/rules.md
@@ -0,0 +1,12 @@
+# Repository rule loading
+
+The `.mdc` files under `rules/` are repository review requirements.
+`.greptile/files.json` identifies the rule files to read for matching source
+paths. Read their full Markdown bodies and apply their review criteria and
+allowed exceptions to the affected code.
+
+Each rule's YAML frontmatter declares its scope with repository-relative
+`globs`, or `alwaysApply: true` for a repository-wide rule. Respect that scope;
+do not apply a channel rule to unrelated subsystems. Keep the policy in the
+referenced file as the source of truth rather than maintaining a separate copy
+in dashboard instructions.
diff --git a/AGENTS.md b/AGENTS.md
index c7b53d20d4..c6b67349dc 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -26,6 +26,20 @@ authoring runbook for provider research, supported transport/auth patterns,
credential handling, branding, implementation, testing, live proof, and PR
submission.
+### Scoped repository rules
+
+Before editing or reviewing files, read the matching rules in `rules/*.mdc`.
+Each rule has Markdown content and YAML frontmatter: `globs` contains
+comma-separated, repository-relative file patterns, and `alwaysApply: true`
+means the rule applies throughout the repository. Read all rules whose scope
+matches the affected files. These rules supplement this file and any applicable
+nested `AGENTS.md` instructions.
+
+For `server/src/services/chat-channels.ts` and everything under
+`server/src/services/chat-channels/`, read
+[`rules/chat-channel-platform-boundaries.mdc`](rules/chat-channel-platform-boundaries.mdc).
+See [`rules/README.md`](rules/README.md) for rule authoring and Greptile setup.
+
## 3. Repo Map
- `server/`: Express REST API and orchestration services
diff --git a/rules/README.md b/rules/README.md
new file mode 100644
index 0000000000..2e7edf1d70
--- /dev/null
+++ b/rules/README.md
@@ -0,0 +1,31 @@
+# Repository rules
+
+Keep architectural guidance in focused `.mdc` files here. Each file is Markdown
+with YAML frontmatter containing a `description` and an `alwaysApply` boolean.
+For scoped rules, set `alwaysApply: false` and provide comma-separated,
+repository-relative `globs`. For repository-wide rules, set `alwaysApply: true`
+and omit `globs`. Use `**` for all descendants of a directory. Include sibling
+entry points explicitly when needed.
+
+Root `AGENTS.md` tells coding agents to read matching rules before editing or
+reviewing code. This directory is a repository convention: Cursor does not
+automatically load it as `.cursor/rules/`, and the `.mdc` extension alone does not
+make a tool apply a rule.
+
+Greptile reads matching rule files through `.greptile/files.json` and receives
+loading instructions from `.greptile/rules.md`. The rule body remains here as
+the single source of truth. Repository configuration takes effect when the
+files are available on the reviewed branch; local files alone are not visible
+to the hosted reviewer.
+
+When adding or changing a rule:
+
+1. State the scope, required behavior, examples, exceptions, and review criteria.
+2. Add its path to `.greptile/files.json`. Copy its `globs` into that entry's
+ `scope` array, one pattern per element. For `alwaysApply: true`, omit `scope`.
+3. Keep the rule's frontmatter and the Greptile scope synchronized. Verify that
+ the scope covers representative files and excludes unrelated directories.
+4. Keep detailed policy in the rule file instead of copying it into tool settings.
+
+See the [Greptile file-reference documentation](https://www.greptile.com/docs/code-review/greptile-config-reference)
+for the manifest format.
diff --git a/rules/chat-channel-platform-boundaries.mdc b/rules/chat-channel-platform-boundaries.mdc
new file mode 100644
index 0000000000..3fa3e6a2a6
--- /dev/null
+++ b/rules/chat-channel-platform-boundaries.mdc
@@ -0,0 +1,60 @@
+---
+description: Keep chat channel platform implementations in their own folders and shared orchestration independent of platform details.
+globs: "server/src/services/chat-channels/**,server/src/services/chat-channels.ts"
+alwaysApply: false
+---
+
+# Chat channel platform boundaries
+
+## Scope and purpose
+
+This rule applies to `server/src/services/chat-channels/` and its sibling
+`server/src/services/chat-channels.ts` service entry point. Keep each platform's
+implementation cohesive while letting common workflows support different
+platforms through explicit contracts.
+
+## Required structure
+
+- Put platform-specific code in `chat-channels/<platform>/`. This includes
+ payload parsing, SDK and transport calls, protocol details, credential and
+ setup behavior, message formatting, and platform-specific workarounds.
+- Use the existing platform directories, such as `telegram/`, `slack/`,
+ `discord/`, `github/`, `microsoft-teams/`, and `imessage-photon/`. Organize files
+ within each directory by responsibility, such as `messages.ts` or `setup.ts`.
+- Keep shared product behavior in the service or cohesive workflow modules,
+ such as `inbound/`, `interactions/`, and `publications/`. Shared code owns common
+ company isolation, authorization, task lifecycle, ordering, and persistence
+ invariants. Provider details must not bypass those invariants.
+- Use explicit typed inputs, outputs, capabilities, or callbacks at the boundary.
+ Shared workflows should consume normalized values rather than interpret one
+ platform's raw payloads. Pass the dependencies a module needs instead of a
+ large mutable service context.
+- Reuse existing contracts and shared implementations when their behavior is
+ actually common. Preserve meaningful platform differences. Add a new
+ abstraction only when a concrete workflow needs it.
+- When extracting code, preserve transaction ownership, queue ordering,
+ idempotency, runtime state lifetime, and callback timing. Moving code must not
+ create duplicate state or a second owner for a side effect.
+
+## Examples and allowed exceptions
+
+- Telegram edited-message parsing belongs in `telegram/messages.ts`; a shared
+ delivery workflow can consume its normalized message or lifecycle event.
+- Shared orchestration may import platform modules and select an implementation
+ by provider name. Small registration tables and dispatch branches are valid;
+ the selected branch should delegate protocol behavior to the platform module.
+- Keep behavior used by several platforms in a shared module when its inputs and
+ semantics are independent of those platforms. Do not make one platform import
+ another platform's implementation merely to reuse a helper.
+- Existing code outside these boundaries can be migrated incrementally. Apply
+ the rule to new or materially changed behavior; an unrelated fix does not
+ require moving the whole subsystem.
+
+## Review criteria
+
+Flag new or expanded platform-specific implementation in the service entry
+point or shared workflow modules, direct dependencies between unrelated
+platform implementations, and shared contracts that expose a platform's raw
+payload or SDK types. Identify the behavior and the appropriate owning folder.
+Allow the registration and dispatch exceptions above, and do not request an
+abstract provider framework solely to remove a small dispatch branch.
diff --git a/rules/pull-request-review.mdc b/rules/pull-request-review.mdc
new file mode 100644
index 0000000000..1ba08c9631
--- /dev/null
+++ b/rules/pull-request-review.mdc
@@ -0,0 +1,22 @@
+---
+description: Existing Paperclip pull request review requirements migrated from Greptile settings.
+alwaysApply: true
+---
+
+# Pull request review
+
+This rule applies when reviewing pull requests throughout this repository.
+
+- Follow the PR description guide in `CONTRIBUTING.md` and the sections in
+ `.github/PULL_REQUEST_TEMPLATE.md`. Request missing thinking paths and missing
+ explanations of what changed, why it matters, the benefits, verification, or
+ risks.
+- Do not request UI screenshots in PR reviews for this repository. Visual state
+ verification is described through component tests, enumeration of states in
+ the PR description, and use of existing design tokens. This repository rule
+ takes precedence over the older organization instruction to request
+ screenshots for visual changes.
+- When a PR grows a source file from fewer than 1,000 lines to more than 1,000
+ lines, require a concrete reason for keeping the implementation together.
+ Flag an unexplained crossing and suggest a cohesive extraction. This check
+ does not require unrelated cleanup of every existing large file.