aws / aws/amazon-q-developer-cli
Bug: Agent Violates "Never Hardcode" Rule When Generating Tools and Scripts
- Vorherrschende Sprache
- Rust
- Sterne
- 2k
- Forks
- 439
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
# Bug: Agent Violates "Never Hardcode" Rule When Generating Tools and Scripts
**Note:** This issue affects Kiro CLI agent code generation practices.
## Problem
* Agents generate tools and scripts with hardcoded values despite explicit "never hardcode" instructions
* Session management tools contain hardcoded project names, work types, and content templates
* Generated code violates fundamental coding best practices and creates misleading outputs
* Scripts fail to detect current project context or work being performed
* Results in multiple incorrect session documents when tool is reused across projects
## Proposed Solution
Add enforcement mechanisms to prevent hardcoding in agent-generated code:
```javascript
// Instead of hardcoded values
const projectName = "SpecificProject";
const workType = "Security Audit";
// Should generate dynamic detection
const projectName = detectCurrentProject();
const workType = analyzeCurrentWork();
```
Implement validation checks that:
* Detect hardcoded strings in generated code
* Suggest dynamic alternatives
* Warn when context-specific values are embedded
## Benefits
* Ensures agent-generated tools work correctly across different projects
* Maintains coding best practices and golden rules
* Prevents misleading documentation and context pollution
* Creates reusable, context-aware tooling
* Reduces need for manual fixes and regeneration
## Alternatives Considered
* Manual code review (doesn't scale with agent usage)
* Post-generation fixes (reactive rather than preventive)
* User-side validation (places burden on users to catch violations)
Beitragsleitfaden
Rechercherichtung
Das Issue nennt keine Dateien, Tests oder Einstiegspunkte; beginne damit, die Implementierung der Agent-Codegenerierung und des Session-Managements zu lokalisieren. Lege zuerst einen reproduzierbaren projektübergreifenden Fall und den Validierungsumfang fest; abgeschlossen ist die Arbeit, wenn kontextspezifische fest codierte Werte erkannt werden und generierte Tools warnen oder dynamischen Kontext verwenden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- ai, cli, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100