ERP / CRM Advisor
Use when the user asks about ERP/CRM bottlenecks, vendor-specific data semantics,
integration failures, upgrades, reports, duplicate postings or tenant/company leakage.
Codex performs the interpretation; no separate LLM API key is required.
Resolve the plugin root two directories above this file. Read
ERP_CRM_ANALYSIS.md and runtime/erp-crm-catalog.json relative to that root.
Invoke its absolute runtime/runTool.js path; use JSON via stdin (-) for inputs.
Install missing dependencies with npm ci in the plugin root.
- Run
erp_crm_vendor_catalog with {}. Select an exact product profile; do not
equate Dataverse with Finance and Operations or Business Central, or SAP ECC
with S/4HANA. Obtain product release, instance ID, environment and deployment.
- Run
erp_crm_evidence_plan with the selected product. Identify installed
modules, customizations and affected business processes. Separate application
execution from database, API and reporting costs.
- Inspect authorized, redacted exports and traces using available read-only
tools. Do not invent credentials, assume native SaaS connectors, or send SOQL,
SuiteQL, ABAP or HANA syntax to the SQL Server/PostgreSQL adapter.
Use
erp_crm_import_diagnostics for supported exports. For Dataverse traces or
Salesforce query plans, use erp_crm_collect_api only with a configured
provider URL, matching system ID, access token and explicit API version.
A collector implementation is not proof that the customer's tenant was tested.
- Build evidence bundles with matching context, trace references and actual
observation timestamps. Populate supported numeric diagnostics from exports.
For qualitative observations, assess the relevant code/configuration with an
explanation tied to a trace or file reference; use
manual_review for your
interpretation. Never convert absent evidence into false, and never pretend
a user assertion is a live measurement. Preserve provenance in the answer.
- Run
erp_crm_risk_analyzer. Explain prioritized findings, business impact,
evidence, owner and next verification step. Include unresolved/conflicting
checks and coverage of this finite catalog. Check the cited manufacturer
guidance against the actual release before making product-specific claims.
- For an optimization claim, run
benchmark_evidence_compare on comparable,
timestamped samples with case IDs, result hashes and row counts. Reject faster
results with semantic differences or errors. Explain sampling and uncertainty;
do not replace measured benchmarks with estimated advisor scores.
Also run workload_regression_guard with the same runs to detect individual
cases hidden by aggregate gains. Its defaults are a 10 percent per-case budget
and a 1 ms noise floor; set these from the workload requirements. Repeat flagged
cases under controlled load. A flag is not statistical proof or apply approval.
Supply caseBudgets when the process owner provides absolute deadlines:
[{"caseId":"case-0","businessProcess":"Order posting","maxDurationMs":100}].
Review existing as well as newly breached budgets. Unassessed cases are not
evidence of business-SLO compliance. Preserve the returned policyHash with the
benchmark inputHash so threshold changes remain distinguishable.
Review order-to-cash, procure-to-pay, period close and reporting where applicable:
company keys, document/line grain, status transitions, currencies/units, effective
dates, soft deletes, replication freshness and retry idempotency. Use control
totals from the business owner; a faster query that changes business meaning is
not an optimization.
Run business_reconciliation_compare for business control exports before accepting
an optimization. Both before and after require the full ERP scope, matching
period, snapshotHash and definitionHash (SHA256), distinct exportId, fresh
capturedAt, and nonempty controls. Each control has companyId, currency,
unit, metric, amount as an exact decimal string, and integer rowCount.
Use an explicitly agreed unit/currency label for nonmonetary metrics. Never invent
hashes, totals or counts. Missing groups are not zero. A matched result proves only
the supplied aggregate controls, not row-level equivalence; retain result-hash checks.
Analysis tools do not execute corrections. Do not modify vendor-managed tables,
indexes, permissions or production application data as part of this workflow.
Prepare supported remediation and before/after verification for authorized work.
No result establishes exhaustive coverage, vendor certification or compliance.
Persistent advisory cases
Use advisory_case for a tracked engagement. Every call requires systemId,
environment, product, and productVersion. Create with action: create and
objective; later calls need caseId and mutations need expectedRevision from
the last read. Follow this sequence:
diagnose: hypothesis, evidenceRefs (references are not attested facts).
propose: change, rollback, testPlan, workloadId, customizationHash
(SHA256 of the agreed customization inventory), and businessContract with
definitionHash, period, deployment, and groups. Each group has companyId,
currency, unit, metric. All expected groups must be agreed before approval;
do not derive the expected set solely from a potentially incomplete candidate.
approve_test: matching proposalHash, reviewer, approvalRef, approvedAt
(timestamp within seven days) from an actual
user approval. Never invent approval. This records a statement, not authenticated
authorization, and executes nothing.
verify, then follow_up: matching proposalHash, measurements for
repeated_benchmark_review, and businessControls for business_reconciliation_compare.
Control scope, period, definition and exact group set must match the approved
contract; snapshotHash must equal the benchmark datasetHash. Follow-up controls
must be newer. Missing controls cannot be waived by passing performance results.
Measurements must not predate the recorded test approval.
Each run must include the full case scope. Follow-up must use newer measurements,
the same workload and thresholds. A verified state means evidence was assessed,
not that an improvement succeeded; inspect its decision.
close: outcome (confirmed, false_positive, inconclusive), corrected
boolean, reviewer, note. Confirmation requires technical and business checks
to pass at both stages. Old proposals without contracts require a new case.
Use read to resume, and quality_report to aggregate reviewed cases within the
exact same scope/version. Neither reviews nor local storage authenticate a tenant;
use separate OS-protected state directories for different trust boundaries.
Use find_confirmed with workloadId and customizationHash for up to ten relevant
confirmed cases. Search is limited to the latest 1000 cases in the exact scope;
legacy cases without business checks are excluded. Returned cases are examples
for review, not automatic optimization instructions.
Optional causalEvidence on diagnose is validated by causal_evidence_review:
events contain the four case-scope fields, id, traceId, layer (application,
integration, database), startedAt, durationMs, evidenceRef. hypotheses contain
id, claim, supportRefs, refuteRefs. References must resolve; stale or wrong-scope
events are rejected. Report contradictions and unresolved alternatives explicitly.
1---2name: erp-crm-advisor3description: Use when diagnosing ERP or CRM performance, integration failures, tenant isolation, reporting or customization risks using scoped evidence and explicit vendor-coverage gaps.4---56# ERP / CRM Advisor78Use when the user asks about ERP/CRM bottlenecks, vendor-specific data semantics,9integration failures, upgrades, reports, duplicate postings or tenant/company leakage.10Codex performs the interpretation; no separate LLM API key is required.1112Resolve the plugin root two directories above this file. Read13`ERP_CRM_ANALYSIS.md` and `runtime/erp-crm-catalog.json` relative to that root.14Invoke its absolute `runtime/runTool.js` path; use JSON via stdin (`-`) for inputs.15Install missing dependencies with `npm ci` in the plugin root.16171. Run `erp_crm_vendor_catalog` with `{}`. Select an exact product profile; do not18 equate Dataverse with Finance and Operations or Business Central, or SAP ECC19 with S/4HANA. Obtain product release, instance ID, environment and deployment.202. Run `erp_crm_evidence_plan` with the selected `product`. Identify installed21 modules, customizations and affected business processes. Separate application22 execution from database, API and reporting costs.233. Inspect authorized, redacted exports and traces using available read-only24 tools. Do not invent credentials, assume native SaaS connectors, or send SOQL,25 SuiteQL, ABAP or HANA syntax to the SQL Server/PostgreSQL adapter.26 Use `erp_crm_import_diagnostics` for supported exports. For Dataverse traces or27 Salesforce query plans, use `erp_crm_collect_api` only with a configured28 provider URL, matching system ID, access token and explicit API version.29 A collector implementation is not proof that the customer's tenant was tested.304. Build evidence bundles with matching context, trace references and actual31 observation timestamps. Populate supported numeric diagnostics from exports.32 For qualitative observations, assess the relevant code/configuration with an33 explanation tied to a trace or file reference; use `manual_review` for your34 interpretation. Never convert absent evidence into `false`, and never pretend35 a user assertion is a live measurement. Preserve provenance in the answer.365. Run `erp_crm_risk_analyzer`. Explain prioritized findings, business impact,37 evidence, owner and next verification step. Include unresolved/conflicting38 checks and coverage of this finite catalog. Check the cited manufacturer39 guidance against the actual release before making product-specific claims.406. For an optimization claim, run `benchmark_evidence_compare` on comparable,41 timestamped samples with case IDs, result hashes and row counts. Reject faster42 results with semantic differences or errors. Explain sampling and uncertainty;43 do not replace measured benchmarks with estimated advisor scores.44 Also run `workload_regression_guard` with the same runs to detect individual45 cases hidden by aggregate gains. Its defaults are a 10 percent per-case budget46 and a 1 ms noise floor; set these from the workload requirements. Repeat flagged47 cases under controlled load. A flag is not statistical proof or apply approval.48 Supply `caseBudgets` when the process owner provides absolute deadlines:49 `[{"caseId":"case-0","businessProcess":"Order posting","maxDurationMs":100}]`.50 Review existing as well as newly breached budgets. Unassessed cases are not51 evidence of business-SLO compliance. Preserve the returned policyHash with the52 benchmark inputHash so threshold changes remain distinguishable.5354Review order-to-cash, procure-to-pay, period close and reporting where applicable:55company keys, document/line grain, status transitions, currencies/units, effective56dates, soft deletes, replication freshness and retry idempotency. Use control57totals from the business owner; a faster query that changes business meaning is58not an optimization.5960Run `business_reconciliation_compare` for business control exports before accepting61an optimization. Both `before` and `after` require the full ERP scope, matching62`period`, `snapshotHash` and `definitionHash` (SHA256), distinct `exportId`, fresh63`capturedAt`, and nonempty `controls`. Each control has `companyId`, `currency`,64`unit`, `metric`, `amount` as an exact decimal string, and integer `rowCount`.65Use an explicitly agreed unit/currency label for nonmonetary metrics. Never invent66hashes, totals or counts. Missing groups are not zero. A matched result proves only67the supplied aggregate controls, not row-level equivalence; retain result-hash checks.6869Analysis tools do not execute corrections. Do not modify vendor-managed tables,70indexes, permissions or production application data as part of this workflow.71Prepare supported remediation and before/after verification for authorized work.72No result establishes exhaustive coverage, vendor certification or compliance.7374## Persistent advisory cases7576Use `advisory_case` for a tracked engagement. Every call requires `systemId`,77`environment`, `product`, and `productVersion`. Create with `action: create` and78`objective`; later calls need `caseId` and mutations need `expectedRevision` from79the last read. Follow this sequence:8081- `diagnose`: `hypothesis`, `evidenceRefs` (references are not attested facts).82- `propose`: `change`, `rollback`, `testPlan`, `workloadId`, `customizationHash`83 (SHA256 of the agreed customization inventory), and `businessContract` with84 `definitionHash`, `period`, `deployment`, and `groups`. Each group has `companyId`,85 `currency`, `unit`, `metric`. All expected groups must be agreed before approval;86 do not derive the expected set solely from a potentially incomplete candidate.87- `approve_test`: matching `proposalHash`, `reviewer`, `approvalRef`, `approvedAt`88 (timestamp within seven days) from an actual89 user approval. Never invent approval. This records a statement, not authenticated90 authorization, and executes nothing.91- `verify`, then `follow_up`: matching `proposalHash`, `measurements` for92 `repeated_benchmark_review`, and `businessControls` for `business_reconciliation_compare`.93 Control scope, period, definition and exact group set must match the approved94 contract; `snapshotHash` must equal the benchmark `datasetHash`. Follow-up controls95 must be newer. Missing controls cannot be waived by passing performance results.96 Measurements must not predate the recorded test approval.97 Each run must include the full case scope. Follow-up must use newer measurements,98 the same workload and thresholds. A verified state means evidence was assessed,99 not that an improvement succeeded; inspect its decision.100- `close`: `outcome` (`confirmed`, `false_positive`, `inconclusive`), `corrected`101 boolean, `reviewer`, `note`. Confirmation requires technical and business checks102 to pass at both stages. Old proposals without contracts require a new case.103104Use `read` to resume, and `quality_report` to aggregate reviewed cases within the105exact same scope/version. Neither reviews nor local storage authenticate a tenant;106use separate OS-protected state directories for different trust boundaries.107108Use `find_confirmed` with `workloadId` and `customizationHash` for up to ten relevant109confirmed cases. Search is limited to the latest 1000 cases in the exact scope;110legacy cases without business checks are excluded. Returned cases are examples111for review, not automatic optimization instructions.112113Optional `causalEvidence` on `diagnose` is validated by `causal_evidence_review`:114`events` contain the four case-scope fields, `id`, `traceId`, `layer` (application,115integration, database), `startedAt`, `durationMs`, `evidenceRef`. `hypotheses` contain116`id`, `claim`, `supportRefs`, `refuteRefs`. References must resolve; stale or wrong-scope117events are rejected. Report contradictions and unresolved alternatives explicitly.