Skip to content

Commit b505984

Browse files
committed
feat: add cubic.yaml with project-aware AI review agents
Three custom review agents (vision & principles alignment backed by VISION.md, known mechanical caveats, security & testability), PR-contract review instructions, and automatic ultrareviews for auth, credential, encryption and migration changes.
1 parent 6570c9c commit b505984

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Five new engineering docs pages under `docs/7-DEVELOPMENT/`: credentials, content processing, podcasts, prompts, and frontend architecture
1515
- Contribution guidelines for AI-assisted and agent-generated PRs in the contributing guide — the operator owns the PR, issue-first still applies, tests must have actually run
1616
- CI check for broken relative links in markdown (`scripts/check_md_links.py` + `docs-links` workflow on PRs touching `*.md`)
17+
- `cubic.yaml` — AI review settings as code: PR-contract instructions, three custom review agents (vision & principles alignment backed by `VISION.md`, known mechanical caveats, security & testability) and automatic ultrareviews for auth/credential/encryption/migration changes
1718
- Documented the flow-driven release process in `.github/RELEASE_PROCESS.md`, including the `ready` to `main` to stable release path, dev/stable image labels, and maintainer verification checklist (#938)
1819
- List view for the Notebooks page — a tile/list toggle in the header lets you switch between the visual card grid and a compact row layout (name, description, source/note counts, last updated) for easier scanning of large collections. The choice is remembered across reloads and translated across all 14 locales (#885)
1920
- Documented the `ESPERANTO_TTS_TIMEOUT` environment variable (default `300`s) in the environment reference; raise it for slow or self-hosted TTS providers so long podcast segments don't fail with a timeout (#937)

cubic.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# yaml-language-server: $schema=https://cubic.dev/schema/cubic-repository-config.schema.json
2+
#
3+
# cubic AI review settings (settings as code).
4+
# Docs: https://docs.cubic.dev/configure/cubic-yaml
5+
6+
version: 1
7+
8+
reviews:
9+
custom_instructions: |
10+
This project follows an issue-first workflow: every PR should reference an approved,
11+
assigned issue and stay scoped to it. Unrelated refactors belong in separate PRs.
12+
Test evidence must be real (actual output), especially for bug fixes, which should
13+
include a regression test. Many PRs are agent-generated; hold them to the same bar.
14+
Normative rules live in AGENTS.md (root, open_notebook/, frontend/); product direction
15+
lives in VISION.md; past decisions in docs/7-DEVELOPMENT/decisions/.
16+
17+
custom_rules:
18+
- name: Vision & principles alignment
19+
description: |
20+
Check the PR against the product identity and current posture defined in the
21+
linked VISION.md. Flag:
22+
- Features that gratuitously preclude multi-user (hard-coded single-tenancy in
23+
schema, auth, or data scoping) — see PDR-001.
24+
- Capabilities that only work on one AI provider without a PDR justifying the
25+
exclusivity — the core is provider-agnostic by default (PDR-002).
26+
- Features that conflict with the "What Open Notebook IS NOT" list.
27+
- Structural/architectural decisions introduced without a decision record in
28+
docs/7-DEVELOPMENT/decisions/ (half a page, same PR).
29+
file_paths:
30+
- VISION.md
31+
32+
- name: Known caveats
33+
description: |
34+
Enforce this project's recurring mechanical pitfalls (full rules in
35+
open_notebook/AGENTS.md and frontend/AGENTS.md):
36+
- i18n: every user-visible frontend string goes through t('section.key') and the
37+
key must exist in ALL 7 locales (en-US, pt-BR, zh-CN, zh-TW, ja-JP, ru-RU, bn-IN).
38+
- Providers: any change to supported providers must touch all 4 sync points:
39+
api/models.py SupportedProvider, frontend ALL_PROVIDERS,
40+
connection_tester.py TEST_MODELS, credentials_service.py PROVIDER_ENV_CONFIG.
41+
- Migrations: a new open_notebook/database/migrations/N.surrealql file must also be
42+
registered in AsyncMigrationManager (async_migrate.py) — no auto-discovery.
43+
- Graphs: LLM calls in LangGraph nodes must use provision_langchain_model() and wrap
44+
errors with classify_error(); model output goes through clean_thinking_content().
45+
- Domain: Source.save() does not auto-embed — vectorize() must be called explicitly;
46+
RecordModel singletons need clear_instance() in tests.
47+
- Async jobs (podcasts, embeddings, source processing) run on the surreal-commands
48+
worker; features depending on them must not assume inline execution. Permanent
49+
failures raise ValueError (no retry); podcasts use max_attempts=1 by design.
50+
- Frontend: FormData nested fields must be JSON.stringify-ed; don't re-add
51+
Content-Type; check hasHydrated before rendering persisted Zustand state.
52+
53+
- name: Security & testability
54+
description: |
55+
Security:
56+
- API endpoints must never return API key or secret values — metadata only.
57+
- Every user-supplied URL must pass validate_url() (SSRF protection; private IPs are
58+
intentionally allowed for self-hosted services).
59+
- No secrets committed, logged, or echoed in error messages; credential fields use
60+
SecretStr and Fernet encryption (OPEN_NOTEBOOK_ENCRYPTION_KEY).
61+
- Raise typed exceptions from open_notebook.exceptions instead of bare HTTPException
62+
or generic 500s.
63+
Testability:
64+
- Business logic belongs in services/domain, not in routers or React components,
65+
so it can be tested directly.
66+
- Critical paths (auth, credentials, encryption, migrations, data deletion) need
67+
test coverage in the same PR.
68+
- Bug fixes should include a test that reproduces the bug.
69+
70+
auto_ultrareview: custom
71+
auto_ultrareview_custom_prompt: |
72+
Run an ultrareview when the PR touches authentication, credential storage, encryption,
73+
database migrations, or data deletion/cascade logic.
74+
auto_ultrareview_file_patterns:
75+
- 'open_notebook/database/migrations/**'
76+
- '**/credential*'
77+
- '**/auth*'
78+
- '**/encryption*'

0 commit comments

Comments
 (0)