Skip to content

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

Open
ArnabChatterjee20k wants to merge 17 commits into
feat/pr-conversation-commentsfrom
feat/custom-agents-md-instructions-per-repo-or-global
Open

Feat/custom agents md instructions per repo or global#142
ArnabChatterjee20k wants to merge 17 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, persists them in SQLite, injects them into agent contexts, and exposes administrative editors.

  • Adds instruction types, storage APIs, schema migration, and authenticated HTTP endpoints.
  • Applies resolved instructions across fix, QA, verification, and reply workflows.
  • Adds global and per-repository dashboard editors with explicit error and concurrent-edit handling.

Confidence Score: 4/5

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

The instruction helper catches storage failures and returns the unmodified context, so any affected run continues without the configured global or repository behavior.

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

Important Files Changed

Filename Overview
crates/claudear-engine/src/processing.rs Adds instruction injection across agent workflows, but resolution errors still execute runs without configured operator constraints.
crates/claudear-storage/src/sqlite.rs Implements scoped instruction persistence and deterministic global-plus-repository resolution.
crates/claudear-engine/src/api/routes.rs Adds admin-protected endpoints for reading and updating global and repository instructions.
dashboard/src/pages/config.tsx Adds the global instruction editor and resolves the previously reported load, save, revalidation, and concurrent-edit state failures.
dashboard/src/pages/repos.tsx Adds the repository instruction editor while preserving newer in-flight edits and isolating cache updates by repository.
migrations/V10__agent_instructions.sql Adds the instruction table and enforces one row per global or repository scope.

Reviews (8): 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
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.
@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
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.
Comment on lines +403 to +404
setSaved(true)
setTimeout(() => setSaved(false), 3000)

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 Newer draft falsely marked saved

When an administrator continues typing while the PUT is in flight, save completion preserves the newer draft but unconditionally sets saved to true. The editor consequently displays “Saved” and suppresses “Unsaved changes” for text that was never persisted; the repository editor repeats the same transition.

Prompt To Fix With AI
This is a comment left during a code review.
Path: dashboard/src/pages/config.tsx
Line: 403-404

Comment:
**Newer draft falsely marked saved**

When an administrator continues typing while the PUT is in flight, save completion preserves the newer draft but unconditionally sets `saved` to true. The editor consequently displays “Saved” and suppresses “Unsaved changes” for text that was never persisted; the repository editor repeats the same transition.

---

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

its fixed

Gate the Saved indicator on !dirty so edits typed during the PUT surface as Unsaved changes instead of a false Saved.
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