Skip to content

#10670: Add AGENTS.md for AI coding assistant guidance - #1104

Open
chetankh239 wants to merge 4 commits into
mosip:developfrom
chetankh239:agents-md-doc
Open

#10670: Add AGENTS.md for AI coding assistant guidance#1104
chetankh239 wants to merge 4 commits into
mosip:developfrom
chetankh239:agents-md-doc

Conversation

@chetankh239

@chetankh239 chetankh239 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Addresses mosip/mosip-config#10670 — provides repository overview, tech stack, build/test commands, and contribution notes for AI agents and contributors working in this repo.

Summary by CodeRabbit

  • Documentation
    • Added repository guidance covering architecture, technology stack, development workflows, build and test commands, configuration, secrets handling, and pull request practices.
    • Documented database setup, resets, schema changes, upgrades, rollbacks, backups, and version compatibility requirements.
    • Added Helm deployment guidance covering installation, teardown, configuration, secrets, chart dependencies, linting, and database setup.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Added repository and subsystem-specific AGENTS.md files. The documentation covers architecture, development workflows, database installation and upgrades, Helm deployment, configuration, secrets, CI, and contribution practices.

Changes

Repository Development Guidance

Layer / File(s) Summary
Repository development guidance
AGENTS.md
Documents repository structure, technology, build and test commands, Docker usage, configuration, secrets, CI, development workflows, and pull request practices.
Database installation and upgrade guidance
db_scripts/AGENTS.md, db_upgrade_scripts/AGENTS.md
Documents fresh database setup, schema changes, versioned upgrades, rollbacks, credential handling, failure behavior, and data-safety constraints.
Helm deployment guidance
helm/AGENTS.md
Documents chart structure, installation and teardown, scripts, dependencies, database prerequisites, Keycloak initialization, CI validation, versioning, and secret handling.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Poem

Repository paths now clearly guide,
Database changes have rules beside.
Helm steps and secrets stay in line,
Builds and workflows follow design.
AGENTS.md keeps each checkpoint defined.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding AGENTS.md guidance for AI coding assistants.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Line 90: Update the workflow reference in AGENTS.md to use the complete path
`.github/workflows/chart-lint-publish.yml`, matching the existing fully
qualified references for the other workflows.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 76980e04-74e9-4577-ae2a-978ea62bc33e

📥 Commits

Reviewing files that changed from the base of the PR and between 64ef8a2 and c652ec3.

📒 Files selected for processing (1)
  • AGENTS.md

Comment thread AGENTS.md Outdated
Addresses mosip/mosip-config#10670 — provides repository overview, tech stack,
build/test commands, and contribution notes for AI agents and
contributors working in this repo.

Signed-off-by: Chetan Kumar Hirematha <chetankumar.h.239@gmail.com>
Addresses mosip/mosip-config#10670 — extends
the existing root AGENTS.md into a hub/index and adds per-subfolder
guides matching the tree pattern used in id-repository and
partner-management-services:

- AGENTS.md: added a Guide index table and repository layout tree
  linking to each subfolder guide.
- db_scripts/AGENTS.md: fresh mosip_toolkit DB install (deploy.sh,
  init_db.sh cluster install), schema-change workflow, agent rules.
- db_upgrade_scripts/AGENTS.md: versioned upgrade/rollback SQL
  (upgrade.sh), adding a new version step, agent rules.
- helm/AGENTS.md: compliance-toolkit Helm chart and cluster install
  scripts (install.sh, keycloak-init.sh, restart.sh, delete.sh).

Signed-off-by: Chetan Kumar Hirematha <chetankumar.h.239@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Line 119: Update the schema-change guidance in AGENTS.md so the upgrade and
rollback script requirement applies only when the change must reach an
already-deployed environment; clarify that fresh-install-only changes need the
DDL/DML under db_scripts/mosip_toolkit/ but do not require entries under
db_upgrade_scripts/.

In `@db_scripts/AGENTS.md`:
- Around line 59-60: Document the runtime secret-injection workflow
consistently: in db_scripts/AGENTS.md lines 59-60, replace the instruction to
edit init_values.yaml with using init_db.sh to read the postgres namespace’s
db-common-secrets and inject dbUserPasswords.dbuserPassword via Helm --set; in
db_scripts/AGENTS.md lines 82-82, state that init_db.sh performs the injection
and the placeholder remains unchanged; in AGENTS.md lines 95-95, describe the
--set override instead of requiring local file modification.

In `@db_upgrade_scripts/AGENTS.md`:
- Line 13: Update the CI statement in AGENTS.md to clarify that db-test.yml
validates only db_scripts/**, specifically db_scripts/mosip_toolkit, and does
not validate db_upgrade_scripts/. Remove the implication that both folders are
covered, while retaining guidance to keep them consistent for schema changes.

In `@helm/AGENTS.md`:
- Around line 78-79: Update the guidance in AGENTS.md to distinguish
non-sensitive environment-specific hosts from credentials: hosts may use
values.yaml, --set, or ConfigMaps, but Keycloak and reCAPTCHA secrets must be
stored only in Kubernetes Secrets or an approved external-secret mechanism,
never in --set, values.yaml, or ConfigMaps.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6d619070-0003-49f9-9691-5665345080dc

📥 Commits

Reviewing files that changed from the base of the PR and between c652ec3 and fef87af.

📒 Files selected for processing (4)
  • AGENTS.md
  • db_scripts/AGENTS.md
  • db_upgrade_scripts/AGENTS.md
  • helm/AGENTS.md

Comment thread AGENTS.md Outdated
Comment thread db_scripts/AGENTS.md Outdated
Comment thread db_upgrade_scripts/AGENTS.md Outdated
Comment thread helm/AGENTS.md Outdated
Comment on lines +78 to +79
1. Hardcode environment-specific hosts/secrets into chart templates — pass them via `values.yaml` or `--set`/ConfigMap, as `install.sh` and `keycloak-init.sh` already do.
2. Commit real reCAPTCHA keys or Keycloak client secrets — `keycloak-init.sh` prompts for them interactively and stores them as Kubernetes Secrets, not in this repo.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Keep secrets out of --set, values.yaml, and ConfigMaps.

Line 78 groups non-sensitive hosts and secrets under the same delivery mechanisms. --set values can appear in process arguments or Helm release metadata, and ConfigMaps are not secret stores. Store credentials only in Kubernetes Secrets or an approved external-secret mechanism. This protects Keycloak and reCAPTCHA credentials and supports MOSIP security compliance.

Proposed documentation fix
- Hardcode environment-specific hosts/secrets into chart templates — pass them via `values.yaml` or `--set`/ConfigMap, as `install.sh` and `keycloak-init.sh` already do.
+ Do not hardcode environment-specific hosts into chart templates. Pass non-sensitive hosts through `values.yaml`, `--set`, or ConfigMaps. Store credentials only in Kubernetes Secrets or an approved external-secret mechanism; do not commit them to `values.yaml`, pass them with `--set`, or store them in ConfigMaps.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@helm/AGENTS.md` around lines 78 - 79, Update the guidance in AGENTS.md to
distinguish non-sensitive environment-specific hosts from credentials: hosts may
use values.yaml, --set, or ConfigMaps, but Keycloak and reCAPTCHA secrets must
be stored only in Kubernetes Secrets or an approved external-secret mechanism,
never in --set, values.yaml, or ConfigMaps.

- Make the db_upgrade_scripts requirement conditional on reaching an
  already-deployed environment, not every schema change
- Fix db_scripts/AGENTS.md and root AGENTS.md: init_db.sh injects the DB
  password via Helm --set from the postgres namespace's db-common-secrets
  cluster secret, it does not read it from init_values.yaml (that field
  is commented out and must stay that way) — the previous wording could
  have led someone to uncomment and commit a real password
- Fix db_upgrade_scripts/AGENTS.md: db-test.yml only validates
  db_scripts/mosip_toolkit (triggers on db_scripts/** only), it does not
  run against this folder — this line contradicted the correct statement
  already present later in the same file
- Fix helm/AGENTS.md: stop grouping secrets with values.yaml/--set/
  ConfigMap in the Do-not guidance; secrets belong only in Kubernetes
  Secrets, which contradicted the correct statement on the very next line

Signed-off-by: Chetan Kumar Hirematha <chetankumar.h.239@gmail.com>
"Sensor Biometric Interface" was wrong. Per MOSIP's own docs
(docs.mosip.io/develop/biometrics/secure-biometric-interface), SBI is
the Secure Biometric Interface — a protocol for biometric capture
devices to expose capabilities and perform trusted capture for
registration/authentication client apps.

Signed-off-by: Chetan Kumar Hirematha <chetankumar.h.239@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@db_scripts/AGENTS.md`:
- Around line 62-67: Replace the plaintext password injection workflow with the
chart-supported Kubernetes Secret/external-secret reference pattern: in
db_scripts/AGENTS.md lines 62-67, document Secret-reference installation without
reading or passing the password via Helm --set; update db_scripts/AGENTS.md line
87 to remove the agent rule instructing --set password injection; and update
AGENTS.md line 95 to describe the Secret-reference workflow instead of Helm
--set injection.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 72bc9635-a014-4759-abf0-8c322cdade5f

📥 Commits

Reviewing files that changed from the base of the PR and between fef87af and ca554e2.

📒 Files selected for processing (4)
  • AGENTS.md
  • db_scripts/AGENTS.md
  • db_upgrade_scripts/AGENTS.md
  • helm/AGENTS.md

Comment thread db_scripts/AGENTS.md
Comment on lines +62 to +67
`init_db.sh` prompts for confirmation, then reads the app DB user's password from the `postgres`
namespace's `db-common-secrets` cluster secret and passes it to the chart via `--set
dbUserPasswords.dbuserPassword="$DB_USER_PASSWORD"` — it does **not** read the password from
`init_values.yaml` (that field is commented out there and unused; leave it that way, do not
uncomment and fill it in). It then installs/reinstalls the `postgres-init-toolkit` Helm release in
the `compliance-toolkit` namespace, overwriting any existing `mosip_toolkit` DB — back it up first

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg '(^|/)AGENTS\.md$|db_scripts/(AGENTS\.md|init_db\.sh|init_values\.yaml)$'

echo
echo "== relevant db_scripts references =="
if [ -f db_scripts/AGENTS.md ]; then
  sed -n '55,92p' db_scripts/AGENTS.md | cat -n
fi

echo
echo "== root AGENTS reference =="
if [ -f AGENTS.md ]; then
  sed -n '88,100p' AGENTS.md | cat -n
fi

echo
echo "== init_db.sh outline/search =="
if [ -f db_scripts/init_db.sh ]; then
  wc -l db_scripts/init_db.sh
  rg -n "DB_USER_PASSWORD|db-common-secrets|dbUserPasswords|helm|values|postgres-init-toolkit|mosip_toolkit" db_scripts/init_db.sh
  sed -n '1,240p' db_scripts/init_db.sh | cat -n
fi

echo
echo "== init_values password field =="
if [ -f db_scripts/init_values.yaml ]; then
  rg -n "dbUserPasswords|dbuserPassword" db_scripts/init_values.yaml -C 3
fi

echo
echo "== occurrences across repo =="
rg -n "dbUserPasswords|dbuserPassword|db-common-secrets|init_db.sh|postgres-init-toolkit" -S

Repository: mosip/mosip-compliance-toolkit

Length of output: 6747


🌐 Web query:

Helm --set values plaintext values.yaml secret recommendation environment variable Kubernetes secrets

💡 Result:

Using Helm --set or values.yaml to provide plaintext secrets is strongly discouraged because these values are often committed to version control, stored in plaintext within the Helm release secret inside Kubernetes, and echoed in CI/CD logs [1][2][3][4]. For secure secret management in Kubernetes using Helm, follow these industry-standard approaches: 1. Use External Secrets Management This is the recommended approach for production environments [2][3][5]. Tools like the External Secrets Operator (ESO), HashiCorp Vault, or cloud-native managers (AWS Secrets Manager, Azure Key Vault, etc.) allow you to store secrets outside your cluster [2][6][5]. Your Helm chart should simply reference the name of the secret or the external resource, rather than the sensitive content itself [1][2][7]. Example of referencing a pre-existing secret: env: - name: DB_PASSWORD valueFrom: secretKeyRef: name: {{.Values.secretName }} # Reference the secret name, not the value key: password 2. Encrypt Values Files (GitOps Approach) If you must store secrets in your repository, use an encryption tool like SOPS (often used with the helm-secrets plugin) or Sealed Secrets [6][8][9][4]. - helm-secrets/SOPS: Encrypts your values files at rest. The values are decrypted on the fly during deployment [6][8][4]. - Sealed Secrets: Allows you to commit an encrypted 'SealedSecret' resource to your repository, which is then decrypted by a controller inside your cluster [9]. 3. Development vs. Production While hardcoding secrets in values.yaml is sometimes seen in local development for convenience, it is a significant security risk [2][5]. If you adopt this for local use, ensure these files are excluded from version control (e.g., via.gitignore) and never used in shared environments [5][4]. Summary of Recommendations: - Do not use --set or values.yaml for plaintext secrets [1][2]. - Externalize secrets using Operators (e.g., ESO) to pull from secure vaults [1][2][5]. - Use file encryption (SOPS/Sealed Secrets) if secrets must be managed via GitOps [6][8][9]. - Always use secretKeyRef in your Pod templates to mount secrets as environment variables [1][7][10].

Citations:


Remove plaintext database credentials from the Helm value path.

db_scripts/init_db.sh reads db-common-secrets, decrypts db-dbuser-password, and passes it with --set dbUserPasswords.dbuserPassword="$DB_USER_PASSWORD". Helm releases may store values in Kubernetes, and process arguments/logs can expose the password. Use the chart’s supported Kubernetes Secret/external-secret reference pattern instead, and update all three documented sites that describe this same workflow.

  • db_scripts/AGENTS.md: change the install flow to use only a Secret reference, not --set dbUserPasswords.dbuserPassword="$DB_USER_PASSWORD".
  • db_scripts/AGENTS.md agent rule: stop instructing --set injection of the DB user password.
  • AGENTS.md: replace the root-level description of Helm --set injection with the Secret-reference workflow.
📍 Affects 2 files
  • db_scripts/AGENTS.md#L62-L67 (this comment)
  • db_scripts/AGENTS.md#L87-L87
  • AGENTS.md#L95-L95
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@db_scripts/AGENTS.md` around lines 62 - 67, Replace the plaintext password
injection workflow with the chart-supported Kubernetes Secret/external-secret
reference pattern: in db_scripts/AGENTS.md lines 62-67, document
Secret-reference installation without reading or passing the password via Helm
--set; update db_scripts/AGENTS.md line 87 to remove the agent rule instructing
--set password injection; and update AGENTS.md line 95 to describe the
Secret-reference workflow instead of Helm --set injection.

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