Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (claude): gate METRICS.md nudge on the appMetrics source being enabled

Adam Eivybfa0a36cb56a
diff --git a/server/services/layeredIntelligence.js b/server/services/layeredIntelligence.js
index 882b79a2df..214e8547d3 100644
--- a/server/services/layeredIntelligence.js
+++ b/server/services/layeredIntelligence.js
@@ -507,9 +507,12 @@ export function buildPrompt({ app, config, sources = {}, openIssues = [], isPort
// Nudge a managed app with no own-performance signal (no METRICS.md gathered)
// toward adding one, so future runs can judge real performance. PortOS is exempt
- // — it measures itself through cosMetrics.
+ // — it measures itself through cosMetrics. Also gate on the source being ENABLED:
+ // if the user deliberately turned appMetrics off, a METRICS.md may well exist, so
+ // "add a METRICS.md" would be a misleading (and possibly redundant) proposal.
const hasAppMetrics = Boolean(typeof sources.appMetrics === 'string' && sources.appMetrics.trim());
- const metricsGuidance = (!isPortos && !hasAppMetrics)
+ const appMetricsEnabled = config.sources?.appMetrics !== false;
+ const metricsGuidance = (!isPortos && appMetricsEnabled && !hasAppMetrics)
? '\nThis app exposes no own-performance metrics yet (no METRICS.md). If you lack the data to judge how it is doing against its goals, a high-value app-data-gap proposal is to add a METRICS.md documenting how the app measures success — its user-success/KPI signals and where its production telemetry or data lives — so future runs can reason about real performance.\n'
: '';
diff --git a/server/services/layeredIntelligence.test.js b/server/services/layeredIntelligence.test.js
index 119d1c4765..3cb126a828 100644
--- a/server/services/layeredIntelligence.test.js
+++ b/server/services/layeredIntelligence.test.js
@@ -478,6 +478,16 @@ describe('buildPrompt', () => {
expect(present).not.toContain('no METRICS.md');
});
+ it('does not nudge to add a METRICS.md when the appMetrics source is deliberately off', () => {
+ // Source disabled → the file may exist but wasn't gathered; nudging to "add"
+ // one would be misleading. No nudge despite empty gathered sources.
+ const out = buildPrompt({
+ app, isPortos: false,
+ config: { allowedScopes: ['app-data-gap'], rules: '', sources: { appMetrics: false } }
+ });
+ expect(out).not.toContain('no METRICS.md');
+ });
+
it('does not nudge PortOS toward a METRICS.md (it measures itself via cosMetrics)', () => {
const out = buildPrompt({ app, isPortos: true, config: { allowedScopes: ['portos-self'], rules: '' } });
expect(out).not.toContain('no METRICS.md');