That works fine except that the following line does only issue the sequential number and not the chapter number.
MWE:
\startuseMPgraphic{CountFrame}
picture p; numeric w, h, o;
p := textext.rt("\wrappedcurrentconstruction");
w := OverlayWidth;
h := OverlayHeight;
o := BodyFontSize;
p := p shifted (2o,h-ypart center p);
draw p;
path b;
b := boundingbox p enlarged (o/10);
path a;
a := (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h);
drawoptions (withpen pencircle scaled 1pt withcolor black);
draw a;
draw b;
setbounds currentpicture to OverlayBox;
\stopuseMPgraphic
\defineoverlay
[CountFrame]
[\useMPgraphic{CountFrame}]
\defineframedtext
[CountFramedText]
[frame=off,
background=CountFrame,
offset=\bodyfontsize,
width=\textwidth,
% style={\switchtobodyfont[11pt,tt]}]
bodyfont=11pt,
style={\tt}]
\defineenumeration
[Code]
[title=yes,
alternative=empty,
before=\startCountFramedText,
after=\stopCountFramedText,
left={\somenamedheadnumber{chapter}{current}.}]
\starttext
\startchapter
[title=first]
\startCode
[title={The First Title},
reference={tit1}]
Some verbatim text
\stopCode
\startCode
[title={The Second Title},
reference={tit2}]
Some verbatim text
\stopCode
Refer to \in{code fragment}[tit1] bla
\stopchapter
\startchapter
[title=second]
\startCode
[title={The Third Title},
reference={tit3}]
Some verbatim text
\stopCode
\stopchapter
\stoptext