Skip to content

Feat/custom agents md instructions per repo or global - #142

Merged
ArnabChatterjee20k merged 15 commits into
feat/pr-conversation-commentsfrom
feat/custom-agents-md-instructions-per-repo-or-global
Aug 25, 2026
Merged

Feat/custom agents md instructions per repo or global#142
ArnabChatterjee20k merged 15 commits into
feat/pr-conversation-commentsfrom
feat/custom-agents-md-instructions-per-repo-or-global

Conversation

@ArnabChatterjee20k

Copy link
Copy Markdown
Member

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@greptile-apps

greptile-apps Bot commented Aug 16, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds global and repository-scoped operator instructions that are persisted in SQLite, administered through protected API and dashboard controls, and prepended to agent contexts.

  • Adds the instruction scope and persisted instruction model.
  • Registers the V10 schema migration and SQLite read, write, and resolution operations.
  • Adds administrative API endpoints and dashboard editors for global and per-repository instructions.
  • Applies resolved instructions across fix, question, verification, and reply agent paths.

Confidence Score: 4/5

The PR is not yet safe to merge because instruction-storage failures still let agent runs proceed without required operator constraints.

The instruction resolver’s error branch returns the unmodified context, leaving the previously reported constraint-bypass behavior reachable whenever SQLite instruction lookup fails.

Files Needing Attention: crates/claudear-engine/src/processing.rs

Important Files Changed

Filename Overview
crates/claudear-engine/src/processing.rs Prepends resolved operator instructions across agent execution paths, while retaining fail-open behavior when instruction lookup fails.
crates/claudear-storage/src/sqlite.rs Implements scoped instruction upserts, reads, combined resolution, and focused storage tests.
crates/claudear-engine/src/api/routes.rs Adds administrator-protected global and repository instruction read/write endpoints.
dashboard/src/pages/config.tsx Adds a global instruction editor with visible load/save errors and draft-preserving save behavior.
dashboard/src/pages/repos.tsx Adds the equivalent repository-scoped instruction editor to repository details.
migrations/V10__agent_instructions.sql Adds the scoped instruction table and singleton-per-scope uniqueness index.

Reviews (9): Last reviewed commit: "fix(dashboard): don't show Saved for unp..." | Re-trigger Greptile

Comment thread crates/claudear-engine/src/processing.rs Outdated
Comment thread dashboard/src/pages/config.tsx
Comment thread dashboard/src/pages/config.tsx Outdated
@ArnabChatterjee20k
ArnabChatterjee20k force-pushed the feat/custom-agents-md-instructions-per-repo-or-global branch from b38c248 to 862e212 Compare August 16, 2026 10:06
format!("{block}\n\n{context}")
}
}
_ => context,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Instruction lookup failures bypass constraints

When instruction resolution returns a storage error, this catch-all arm continues with the original context, causing the agent to run without configured operator constraints and without surfacing the failure.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/claudear-engine/src/processing.rs
Line: 2810

Comment:
**Instruction lookup failures bypass constraints**

When instruction resolution returns a storage error, this catch-all arm continues with the original context, causing the agent to run without configured operator constraints and without surfacing the failure.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

Comment thread dashboard/src/pages/config.tsx Outdated
@ArnabChatterjee20k
ArnabChatterjee20k force-pushed the feat/custom-agents-md-instructions-per-repo-or-global branch from 862e212 to 6ad97e3 Compare August 16, 2026 10:17
Comment thread dashboard/src/pages/config.tsx Outdated
Comment thread dashboard/src/pages/config.tsx
Global and per-repo operator instruction storage. Register V10 and update migrator test to v10.
Scope-namespaced upsert and getters plus resolve_agent_instructions which concatenates global then per-repo. Wired through KnowledgeStore.
prepend_operator_instructions applied on the fix, red, verify and reply paths. Prompt-string only, never touches repo files.
Global instructions apply even with no resolved repo. Per-repo header only when a repo is present.
Drop the early return that skipped global instructions when the repo was unresolved, and inject on the QA answer path.
Disable editing on a failed load to avoid overwriting, and show save failures instead of silently swallowing them.
Separate the PUT from cache revalidation. On success, optimistically sync the cache with revalidate:false so a failed background GET no longer reports a failed save, keeps the draft dirty, or blanks the editor.
Warn on a storage error instead of silently continuing, so a failed instruction resolution is visible while still failing open.
Capture the saved value and only clear the draft when it is unchanged, so edits typed during the PUT are not discarded.
Gate the Saved indicator on !dirty so edits typed during the PUT surface as Unsaved changes instead of a false Saved.
@abnegate
abnegate force-pushed the feat/custom-agents-md-instructions-per-repo-or-global branch from 5707415 to b096ce0 Compare August 25, 2026 11:12
@ArnabChatterjee20k
ArnabChatterjee20k merged commit 8c75611 into main Aug 25, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant